Skip to content

Conversation

@philn
Copy link
Member

@philn philn commented Sep 2, 2025

a1f6b0b

[GStreamer][WebAudio] Garbled rendering when the internal audio mixer is enabled
https://bugs.webkit.org/show_bug.cgi?id=298235

Reviewed by Xabier Rodriguez-Calvar.

When the WEBKIT_GST_ENABLE_AUDIO_MIXER=1 environment variable is set, audio buffers are sent to a
separate pipeline using interaudiosink. That process-wide singleton pipeline is then in charge of
audio mixing and rendering to an actual audio device.

For WebAudio it wasn't working properly, leading to garbled rendering, due to the audiomixer sink
pad corresponding to the WebAudio source not using the same sample rate and also interaudiosrc using
a sample period-size too big. We now align these values between the WebAudio sink and its matching
interaudiosrc audiomixer branch.

The Rialto WebAudio sink configuration was also moved to the Rialto quirk and the version check
removed (I couldn't find the reasoning behind that).

* Source/WebCore/platform/audio/gstreamer/AudioDestinationGStreamer.cpp:
(WebCore::AudioDestinationGStreamer::AudioDestinationGStreamer):
* Source/WebCore/platform/graphics/gstreamer/GStreamerAudioMixer.cpp:
(WebCore::GStreamerAudioMixer::registerProducer):
(WebCore::GStreamerAudioMixer::configureSourcePeriodTime):
* Source/WebCore/platform/graphics/gstreamer/GStreamerAudioMixer.h:
* Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp:
(WebCore::createPlatformAudioSink):
* Source/WebCore/platform/graphics/gstreamer/WebKitAudioSinkGStreamer.cpp:
(webKitAudioSinkConfigure):
(webKitAudioSinkChangeState):
(webKitAudioSinkConstructed):
(webkitAudioSinkNew):
* Source/WebCore/platform/graphics/gstreamer/WebKitAudioSinkGStreamer.h:
* Source/WebCore/platform/gstreamer/GStreamerQuirkRialto.cpp:
(WebCore::GStreamerQuirkRialto::createWebAudioSink):
* Source/WebCore/platform/gstreamer/GStreamerQuirks.cpp:
(WebCore::GStreamerQuirksManager::createWebAudioSink):

Canonical link: https://commits.webkit.org/299489@main

7c583ef

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ✅ 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🛠 wpe-cairo
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2 ✅ 🛠 playstation
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@philn philn self-assigned this Sep 2, 2025
@philn philn added the Platform Portability improvements and other general platform improvements not driven directly by site bugs. label Sep 2, 2025
@philn philn requested a review from calvaris September 2, 2025 15:54
@philn philn added the GLib Suggested Backport - 2.50 Suggest this merge request be backported to webkitglib/2.50 branch label Sep 2, 2025
@philn philn added the merge-queue Applied to send a pull request to merge-queue label Sep 3, 2025
… is enabled

https://bugs.webkit.org/show_bug.cgi?id=298235

Reviewed by Xabier Rodriguez-Calvar.

When the WEBKIT_GST_ENABLE_AUDIO_MIXER=1 environment variable is set, audio buffers are sent to a
separate pipeline using interaudiosink. That process-wide singleton pipeline is then in charge of
audio mixing and rendering to an actual audio device.

For WebAudio it wasn't working properly, leading to garbled rendering, due to the audiomixer sink
pad corresponding to the WebAudio source not using the same sample rate and also interaudiosrc using
a sample period-size too big. We now align these values between the WebAudio sink and its matching
interaudiosrc audiomixer branch.

The Rialto WebAudio sink configuration was also moved to the Rialto quirk and the version check
removed (I couldn't find the reasoning behind that).

* Source/WebCore/platform/audio/gstreamer/AudioDestinationGStreamer.cpp:
(WebCore::AudioDestinationGStreamer::AudioDestinationGStreamer):
* Source/WebCore/platform/graphics/gstreamer/GStreamerAudioMixer.cpp:
(WebCore::GStreamerAudioMixer::registerProducer):
(WebCore::GStreamerAudioMixer::configureSourcePeriodTime):
* Source/WebCore/platform/graphics/gstreamer/GStreamerAudioMixer.h:
* Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp:
(WebCore::createPlatformAudioSink):
* Source/WebCore/platform/graphics/gstreamer/WebKitAudioSinkGStreamer.cpp:
(webKitAudioSinkConfigure):
(webKitAudioSinkChangeState):
(webKitAudioSinkConstructed):
(webkitAudioSinkNew):
* Source/WebCore/platform/graphics/gstreamer/WebKitAudioSinkGStreamer.h:
* Source/WebCore/platform/gstreamer/GStreamerQuirkRialto.cpp:
(WebCore::GStreamerQuirkRialto::createWebAudioSink):
* Source/WebCore/platform/gstreamer/GStreamerQuirks.cpp:
(WebCore::GStreamerQuirksManager::createWebAudioSink):

Canonical link: https://commits.webkit.org/299489@main
@webkit-commit-queue
Copy link
Collaborator

Committed 299489@main (a1f6b0b): https://commits.webkit.org/299489@main

Reviewed commits have been landed. Closing PR #50177 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit a1f6b0b into WebKit:main Sep 3, 2025
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Sep 3, 2025
@philn philn deleted the eng/298235 branch September 3, 2025 08:28
@aperezdc
Copy link
Contributor

aperezdc commented Sep 3, 2025

Backported into webkitglib/2.50 as commit cfbca67

@aperezdc aperezdc removed the GLib Suggested Backport - 2.50 Suggest this merge request be backported to webkitglib/2.50 branch label Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Platform Portability improvements and other general platform improvements not driven directly by site bugs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants