NEW 266922
MediaElementAudioSourceNode doesn't pass audio sample data to subsequent node if based on MSE
https://bugs.webkit.org/show_bug.cgi?id=266922
Summary MediaElementAudioSourceNode doesn't pass audio sample data to subsequent node...
Andrey Goncharov
Reported 2023-12-28 02:26:33 PST
MediaElementAudioSourceNode doesn't pass audio sample data to subsequent node in audio graph if video/audio element represented by the MediaElementAudioSourceNode has MediaSource object as a source. If however the video/audio element has Blob object with the same data as a source, then MediaElementAudioSourceNode passes audio data correctly. There are two sample page links in the end of this description, that show buggy and correct behavior respectively. The problem is reproduced with AudioWorklet node, Analyser node and ScriptProcessor node (deprecated), so I used AudioWorklet node as the most relevant example. Steps to reproduce: 1. Create MediaSource object: var mediaSource = new MediaSource; 2. Create object URL from mediaSource and assign it as media element's source: videoElement.src = URL.createObjectURL(mediaSource); 3. Wait for the mediaSource object to switch to 'open' state, add source buffer to it and then append AAC init segment and audio samples in ISO BMFF container. 4. On a user's gesture, instantiate AudioContext and create MediaElementAudioSourceNode interface: audioContext.createMediaElementSource(videoElement); 5. Assemble audio graph, connecting AudioWorklet node and destination node consequently. AudioWorklet processor has basic configuration that only transmits sample data values to the main thread in its process() method. 6. Observe sample values returned by AudioWorklet node processor. Expected behavior: actual sample values in [-1, 1] range. Actual behavior: all sample values are zeroes. If the same audio samples are fed to the media element with Blob object, e.g. var blob = await fetchedData.blob(); videoElement.src = URL.createObjectURL(blob); then AudioWorklet node processor returns expected sample values. Here are simple demo pages for both scenarios (please wait several seconds for AAC samples to download): MediaSource related bug: https://dev.wmspanel.com/www_tmp/safari/safari_bug.html Correct behavior with Blob source: https://dev.wmspanel.com/www_tmp/safari/safari_ok.html Chrome and Firefox browsers show expected behavior on MacOS, Linux and Windows. The same issue is reproduced on iPadOS with all browsers. It seems like this issue is connected to this one: https://bugs.webkit.org/show_bug.cgi?id=180696 I'm not sure that they have the same cause, but might overlap though.
Attachments
Sample page displaying the issue (2.37 KB, text/html)
2023-12-28 02:50 PST, Andrey Goncharov
no flags
Sample page displaying the correct behavior (1.17 KB, text/html)
2023-12-28 02:51 PST, Andrey Goncharov
no flags
Script file to include into sample pages (2.57 KB, text/javascript)
2023-12-28 02:53 PST, Andrey Goncharov
no flags
Audio worklet processor file necessary for sample pages (915 bytes, text/javascript)
2023-12-28 02:56 PST, Andrey Goncharov
no flags
AAC audio samples for demo (1.07 MB, video/mp4)
2023-12-28 02:59 PST, Andrey Goncharov
no flags
Andrey Goncharov
Comment 1 2023-12-28 02:50:01 PST
Created attachment 469225 [details] Sample page displaying the issue
Andrey Goncharov
Comment 2 2023-12-28 02:51:28 PST
Created attachment 469226 [details] Sample page displaying the correct behavior
Andrey Goncharov
Comment 3 2023-12-28 02:53:31 PST
Created attachment 469227 [details] Script file to include into sample pages
Andrey Goncharov
Comment 4 2023-12-28 02:56:20 PST
Created attachment 469228 [details] Audio worklet processor file necessary for sample pages
Andrey Goncharov
Comment 5 2023-12-28 02:59:33 PST
Created attachment 469229 [details] AAC audio samples for demo
Radar WebKit Bug Importer
Comment 6 2024-01-04 03:26:13 PST
Note You need to log in before you can comment on or make changes to this bug.