| Index: media/audio/audio_output_device.cc
|
| diff --git a/media/audio/audio_output_device.cc b/media/audio/audio_output_device.cc
|
| index 12d102c4ad196911c9ddfb7430e60da7ca99093b..e618b3b5242f41ee4838137099788cf36ec1ad4c 100644
|
| --- a/media/audio/audio_output_device.cc
|
| +++ b/media/audio/audio_output_device.cc
|
| @@ -41,6 +41,10 @@ class AudioOutputDevice::AudioThreadCallback
|
| // Called whenever we receive notifications about pending data.
|
| void Process(uint32_t pending_data) override;
|
|
|
| + // Returns whether the current thread is the audio device thread or not.
|
| + // Will always return true if DCHECKs are not enabled.
|
| + bool CurrentThreadIsAudioDeviceThread();
|
| +
|
| private:
|
| AudioRendererSink::RenderCallback* render_callback_;
|
| std::unique_ptr<AudioBus> output_bus_;
|
| @@ -154,6 +158,13 @@ OutputDeviceInfo AudioOutputDevice::GetOutputDeviceInfo() {
|
| device_status_, output_params_);
|
| }
|
|
|
| +bool AudioOutputDevice::CurrentThreadIsRenderingThread() {
|
| + // Since this function is supposed to be called on the rendering thread,
|
| + // it's safe to access |audio_callback_| here. It will always be valid when
|
| + // the rendering thread is running.
|
| + return audio_callback_->CurrentThreadIsAudioDeviceThread();
|
| +}
|
| +
|
| void AudioOutputDevice::RequestDeviceAuthorizationOnIOThread() {
|
| DCHECK(task_runner()->BelongsToCurrentThread());
|
| DCHECK_EQ(state_, IDLE);
|
| @@ -477,4 +488,9 @@ void AudioOutputDevice::AudioThreadCallback::Process(uint32_t pending_data) {
|
| frames_skipped);
|
| }
|
|
|
| +bool AudioOutputDevice::AudioThreadCallback::
|
| + CurrentThreadIsAudioDeviceThread() {
|
| + return thread_checker_.CalledOnValidThread();
|
| +}
|
| +
|
| } // namespace media
|
|
|