tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 4e7b688fbed26ad55ab72311434b38bd07f69f62
parent b50e673ee54c95379e0ccf3a5c42f2f473766141
Author: Dan Baker <dbaker@mozilla.com>
Date:   Mon,  1 Dec 2025 23:47:00 -0700

Bug 2000941 - Vendor libwebrtc from 70965bc749

Upstream commit: https://webrtc.googlesource.com/src/+/70965bc749dd4fce9a324eab438c6f637a24b7ea
    Make FakeAudioCaptureModule aware of the Init()/Terminate() methods.

    This is needed so that the Initialize() method can be checked from tests
    in between the Init() and Terminate() calls. Also checking for a call to
    Init() to have been done before creating the internal test thread and
    matching that by stopping processing and the thread from within
    Terminate().

    Bug: none
    Change-Id: Iaa25821a74afb6acba919df21c8750e8735f2623
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/411620
    Reviewed-by: Per Ã…hgren <peah@webrtc.org>
    Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org>
    Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#45719}

Diffstat:
Mthird_party/libwebrtc/README.mozilla.last-vendor | 4++--
Mthird_party/libwebrtc/pc/test/fake_audio_capture_module.cc | 22+++++++++++++++-------
Mthird_party/libwebrtc/pc/test/fake_audio_capture_module.h | 3+++
Mthird_party/libwebrtc/pc/test/fake_audio_capture_module_unittest.cc | 7+++++++
4 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/third_party/libwebrtc/README.mozilla.last-vendor b/third_party/libwebrtc/README.mozilla.last-vendor @@ -1,4 +1,4 @@ # ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc -libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-12-02T06:44:31.965986+00:00. +libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-12-02T06:46:46.911426+00:00. # base of lastest vendoring -df16623a4b +70965bc749 diff --git a/third_party/libwebrtc/pc/test/fake_audio_capture_module.cc b/third_party/libwebrtc/pc/test/fake_audio_capture_module.cc @@ -52,9 +52,7 @@ FakeAudioCaptureModule::FakeAudioCaptureModule() frames_received_(0) {} FakeAudioCaptureModule::~FakeAudioCaptureModule() { - if (process_thread_) { - process_thread_->Stop(); - } + RTC_DCHECK(!initialized_); } webrtc::scoped_refptr<FakeAudioCaptureModule> FakeAudioCaptureModule::Create() { @@ -84,18 +82,23 @@ int32_t FakeAudioCaptureModule::RegisterAudioCallback( } int32_t FakeAudioCaptureModule::Init() { - // Initialize is called by the factory method. Safe to ignore this Init call. + // Initialize is called by the factory method. + initialized_ = true; return 0; } int32_t FakeAudioCaptureModule::Terminate() { - // Clean up in the destructor. No action here, just success. + StopPlayout(); + StopRecording(); + if (process_thread_) { + process_thread_->Stop(); + } + initialized_ = false; return 0; } bool FakeAudioCaptureModule::Initialized() const { - RTC_DCHECK_NOTREACHED(); - return 0; + return initialized_; } int16_t FakeAudioCaptureModule::PlayoutDevices() { @@ -194,6 +197,8 @@ int32_t FakeAudioCaptureModule::StopPlayout() { bool start = false; { webrtc::MutexLock lock(&mutex_); + if (!playing_) + return 0; playing_ = false; start = ShouldStartProcessing(); } @@ -223,6 +228,8 @@ int32_t FakeAudioCaptureModule::StopRecording() { bool start = false; { webrtc::MutexLock lock(&mutex_); + if (!recording_) + return 0; recording_ = false; start = ShouldStartProcessing(); } @@ -424,6 +431,7 @@ bool FakeAudioCaptureModule::ShouldStartProcessing() { } void FakeAudioCaptureModule::UpdateProcessing(bool start) { + RTC_DCHECK(initialized_); if (start) { if (!process_thread_) { process_thread_ = webrtc::Thread::Create(); diff --git a/third_party/libwebrtc/pc/test/fake_audio_capture_module.h b/third_party/libwebrtc/pc/test/fake_audio_capture_module.h @@ -224,6 +224,9 @@ class FakeAudioCaptureModule : public webrtc::AudioDeviceModule { // (e.g. by a jitter buffer). int frames_received_; + // Set to true when Init() is called. + bool initialized_ = false; + // Protects variables that are accessed from process_thread_ and // the main thread. mutable webrtc::Mutex mutex_; diff --git a/third_party/libwebrtc/pc/test/fake_audio_capture_module_unittest.cc b/third_party/libwebrtc/pc/test/fake_audio_capture_module_unittest.cc @@ -35,7 +35,14 @@ class FakeAdmTest : public ::testing::Test, public webrtc::AudioTransport { void SetUp() override { fake_audio_capture_module_ = FakeAudioCaptureModule::Create(); + fake_audio_capture_module_->Init(); EXPECT_TRUE(fake_audio_capture_module_.get() != nullptr); + EXPECT_TRUE(fake_audio_capture_module_->Initialized()); + } + + void TearDown() override { + fake_audio_capture_module_->Terminate(); + EXPECT_FALSE(fake_audio_capture_module_->Initialized()); } // Callbacks inherited from webrtc::AudioTransport.