Fix a bug where TestAudioDeviceModule crashes if destroyed uninitialized.

Because thread_ object is created in Init, destructor used to crash when
calling thread_->Stop() because it was referencing a null pointer.

Bug: webrtc:9404
Change-Id: I1c943d0fa50f9341aaa516b32495bb25bf4d664b
Reviewed-on: https://webrtc-review.googlesource.com/84122
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Commit-Queue: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23682}
This commit is contained in:
Sami Kalliomäki 2018-06-19 10:53:57 +02:00 committed by Commit Bot
parent aaa483bff6
commit a97c931cba

View File

@ -81,8 +81,10 @@ class TestAudioDeviceModuleImpl
~TestAudioDeviceModuleImpl() {
StopPlayout();
StopRecording();
if (thread_) {
thread_->Stop();
}
}
int32_t Init() {
RTC_CHECK(tick_->StartTimer(true, kFrameLengthMs / speed_));