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

Unified Diff: media/base/audio_renderer_mixer.cc

Issue 1703473002: Make AudioOutputDevice restartable and reinitializable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@new_mixing
Patch Set: Created 4 years, 10 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
« media/audio/audio_device_thread.cc ('K') | « media/audio/audio_output_device.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/audio_renderer_mixer.cc
diff --git a/media/base/audio_renderer_mixer.cc b/media/base/audio_renderer_mixer.cc
index 3df825084a16ccd570dde3607ecf8c6166a7831b..b32124c69ce69d6d61b79954603fb9e5a2b13a77 100644
--- a/media/base/audio_renderer_mixer.cc
+++ b/media/base/audio_renderer_mixer.cc
@@ -191,6 +191,7 @@ AudioRendererMixer::AudioRendererMixer(
last_play_time_(base::TimeTicks::Now()),
// Initialize |playing_| to true since Start() results in an auto-play.
playing_(true) {
+ printf("################ Creating new mixer.\n");
DVLOG(1) << "AudioRendererMixer::AudioRendererMixer(),\n"
<< output_params_.AsHumanReadableString() << "mixer: " << this;
// TODO(olka) we probably want to (a) start with a null sink and create a new
@@ -238,6 +239,29 @@ void AudioRendererMixer::ReconfigureSinkIfNeeded() {
return;
}
+#if 1
+ {
+// base::AutoLock auto_lock(lock_);
+ if (audio_sink_) {
+ printf("################ Restarting sink for mixer.\n");
+ // Initialize |playing_| to true since Start() results in an auto-play.
+ last_play_time_ = base::TimeTicks::Now();
+ output_params_ = new_output_params;
+ audio_sink_->Stop();
+ audio_sink_->Initialize(output_params_, this);
+ audio_sink_->Start();
+ if (playing_)
+ audio_sink_->Play();
+ DVLOG(1) << "Sink reinitialized";
+ return;
+ }
+ }
+#endif
+
+ NOTREACHED();
+
+ printf("################ Creating new sink for mixer.\n");
+
// To minimize possible glitches during the sink switch, first we initialize
// the new sink, and after that we stop the current one. This may be a problem
// on Mac since audio output won't switch to a larger buffer when there is IO
« media/audio/audio_device_thread.cc ('K') | « media/audio/audio_output_device.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698