Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 301315ef577356c7ec6a5af55b299aa1cf1f4b31
https://github.com/WebKit/WebKit/commit/301315ef577356c7ec6a5af55b299aa1cf1f4b31
Author: Claudio Saavedra <[email protected]>
Date: 2026-09-11 (Fri, 11 Sep 2026)
Changed paths:
M LayoutTests/platform/glib/TestExpectations
M LayoutTests/platform/wpe/TestExpectations
M
Source/WebCore/platform/mediastream/libwebrtc/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp
Log Message:
-----------
[GStreamer] Outgoing WebRTC audio under-feeds the resampler and reads past
its input
https://bugs.webkit.org/show_bug.cgi?id=323217
Reviewed by Philippe Normand.
pullAudioData() converts capture data into the 480-frame chunks libwebrtc
requires and sizes its input with gst_audio_converter_get_in_frames(), which
derives its answer from the resampler phase alone and excludes the filter
history the resampler has yet to accumulate. The resulting chunk is too small:
for a 44.1 kHz source it is 441 frames, from which the converter can produce
only 453 of the 480 frames requested. The resampler checks only that it can
emit the first output sample and then walks past the end of its buffer for the
remainder, so it corrupts part of every chunk and occasionally crashes the
WebRTC signalling thread. Every capture rate other than 48 kHz is affected,
and the count was computed once outside the loop although it depends on the
phase.
Size the chunk with gst_audio_converter_get_out_frames() instead, which does
account for the history, and recompute it for each chunk. The search starts
from the phase estimate but never above the frames actually buffered, since
for fractional ratios such as 22.05 kHz the estimate can sit one frame above
what the accumulated history already makes sufficient. The first chunk
consumes a few extra frames, which become filter history rather than being
dropped, so long-run consumption stays at the nominal ratio. Silence keeps the
previous sizing because it bypasses the converter.
Tests:
imported/w3c/web-platform-tests/webrtc-stats/hardware-capability-stats.https.html
imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-connectionState.https.html
imported/w3c/web-platform-tests/webrtc/RTCDTMFSender-ontonechange.https.html
*
Source/WebCore/platform/mediastream/libwebrtc/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp:
(WebCore::gstAudioConverterInputFramesForOutput):
(WebCore::RealtimeOutgoingAudioSourceLibWebRTC::pullAudioData):
* LayoutTests/platform/glib/TestExpectations:
* LayoutTests/platform/wpe/TestExpectations:
Canonical link: https://commits.webkit.org/320924@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications