Support for WASM with +mutable-globals,+atomics target features
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- rust, wasm
- Área
- audio-video-rtc, backend
Línea de trabajo
The report points to host/webaudio/mod.rs and shows a JavaScript shim in audio-shim.js that copies samples into owned memory before calling AudioBuffer.copyToChannel. Start by reading the WebAudio output stream code and its existing tests. Done means audio playback works in WASM builds with +atomics and +mutable-globals in Firefox and Chrome; the issue reports no test file or recent maintainer response.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
I realise this is quite an obscure use-case, but currently if you try to play audio on WASM with the +atomics and +mutable-globals features enabled in Rust Nightly, Firefox and Chrome error out since AudioBuffer.copyToChannel doesn't support SharedArrayBuffers.
Error on Firefox:
panicked at 'Unable to write sample data into the audio context buffer: JsValue(TypeError: AudioBuffer.copyToChannel: Argument 1 can't be a SharedArrayBuffer or an ArrayBufferView backed by a SharedArrayBuffer
Error on Chrome:
web.js:446 panicked at 'Unable to write sample data into the audio context buffer: JsValue(TypeError: Failed to execute 'copyToChannel' on 'AudioBuffer': The provided Float32Array value must not be shared.
TypeError: Failed to execute 'copyToChannel' on 'AudioBuffer': The provided Float32Array value must not be shared.
init/imports.wbg.__wbg_copyToChannel_74f68c0678489450/<@http://localhost/web.js:1244:25
handleError@http://localhost/web.js:310:18
init/imports.wbg.__wbg_copyToChannel_74f68c0678489450@http://localhost/web.js:1243:76
web_sys::features::gen_AudioBuffer::AudioBuffer::copy_to_channel::ha856702a3af061e5@http://localhost/web_bg.wasm:wasm-function[6669]:0x71ba4f
<cpal::host::webaudio::Device as cpal::traits::DeviceTrait>::build_output_stream_raw::{{closure}}::ha128e8e549ebdafb@http://localhost/web_bg.wasm:wasm-function[669]:0x2bcd81
EDIT:
I have managed to get it working by modifying host\webaudio\mod.rs by adding an external javascript call
webaudio\mod.rs:
#[wasm_bindgen(module = "/audio-shim.js")]
extern "C" {
fn copy_audio_buffer(dest: &AudioBuffer, src: &[f32], channel: i32);
}
// New, working version
copy_audio_buffer(&ctx_buffer, &temporary_channel_buffer, channel as i32);
// Previous, broken version
// ctx_buffer
// .copy_to_channel(&mut temporary_channel_buffer, channel as i32)
// .expect("Unable to write sample data into the audio context buffer");
audio-shim.js:
export function copy_audio_buffer(dest, src, channel) {
// Turn the array view into owned memory.
var standalone = [...src];
// Make it a Float32Array.
var buffer = new Float32Array(standalone);
// Copy the data.
dest.copyToChannel(buffer, channel);
}
( Many thanks to this webpage for that trick )
- Lenguaje dominante
- Rust
- Estrellas
- 4k
- Forks
- 554
- Merge medio
- 3 d 3 h
- PR fusionados (30 d)
- 4
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de RustAudio/cpal
-
aaudio: dynamic buffer tuning never grows the buffer (set_buffer_size_in_frames reports Err on success)Posiblemente ocupada @dannyward630 la tomó hace 4 días. Abiertohost - aaudio platform - android
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 1 día
-
WebAudio wasm build fails with wasm-bindgen panic=unwind closuresPosiblemente ocupada @bogusyogi la tomó hace 12 días. Abiertohost - webaudio platform - web
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
RustAudio/cpal#1394 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
New WASAPI implementationAbiertocode quality dependencies host - wasapi platform - windows
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
RustAudio/cpal#1416 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
host - pipewire platform - linux
Dificultad 4/5 1-2 días Aptitud para principiantes 52/100
RustAudio/cpal#1405 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
WASAPI: default-device activation fails with RPC_E_CHANGED_MODE after endpoint-notification callbacks put thread-pool threads into an STAPosiblemente ocupada @dannyward630 la tomó hace 5 días. Abiertocorrectness host - wasapi platform - windows
Dificultad 4/5 3-5 días Aptitud para principiantes 20/100
RustAudio/cpal#1402 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de RustAudio/cpal
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 1 día
-
priority middle
Dificultad 1/5 Menos de una hora Aptitud para principiantes 62/100
KATO-Hiro/AtCoderClans#12940 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 1 día
-
o8 next debug build aborts on Glass to Dark appearance switch (nil identifier messaged before check)Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
hurttlocker/o8#5112 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 1 día