OLD | NEW |
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_input.h" | 5 #include "media/base/audio_renderer_mixer_input.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "media/base/audio_renderer_mixer.h" | 9 #include "media/base/audio_renderer_mixer.h" |
10 | 10 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 OutputDeviceStatus AudioRendererMixerInput::GetDeviceStatus() { | 159 OutputDeviceStatus AudioRendererMixerInput::GetDeviceStatus() { |
160 if (!mixer_) | 160 if (!mixer_) |
161 return OUTPUT_DEVICE_STATUS_ERROR_INTERNAL; | 161 return OUTPUT_DEVICE_STATUS_ERROR_INTERNAL; |
162 | 162 |
163 return mixer_->GetOutputDevice()->GetDeviceStatus(); | 163 return mixer_->GetOutputDevice()->GetDeviceStatus(); |
164 } | 164 } |
165 | 165 |
166 double AudioRendererMixerInput::ProvideInput(AudioBus* audio_bus, | 166 double AudioRendererMixerInput::ProvideInput(AudioBus* audio_bus, |
167 base::TimeDelta buffer_delay) { | 167 base::TimeDelta buffer_delay) { |
168 int frames_filled = callback_->Render( | 168 int frames_filled = callback_->Render( |
169 audio_bus, static_cast<int>(buffer_delay.InMillisecondsF() + 0.5)); | 169 audio_bus, static_cast<int>(buffer_delay.InMillisecondsF() + 0.5), 0); |
170 | 170 |
171 // AudioConverter expects unfilled frames to be zeroed. | 171 // AudioConverter expects unfilled frames to be zeroed. |
172 if (frames_filled < audio_bus->frames()) { | 172 if (frames_filled < audio_bus->frames()) { |
173 audio_bus->ZeroFramesPartial( | 173 audio_bus->ZeroFramesPartial( |
174 frames_filled, audio_bus->frames() - frames_filled); | 174 frames_filled, audio_bus->frames() - frames_filled); |
175 } | 175 } |
176 | 176 |
177 return frames_filled > 0 ? volume_ : 0; | 177 return frames_filled > 0 ? volume_ : 0; |
178 } | 178 } |
179 | 179 |
180 void AudioRendererMixerInput::OnRenderError() { | 180 void AudioRendererMixerInput::OnRenderError() { |
181 callback_->OnRenderError(); | 181 callback_->OnRenderError(); |
182 } | 182 } |
183 | 183 |
184 } // namespace media | 184 } // namespace media |
OLD | NEW |