Detach audio devices from thread on terminate.

To allow the AudioDeviceModule to be reinitialized on a different thread
after termination, detach AudioDeviceModule and the input/output devices
when Terminate is called. Also destroy the AudioDeviceBuffer.

Bug: webrtc:7452
Change-Id: I50ef77c531f33d4efa0567d0475dd8280337bed9
Reviewed-on: https://webrtc-review.googlesource.com/86127
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Paulina Hensman <phensman@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23784}
This commit is contained in:
Paulina Hensman
2018-06-28 15:12:05 +02:00
committed by Commit Bot
parent 43d0b98fe5
commit 7a29426142
3 changed files with 4 additions and 0 deletions

View File

@ -119,6 +119,8 @@ class AndroidAudioDeviceModule : public AudioDeviceModule {
int32_t err = input_->Terminate();
err |= output_->Terminate();
initialized_ = false;
thread_checker_.DetachFromThread();
audio_device_buffer_.reset(nullptr);
RTC_DCHECK_EQ(err, 0);
return err;
}

View File

@ -95,6 +95,7 @@ int32_t AudioRecordJni::Terminate() {
RTC_LOG(INFO) << "Terminate";
RTC_DCHECK(thread_checker_.CalledOnValidThread());
StopRecording();
thread_checker_.DetachFromThread();
return 0;
}

View File

@ -69,6 +69,7 @@ int32_t AudioTrackJni::Terminate() {
RTC_LOG(INFO) << "Terminate";
RTC_DCHECK(thread_checker_.CalledOnValidThread());
StopPlayout();
thread_checker_.DetachFromThread();
return 0;
}