diff --git a/modules/audio_device/include/test_audio_device.cc b/modules/audio_device/include/test_audio_device.cc index 8ee21601f0..9d833b312f 100644 --- a/modules/audio_device/include/test_audio_device.cc +++ b/modules/audio_device/include/test_audio_device.cc @@ -61,10 +61,7 @@ class TestAudioDeviceModuleImpl capturing_(false), done_rendering_(true, true), done_capturing_(true, true), - tick_(EventTimerWrapper::Create()), - thread_(TestAudioDeviceModuleImpl::Run, - this, - "TestAudioDeviceModuleImpl") { + tick_(EventTimerWrapper::Create()) { auto good_sample_rate = [](int sr) { return sr == 8000 || sr == 16000 || sr == 32000 || sr == 44100 || sr == 48000; @@ -84,13 +81,15 @@ class TestAudioDeviceModuleImpl ~TestAudioDeviceModuleImpl() { StopPlayout(); StopRecording(); - thread_.Stop(); + thread_->Stop(); } int32_t Init() { RTC_CHECK(tick_->StartTimer(true, kFrameLengthMs / speed_)); - thread_.Start(); - thread_.SetPriority(rtc::kHighPriority); + thread_ = rtc::MakeUnique( + TestAudioDeviceModuleImpl::Run, this, "TestAudioDeviceModuleImpl"); + thread_->Start(); + thread_->SetPriority(rtc::kHighPriority); return 0; } @@ -212,7 +211,7 @@ class TestAudioDeviceModuleImpl rtc::BufferT recording_buffer_ RTC_GUARDED_BY(lock_); std::unique_ptr tick_; - rtc::PlatformThread thread_; + std::unique_ptr thread_; }; // A fake capturer that generates pulses with random samples between