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 <deadbeef@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33166}
This commit is contained in:
Niels Möller
2021-02-02 15:14:50 +01:00
committed by Commit Bot
parent c5d4810fbe
commit db821652f6
2 changed files with 11 additions and 15 deletions

View File

@ -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<bool>(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<bool>(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;
}

View File

@ -257,9 +257,6 @@ class BaseChannel : public ChannelInterface,
void OnNetworkRouteChanged(absl::optional<rtc::NetworkRoute> 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<StreamParams>& 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());