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

Side by Side Diff: media/base/audio_renderer_mixer.cc

Issue 14234023: Remove unused flush operation from Chromium audio. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/base/audio_renderer_mixer.h" 5 #include "media/base/audio_renderer_mixer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 int audio_delay_milliseconds) { 59 int audio_delay_milliseconds) {
60 base::AutoLock auto_lock(mixer_inputs_lock_); 60 base::AutoLock auto_lock(mixer_inputs_lock_);
61 61
62 // If there are no mixer inputs and we haven't seen one for a while, pause the 62 // If there are no mixer inputs and we haven't seen one for a while, pause the
63 // sink to avoid wasting resources when media elements are present but remain 63 // sink to avoid wasting resources when media elements are present but remain
64 // in the pause state. 64 // in the pause state.
65 base::Time now = base::Time::Now(); 65 base::Time now = base::Time::Now();
66 if (!mixer_inputs_.empty()) { 66 if (!mixer_inputs_.empty()) {
67 last_play_time_ = now; 67 last_play_time_ = now;
68 } else if (now - last_play_time_ >= pause_delay_ && playing_) { 68 } else if (now - last_play_time_ >= pause_delay_ && playing_) {
69 audio_sink_->Pause(false); 69 audio_sink_->Pause();
70 playing_ = false; 70 playing_ = false;
71 } 71 }
72 72
73 // Set the delay information for each mixer input. 73 // Set the delay information for each mixer input.
74 for (AudioRendererMixerInputSet::iterator it = mixer_inputs_.begin(); 74 for (AudioRendererMixerInputSet::iterator it = mixer_inputs_.begin();
75 it != mixer_inputs_.end(); ++it) { 75 it != mixer_inputs_.end(); ++it) {
76 (*it)->set_audio_delay_milliseconds(audio_delay_milliseconds); 76 (*it)->set_audio_delay_milliseconds(audio_delay_milliseconds);
77 } 77 }
78 78
79 audio_converter_.Convert(audio_bus); 79 audio_converter_.Convert(audio_bus);
80 return audio_bus->frames(); 80 return audio_bus->frames();
81 } 81 }
82 82
83 void AudioRendererMixer::OnRenderError() { 83 void AudioRendererMixer::OnRenderError() {
84 base::AutoLock auto_lock(mixer_inputs_lock_); 84 base::AutoLock auto_lock(mixer_inputs_lock_);
85 85
86 // Call each mixer input and signal an error. 86 // Call each mixer input and signal an error.
87 for (AudioRendererMixerInputSet::iterator it = mixer_inputs_.begin(); 87 for (AudioRendererMixerInputSet::iterator it = mixer_inputs_.begin();
88 it != mixer_inputs_.end(); ++it) { 88 it != mixer_inputs_.end(); ++it) {
89 (*it)->OnRenderError(); 89 (*it)->OnRenderError();
90 } 90 }
91 } 91 }
92 92
93 } // namespace media 93 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698