From 3907e7b160d2ac0cff55adda86ef8f5c253bd997 Mon Sep 17 00:00:00 2001 From: Markus Handell Date: Tue, 1 Jun 2021 09:07:20 +0200 Subject: [PATCH] AudioSendStream: s/worker_queue_/rtp_transport_queue_/g The 'worker' noun in WebRTC is tied to the worker thread. Hence naming an unrelated queue to something with worker confuses code reading. Change this to something which can't reasonably be confused with the worker thread. Bug: webrtc:11993 Change-Id: Icdcc728cf3dd9eb020f922367eebd0c520814568 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/220934 Reviewed-by: Henrik Andreassson Commit-Queue: Markus Handell Cr-Commit-Position: refs/heads/master@{#34183} --- audio/audio_send_stream.cc | 23 ++++++++++++----------- audio/audio_send_stream.h | 8 ++++---- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/audio/audio_send_stream.cc b/audio/audio_send_stream.cc index b769569fd5..aca7cd38b8 100644 --- a/audio/audio_send_stream.cc +++ b/audio/audio_send_stream.cc @@ -142,7 +142,7 @@ AudioSendStream::AudioSendStream( const absl::optional& suspended_rtp_state, std::unique_ptr channel_send) : clock_(clock), - worker_queue_(rtp_transport->GetWorkerQueue()), + rtp_transport_queue_(rtp_transport->GetWorkerQueue()), allocate_audio_without_feedback_( field_trial::IsEnabled("WebRTC-Audio-ABWENoTWCC")), enable_audio_alr_probing_( @@ -160,7 +160,7 @@ AudioSendStream::AudioSendStream( rtp_rtcp_module_(channel_send_->GetRtpRtcp()), suspended_rtp_state_(suspended_rtp_state) { RTC_LOG(LS_INFO) << "AudioSendStream: " << config.rtp.ssrc; - RTC_DCHECK(worker_queue_); + RTC_DCHECK(rtp_transport_queue_); RTC_DCHECK(audio_state_); RTC_DCHECK(channel_send_); RTC_DCHECK(bitrate_allocator_); @@ -182,7 +182,7 @@ AudioSendStream::~AudioSendStream() { // Blocking call to synchronize state with worker queue to ensure that there // are no pending tasks left that keeps references to audio. rtc::Event thread_sync_event; - worker_queue_->PostTask([&] { thread_sync_event.Set(); }); + rtp_transport_queue_->PostTask([&] { thread_sync_event.Set(); }); thread_sync_event.Wait(rtc::Event::kForever); } @@ -517,7 +517,7 @@ void AudioSendStream::DeliverRtcp(const uint8_t* packet, size_t length) { } uint32_t AudioSendStream::OnBitrateUpdated(BitrateAllocationUpdate update) { - RTC_DCHECK_RUN_ON(worker_queue_); + RTC_DCHECK_RUN_ON(rtp_transport_queue_); // Pick a target bitrate between the constraints. Overrules the allocator if // it 1) allocated a bitrate of zero to disable the stream or 2) allocated a @@ -855,9 +855,10 @@ void AudioSendStream::ConfigureBitrateObserver() { if (allocation_settings_.priority_bitrate_raw) priority_bitrate = *allocation_settings_.priority_bitrate_raw; - worker_queue_->PostTask([this, constraints, priority_bitrate, - config_bitrate_priority = config_.bitrate_priority] { - RTC_DCHECK_RUN_ON(worker_queue_); + rtp_transport_queue_->PostTask([this, constraints, priority_bitrate, + config_bitrate_priority = + config_.bitrate_priority] { + RTC_DCHECK_RUN_ON(rtp_transport_queue_); bitrate_allocator_->AddObserver( this, MediaStreamAllocationConfig{ @@ -872,8 +873,8 @@ void AudioSendStream::ConfigureBitrateObserver() { void AudioSendStream::RemoveBitrateObserver() { registered_with_allocator_ = false; rtc::Event thread_sync_event; - worker_queue_->PostTask([this, &thread_sync_event] { - RTC_DCHECK_RUN_ON(worker_queue_); + rtp_transport_queue_->PostTask([this, &thread_sync_event] { + RTC_DCHECK_RUN_ON(rtp_transport_queue_); bitrate_allocator_->RemoveObserver(this); thread_sync_event.Set(); }); @@ -940,8 +941,8 @@ void AudioSendStream::UpdateCachedTargetAudioBitrateConstraints() { if (!new_constraints.has_value()) { return; } - worker_queue_->PostTask([this, new_constraints]() { - RTC_DCHECK_RUN_ON(worker_queue_); + rtp_transport_queue_->PostTask([this, new_constraints]() { + RTC_DCHECK_RUN_ON(rtp_transport_queue_); cached_constraints_ = new_constraints; }); } diff --git a/audio/audio_send_stream.h b/audio/audio_send_stream.h index 25346ae373..223328b26b 100644 --- a/audio/audio_send_stream.h +++ b/audio/audio_send_stream.h @@ -165,7 +165,7 @@ class AudioSendStream final : public webrtc::AudioSendStream, SequenceChecker worker_thread_checker_; SequenceChecker pacer_thread_checker_; rtc::RaceChecker audio_capture_race_checker_; - rtc::TaskQueue* worker_queue_; + rtc::TaskQueue* rtp_transport_queue_; const bool allocate_audio_without_feedback_; const bool force_no_audio_feedback_ = allocate_audio_without_feedback_; @@ -189,10 +189,10 @@ class AudioSendStream final : public webrtc::AudioSendStream, webrtc::voe::AudioLevel audio_level_ RTC_GUARDED_BY(audio_level_lock_); BitrateAllocatorInterface* const bitrate_allocator_ - RTC_GUARDED_BY(worker_queue_); - // Constrains cached to be accessed from |worker_queue_|. + RTC_GUARDED_BY(rtp_transport_queue_); + // Constrains cached to be accessed from |rtp_transport_queue_|. absl::optional - cached_constraints_ RTC_GUARDED_BY(worker_queue_) = absl::nullopt; + cached_constraints_ RTC_GUARDED_BY(rtp_transport_queue_) = absl::nullopt; RtpTransportControllerSendInterface* const rtp_transport_; RtpRtcpInterface* const rtp_rtcp_module_;