diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /third_party/libwebrtc/audio/voip/audio_egress.cc | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/audio/voip/audio_egress.cc')
-rw-r--r-- | third_party/libwebrtc/audio/voip/audio_egress.cc | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/third_party/libwebrtc/audio/voip/audio_egress.cc b/third_party/libwebrtc/audio/voip/audio_egress.cc index 95a1a3351e..09396cd28d 100644 --- a/third_party/libwebrtc/audio/voip/audio_egress.cc +++ b/third_party/libwebrtc/audio/voip/audio_egress.cc @@ -13,6 +13,7 @@ #include <utility> #include <vector> +#include "api/sequence_checker.h" #include "rtc_base/logging.h" namespace webrtc { @@ -25,12 +26,17 @@ AudioEgress::AudioEgress(RtpRtcpInterface* rtp_rtcp, audio_coding_(AudioCodingModule::Create()), encoder_queue_(task_queue_factory->CreateTaskQueue( "AudioEncoder", - TaskQueueFactory::Priority::NORMAL)) { + TaskQueueFactory::Priority::NORMAL)), + encoder_queue_checker_(encoder_queue_.get()) { audio_coding_->RegisterTransportCallback(this); } AudioEgress::~AudioEgress() { audio_coding_->RegisterTransportCallback(nullptr); + + // Delete first to ensure that there are no running tasks when the other + // members are destroyed. + encoder_queue_ = nullptr; } bool AudioEgress::IsSending() const { @@ -73,9 +79,9 @@ void AudioEgress::SendAudioData(std::unique_ptr<AudioFrame> audio_frame) { RTC_DCHECK_GT(audio_frame->samples_per_channel_, 0); RTC_DCHECK_LE(audio_frame->num_channels_, 8); - encoder_queue_.PostTask( + encoder_queue_->PostTask( [this, audio_frame = std::move(audio_frame)]() mutable { - RTC_DCHECK_RUN_ON(&encoder_queue_); + RTC_DCHECK_RUN_ON(&encoder_queue_checker_); if (!rtp_rtcp_->SendingMedia()) { return; } @@ -112,7 +118,7 @@ int32_t AudioEgress::SendData(AudioFrameType frame_type, uint32_t timestamp, const uint8_t* payload_data, size_t payload_size) { - RTC_DCHECK_RUN_ON(&encoder_queue_); + RTC_DCHECK_RUN_ON(&encoder_queue_checker_); rtc::ArrayView<const uint8_t> payload(payload_data, payload_size); @@ -175,8 +181,8 @@ bool AudioEgress::SendTelephoneEvent(int dtmf_event, int duration_ms) { } void AudioEgress::SetMute(bool mute) { - encoder_queue_.PostTask([this, mute] { - RTC_DCHECK_RUN_ON(&encoder_queue_); + encoder_queue_->PostTask([this, mute] { + RTC_DCHECK_RUN_ON(&encoder_queue_checker_); encoder_context_.mute_ = mute; }); } |