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:
committed by
Commit Bot
parent
43d0b98fe5
commit
7a29426142
@ -119,6 +119,8 @@ class AndroidAudioDeviceModule : public AudioDeviceModule {
|
|||||||
int32_t err = input_->Terminate();
|
int32_t err = input_->Terminate();
|
||||||
err |= output_->Terminate();
|
err |= output_->Terminate();
|
||||||
initialized_ = false;
|
initialized_ = false;
|
||||||
|
thread_checker_.DetachFromThread();
|
||||||
|
audio_device_buffer_.reset(nullptr);
|
||||||
RTC_DCHECK_EQ(err, 0);
|
RTC_DCHECK_EQ(err, 0);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -95,6 +95,7 @@ int32_t AudioRecordJni::Terminate() {
|
|||||||
RTC_LOG(INFO) << "Terminate";
|
RTC_LOG(INFO) << "Terminate";
|
||||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||||
StopRecording();
|
StopRecording();
|
||||||
|
thread_checker_.DetachFromThread();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -69,6 +69,7 @@ int32_t AudioTrackJni::Terminate() {
|
|||||||
RTC_LOG(INFO) << "Terminate";
|
RTC_LOG(INFO) << "Terminate";
|
||||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||||
StopPlayout();
|
StopPlayout();
|
||||||
|
thread_checker_.DetachFromThread();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user