commit 22b3401880c7d0a7f91dee5e3177fa7a1f8d4eea
parent a4f9b03492f6250ef5893a624ae63e343f3b9bd1
Author: Dan Baker <dbaker@mozilla.com>
Date: Thu, 23 Oct 2025 15:52:16 -0600
Bug 1995393 - Vendor libwebrtc from 645334dd76
Upstream commit: https://webrtc.googlesource.com/src/+/645334dd761fc08c9b35650b7abed46aa67543b4
Fix race condition in ChannelSend destructor
The frame_transformer_delegate_ must be reset and destroyed on the
encoder queue to avoid race conditions. This change moves the reset
operation to the encoder queue and waits for completion before
proceeding with the rest of the destruction.
Bug: chromium:435228818
Change-Id: I050207dc2b957d70b03d149ef41f0c0b7bd369df
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/404580
Commit-Queue: Henrik Lundin <henrik.lundin@webrtc.org>
Reviewed-by: Jakob Ivarsson‎ <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#45350}
Diffstat:
4 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/third_party/libwebrtc/README.mozilla.last-vendor b/third_party/libwebrtc/README.mozilla.last-vendor
@@ -1,4 +1,4 @@
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
-libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-23T21:43:10.801657+00:00.
+libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-23T21:52:03.674407+00:00.
# base of lastest vendoring
-2cf793d20c
+645334dd76
diff --git a/third_party/libwebrtc/audio/channel_send.cc b/third_party/libwebrtc/audio/channel_send.cc
@@ -577,9 +577,18 @@ ChannelSend::ChannelSend(
ChannelSend::~ChannelSend() {
RTC_DCHECK(construction_thread_.IsCurrent());
- // Resets the delegate's callback to ChannelSend::SendRtpAudio.
- if (frame_transformer_delegate_)
- frame_transformer_delegate_->Reset();
+ // Reset and clear the frame_transformer_delegate_ on the encoder queue
+ // to avoid race conditions.
+ Event delegate_reset_event;
+ encoder_queue_->PostTask([this, &delegate_reset_event] {
+ RTC_DCHECK_RUN_ON(&encoder_queue_checker_);
+ if (frame_transformer_delegate_) {
+ frame_transformer_delegate_->Reset();
+ frame_transformer_delegate_ = nullptr;
+ }
+ delegate_reset_event.Set();
+ });
+ delegate_reset_event.Wait(Event::kForever);
StopSend();
int error = audio_coding_->RegisterTransportCallback(nullptr);
diff --git a/third_party/libwebrtc/moz-patch-stack/s0029.patch b/third_party/libwebrtc/moz-patch-stack/s0029.patch
@@ -27,7 +27,7 @@ index fc923a8733..11b6ac6e08 100644
stats.header_and_padding_bytes_sent =
channel_stats.header_and_padding_bytes_sent;
diff --git a/audio/channel_send.cc b/audio/channel_send.cc
-index 791c597d19..1105ab5ca4 100644
+index fbda6e852e..7536645e4e 100644
--- a/audio/channel_send.cc
+++ b/audio/channel_send.cc
@@ -81,6 +81,32 @@ constexpr TimeDelta kMinRetransmissionWindow = TimeDelta::Millis(30);
@@ -89,7 +89,7 @@ index 791c597d19..1105ab5ca4 100644
if (env_.field_trials().IsDisabled("WebRTC-DisableRtxRateLimiter")) {
configuration.retransmission_rate_limiter =
retransmission_rate_limiter_.get();
-@@ -795,6 +826,7 @@ ChannelSendStatistics ChannelSend::GetRTCPStatistics() const {
+@@ -804,6 +835,7 @@ ChannelSendStatistics ChannelSend::GetRTCPStatistics() const {
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
ChannelSendStatistics stats = {
.round_trip_time = rtp_rtcp_->LastRtt().value_or(TimeDelta::Zero())};
diff --git a/third_party/libwebrtc/moz-patch-stack/s0070.patch b/third_party/libwebrtc/moz-patch-stack/s0070.patch
@@ -12,7 +12,7 @@ Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/6ac6592a04a839a61
1 file changed, 2 deletions(-)
diff --git a/audio/channel_send.cc b/audio/channel_send.cc
-index 1105ab5ca4..43c31b5d15 100644
+index 7536645e4e..b90b4b2867 100644
--- a/audio/channel_send.cc
+++ b/audio/channel_send.cc
@@ -572,8 +572,6 @@ ChannelSend::ChannelSend(