mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-29 13:26:33 +01:00
Remove assoc_send_channel_lock_ from ChannelReceive.
Associating a send channel is done on the same thread as network packets are routed, which (currently) is also where stats are reported from, so we can get rid of the lock and just make sure that the class is used correctly. Moving forward, this thread will become the network thread, so we'll need to take a closer look at options for delivering the stats without adding contention. Bug: webrtc:11993 Change-Id: Ia87e67e8ae90b1651ef4a69243cf05093a620ed4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/212612 Commit-Queue: Tommi <tommi@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33618}
This commit is contained in:
parent
2efb8a5ec6
commit
209e294fab
1 changed files with 5 additions and 8 deletions
|
@ -265,10 +265,8 @@ class ChannelReceive : public ChannelReceiveInterface {
|
|||
AudioDeviceModule* _audioDeviceModulePtr;
|
||||
float _outputGain RTC_GUARDED_BY(volume_settings_mutex_);
|
||||
|
||||
// An associated send channel.
|
||||
mutable Mutex assoc_send_channel_lock_;
|
||||
const ChannelSendInterface* associated_send_channel_
|
||||
RTC_GUARDED_BY(assoc_send_channel_lock_);
|
||||
RTC_GUARDED_BY(worker_thread_checker_);
|
||||
|
||||
PacketRouter* packet_router_ = nullptr;
|
||||
|
||||
|
@ -590,8 +588,8 @@ void ChannelReceive::SetReceiveCodecs(
|
|||
acm_receiver_.SetCodecs(codecs);
|
||||
}
|
||||
|
||||
// May be called on either worker thread or network thread.
|
||||
void ChannelReceive::OnRtpPacket(const RtpPacketReceived& packet) {
|
||||
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
|
||||
// TODO(bugs.webrtc.org/11993): Expect to be called exclusively on the
|
||||
// network thread. Once that's done, the same applies to
|
||||
// UpdatePlayoutTimestamp and
|
||||
|
@ -681,8 +679,8 @@ void ChannelReceive::ReceivePacket(const uint8_t* packet,
|
|||
}
|
||||
}
|
||||
|
||||
// May be called on either worker thread or network thread.
|
||||
void ChannelReceive::ReceivedRTCPPacket(const uint8_t* data, size_t length) {
|
||||
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
|
||||
// TODO(bugs.webrtc.org/11993): Expect to be called exclusively on the
|
||||
// network thread.
|
||||
|
||||
|
@ -842,7 +840,6 @@ void ChannelReceive::SetAssociatedSendChannel(
|
|||
const ChannelSendInterface* channel) {
|
||||
// TODO(bugs.webrtc.org/11993): Expect to be called on the network thread.
|
||||
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
|
||||
MutexLock lock(&assoc_send_channel_lock_);
|
||||
associated_send_channel_ = channel;
|
||||
}
|
||||
|
||||
|
@ -1023,12 +1020,12 @@ int ChannelReceive::GetRtpTimestampRateHz() const {
|
|||
}
|
||||
|
||||
int64_t ChannelReceive::GetRTT() const {
|
||||
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
|
||||
std::vector<ReportBlockData> report_blocks =
|
||||
rtp_rtcp_->GetLatestReportBlockData();
|
||||
|
||||
if (report_blocks.empty()) {
|
||||
MutexLock lock(&assoc_send_channel_lock_);
|
||||
// Tries to get RTT from an associated channel.
|
||||
// Try fall back on an RTT from an associated channel.
|
||||
if (!associated_send_channel_) {
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue