Bug 196293

Summary: [GTK][GStreamer] Web Audio - Media element source - Audio is cracking.
Product: WebKit Reporter: softrobot
Component: Web AudioAssignee: Philippe Normand <pnormand>
Status: RESOLVED FIXED    
Severity: Normal CC: brianpeiris, calvaris, eric.carlson, ews-watchlist, glenn, jason, jer.noble, mcatanzaro, nchase, philipj, pnormand, sergio, vjaquez, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
WiP patch
none
GStreamer log with WPE 2.24 and WIP patch
none
Patch none

Description softrobot 2019-03-27 04:35:22 PDT
Hi!
When trying to play an <audio> element through Web Audio using createMediaElementSource, I hear cracking noises at the beginning of the audio.
I have tested this with Epiphany on a linux desktop using "flatpak run org.gnome.Epiphany.Devel/x86_64/master" and also on the latest WPE. On Firefox the audio plays clearly.
I created an example here: http://softbot.avner.us/test/media-element-source.html
It happens both when streaming the audio and also when referencing a file through a direct path, as in here: http://softbot.avner.us/test/media-element-source-file.html
When using a buffer source from "decodeAudioData", the audio plays clearly.
Thank you!

/Avner
Comment 1 Philippe Normand 2019-03-27 06:36:55 PDT
Created attachment 366067 [details]
WiP patch

Can you test this? I still hear an audio clip issue but with audiointerleave the output seems better, you need to check you have audiointerleave: gst-inspect-1.0 audiointerleave
Comment 2 softrobot 2019-03-28 07:30:45 PDT
Hi, thanks for the patch! Hopefully I can test it out tomorrow.
/Avner
Comment 3 softrobot 2019-03-29 08:00:51 PDT
Created attachment 366271 [details]
GStreamer log with WPE 2.24 and WIP patch
Comment 4 softrobot 2019-03-29 08:01:41 PDT
Hi, I applied the patch on WPE 2.24 (I don't have yet a compiling environment for the desktop WebKitGTK.), but the situation there seems worse. I only hear a tiny fragment of the audio, and the rest is silence. However it wasn't really playing anything on WPE from before the patch as well. I attached the gst log, maybe you could make something out of it.
Comment 5 Philippe Normand 2019-03-29 08:19:19 PDT
Sorry, I currently don't have time to debug RPi things.
Comment 6 softrobot 2019-03-29 08:30:01 PDT
OK. I'll try to compile Epiphany on my desktop over the weekend.
Comment 7 Michael Catanzaro 2019-06-24 10:56:50 PDT

*** This bug has been marked as a duplicate of bug 197847 ***
Comment 8 Philippe Normand 2019-06-24 11:09:46 PDT
I'm not sure this is a duplicate. Reopening until I get access to the test-case again, @softrobot
Comment 9 softrobot 2019-07-08 09:30:56 PDT
Hello and sorry for disappearing!

The test case exists now in here:
https://hitodama.online/test/media-element-source.html

I just tested it with org.gnome.Epiphany.Devel/x86_64/master (3.33.3-60-g7173aefcc, WebKitGTK 2.25.2) and the sound still breaks up in the beginning.

Thanks!

/Avner
Comment 10 Michael Catanzaro 2019-07-08 10:32:19 PDT
OK, I hear the bug. Definitely not bug #197847.
Comment 11 Brian Peiris 2019-12-20 17:01:06 PST
I think I may also be running into this bug. The test pages on softbot.avner.us and hitodama.online are no longer available. Please consider making them available again.
Comment 12 softrobot 2019-12-20 17:52:12 PST
Hi,
Sorry this link is from a project I'm not maintaining at the moment.
I was able to start it though:

https://hitodama.online/test/media-element-source.html

If it becomes unavailable again you can reproduce it from the following files:
Express JS function: https://github.com/Avnerus/softbot/blob/8170602e14e3819da97c241e73983cbe69a62fec/server/index.js#L92

Client HTML: 
https://github.com/Avnerus/softbot/blob/master/public/test/media-element-source.html

/Avmer
Comment 13 Brian Peiris 2019-12-20 18:14:10 PST
Thanks for the quick reply! I can confirm that I'm seeing this bug on my Macbook with Safari 13.0.4.

I've uploaded your test to a static site, with a small change to comply with Safari and Chrome's audio playback restrictions. https://brianpeiris.github.io/safari-audio-crack-test/

The plays clearly in Chrome and Firefox on the same machine.
Comment 14 Philippe Normand 2021-04-03 08:19:38 PDT
Created attachment 425095 [details]
Patch
Comment 15 EWS 2021-04-06 06:30:50 PDT
Committed r275512: <https://commits.webkit.org/r275512>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 425095 [details].
Comment 16 Radar WebKit Bug Importer 2021-04-06 06:31:18 PDT
<rdar://problem/76264573>