From db821652f6f39346101fc016b03c52e0a2776b00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Tue, 2 Feb 2021 15:14:50 +0100 Subject: [PATCH] Add missing compile-time thread annotations for BaseChannel methods. Bug: chromium:1172815 Change-Id: I6aa3e1b11fe23eeda2476bfaabaab15afd0d2715 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/205320 Reviewed-by: Taylor Commit-Queue: Niels Moller Cr-Commit-Position: refs/heads/master@{#33166} --- pc/channel.cc | 8 ++------ pc/channel.h | 18 +++++++++--------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/pc/channel.cc b/pc/channel.cc index 16e226384a..7a3c2bbb6d 100644 --- a/pc/channel.cc +++ b/pc/channel.cc @@ -173,7 +173,6 @@ std::string BaseChannel::ToString() const { } bool BaseChannel::ConnectToRtpTransport() { - RTC_DCHECK_RUN_ON(network_thread()); RTC_DCHECK(rtp_transport_); if (!RegisterRtpDemuxerSink_n()) { RTC_LOG(LS_ERROR) << "Failed to set up demuxing for " << ToString(); @@ -191,7 +190,6 @@ bool BaseChannel::ConnectToRtpTransport() { } void BaseChannel::DisconnectFromRtpTransport() { - RTC_DCHECK_RUN_ON(network_thread()); RTC_DCHECK(rtp_transport_); rtp_transport_->UnregisterRtpDemuxerSink(this); rtp_transport_->SignalReadyToSend.disconnect(this); @@ -286,6 +284,7 @@ bool BaseChannel::SetLocalContent(const MediaContentDescription* content, std::string* error_desc) { TRACE_EVENT0("webrtc", "BaseChannel::SetLocalContent"); return InvokeOnWorker(RTC_FROM_HERE, [this, content, type, error_desc] { + RTC_DCHECK_RUN_ON(worker_thread()); return SetLocalContent_w(content, type, error_desc); }); } @@ -295,6 +294,7 @@ bool BaseChannel::SetRemoteContent(const MediaContentDescription* content, std::string* error_desc) { TRACE_EVENT0("webrtc", "BaseChannel::SetRemoteContent"); return InvokeOnWorker(RTC_FROM_HERE, [this, content, type, error_desc] { + RTC_DCHECK_RUN_ON(worker_thread()); return SetRemoteContent_w(content, type, error_desc); }); } @@ -535,7 +535,6 @@ bool BaseChannel::RegisterRtpDemuxerSink_n() { } void BaseChannel::EnableMedia_w() { - RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); if (enabled_) return; @@ -545,7 +544,6 @@ void BaseChannel::EnableMedia_w() { } void BaseChannel::DisableMedia_w() { - RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); if (!enabled_) return; @@ -599,7 +597,6 @@ bool BaseChannel::RemoveRecvStream_w(uint32_t ssrc) { } void BaseChannel::ResetUnsignaledRecvStream_w() { - RTC_DCHECK(worker_thread() == rtc::Thread::Current()); media_channel()->ResetUnsignaledRecvStream(); } @@ -850,7 +847,6 @@ void BaseChannel::SignalSentPacket_n(const rtc::SentPacket& sent_packet) { void BaseChannel::SetNegotiatedHeaderExtensions_w( const RtpHeaderExtensions& extensions) { TRACE_EVENT0("webrtc", __func__); - RTC_DCHECK_RUN_ON(worker_thread()); webrtc::MutexLock lock(&negotiated_header_extensions_lock_); negotiated_header_extensions_ = extensions; } diff --git a/pc/channel.h b/pc/channel.h index e795a10529..30fa6393d9 100644 --- a/pc/channel.h +++ b/pc/channel.h @@ -257,9 +257,6 @@ class BaseChannel : public ChannelInterface, void OnNetworkRouteChanged(absl::optional network_route); - bool PacketIsRtcp(const rtc::PacketTransportInternal* transport, - const char* data, - size_t len); bool SendPacket(bool rtcp, rtc::CopyOnWriteBuffer* packet, const rtc::PacketOptions& options); @@ -285,7 +282,7 @@ class BaseChannel : public ChannelInterface, // Should be called whenever the conditions for // IsReadyToReceiveMedia/IsReadyToSendMedia are satisfied (or unsatisfied). // Updates the send/recv state of the media channel. - virtual void UpdateMediaSendRecvState_w() = 0; + virtual void UpdateMediaSendRecvState_w() RTC_RUN_ON(worker_thread()) = 0; bool UpdateLocalStreams_w(const std::vector& streams, webrtc::SdpType type, @@ -297,10 +294,12 @@ class BaseChannel : public ChannelInterface, RTC_RUN_ON(worker_thread()); virtual bool SetLocalContent_w(const MediaContentDescription* content, webrtc::SdpType type, - std::string* error_desc) = 0; + std::string* error_desc) + RTC_RUN_ON(worker_thread()) = 0; virtual bool SetRemoteContent_w(const MediaContentDescription* content, webrtc::SdpType type, - std::string* error_desc) = 0; + std::string* error_desc) + RTC_RUN_ON(worker_thread()) = 0; // Return a list of RTP header extensions with the non-encrypted extensions // removed depending on the current crypto_options_ and only if both the // non-encrypted and encrypted extension is present for the same URI. @@ -332,14 +331,15 @@ class BaseChannel : public ChannelInterface, // Return description of media channel to facilitate logging std::string ToString() const; - void SetNegotiatedHeaderExtensions_w(const RtpHeaderExtensions& extensions); + void SetNegotiatedHeaderExtensions_w(const RtpHeaderExtensions& extensions) + RTC_RUN_ON(worker_thread()); // ChannelInterface overrides RtpHeaderExtensions GetNegotiatedRtpHeaderExtensions() const override; private: - bool ConnectToRtpTransport(); - void DisconnectFromRtpTransport(); + bool ConnectToRtpTransport() RTC_RUN_ON(network_thread()); + void DisconnectFromRtpTransport() RTC_RUN_ON(network_thread()); void SignalSentPacket_n(const rtc::SentPacket& sent_packet) RTC_RUN_ON(network_thread());