Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Unified Diff: media/audio/audio_output_device.cc

Issue 12102004: Renderer side audio device change wip... Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/audio/audio_output_controller.cc ('k') | media/audio/audio_output_ipc.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_output_device.cc
diff --git a/media/audio/audio_output_device.cc b/media/audio/audio_output_device.cc
index cf4ebffe7254f481cca349301b6ab59e6b881992..837c240ee9c8438b9677036b36fa753d4fa12a34 100644
--- a/media/audio/audio_output_device.cc
+++ b/media/audio/audio_output_device.cc
@@ -73,6 +73,7 @@ void AudioOutputDevice::InitializeIO(const AudioParameters& params,
AudioOutputDevice::~AudioOutputDevice() {
// The current design requires that the user calls Stop() before deleting
// this class.
+ LOG(ERROR) << "AudioOutputDevice::~@" << this;
DCHECK(audio_thread_.IsStopped());
if (ipc_)
@@ -186,8 +187,13 @@ void AudioOutputDevice::SetVolumeOnIOThread(double volume) {
void AudioOutputDevice::OnStateChanged(AudioOutputIPCDelegate::State state) {
DCHECK(message_loop()->BelongsToCurrentThread());
- // Do nothing if the stream has been closed.
- if (state_ < CREATING_STREAM)
+ // Do nothing if the stream has been closed. Don't dereference the callback
+ // object if the audio thread is stopped or stopping. That could mean that
+ // the callback object has been deleted.
+ // TODO(tommi): Add an explicit contract for clearing the callback object.
+ // Possibly require calling Initialize again or provide a callback object via
+ // Start() and clear it in Stop().
+ if (state_ < CREATING_STREAM || audio_thread_.IsStopped())
return;
if (state == AudioOutputIPCDelegate::kError) {
@@ -198,8 +204,11 @@ void AudioOutputDevice::OnStateChanged(AudioOutputIPCDelegate::State state) {
// TODO(tommi): Add an explicit contract for clearing the callback
// object. Possibly require calling Initialize again or provide
// a callback object via Start() and clear it in Stop().
- if (!audio_thread_.IsStopped())
- callback_->OnRenderError();
+ // if (!audio_thread_.IsStopped())
+ // callback_->OnRenderError();
+ } else if (state == AudioOutputIPCDelegate::kDeviceChange) {
+ LOG(ERROR) << "AudioOutputDevice::kDeviceChange@" << this;
+ callback_->OnDeviceChange();
}
}
« no previous file with comments | « media/audio/audio_output_controller.cc ('k') | media/audio/audio_output_ipc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698