diff --git a/pc/channel.cc b/pc/channel.cc index 745a380051..032c7356f4 100644 --- a/pc/channel.cc +++ b/pc/channel.cc @@ -488,11 +488,6 @@ void BaseChannel::UpdateRtpHeaderExtensionMap( } bool BaseChannel::RegisterRtpDemuxerSink_w() { - // TODO(bugs.webrtc.org/11993): `previous_demuxer_criteria_` should only be - // accessed on the network thread. - if (demuxer_criteria_ == previous_demuxer_criteria_) { - return true; - } media_channel_->OnDemuxerCriteriaUpdatePending(); // Copy demuxer criteria, since they're a worker-thread variable // and we want to pass them to the network thread @@ -500,6 +495,9 @@ bool BaseChannel::RegisterRtpDemuxerSink_w() { RTC_FROM_HERE, [this, demuxer_criteria = demuxer_criteria_] { RTC_DCHECK_RUN_ON(network_thread()); RTC_DCHECK(rtp_transport_); + if (demuxer_criteria_ == previous_demuxer_criteria_) + return true; + bool result = rtp_transport_->RegisterRtpDemuxerSink(demuxer_criteria, this); if (result) { diff --git a/pc/channel.h b/pc/channel.h index fa4a26e96f..7f7cfb9b8e 100644 --- a/pc/channel.h +++ b/pc/channel.h @@ -357,7 +357,8 @@ class BaseChannel : public ChannelInterface, webrtc::RtpDemuxerCriteria demuxer_criteria_; // Accessed on the worker thread, modified on the network thread from // RegisterRtpDemuxerSink_w's Invoke. - webrtc::RtpDemuxerCriteria previous_demuxer_criteria_; + webrtc::RtpDemuxerCriteria previous_demuxer_criteria_ + RTC_GUARDED_BY(network_thread()); // This generator is used to generate SSRCs for local streams. // This is needed in cases where SSRCs are not negotiated or set explicitly // like in Simulcast.