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 "content/renderer/media/audio_renderer_impl.h" | 5 #include "content/renderer/media/audio_renderer_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 bool AudioRendererImpl::OnInitialize(int bits_per_channel, | 56 bool AudioRendererImpl::OnInitialize(int bits_per_channel, |
57 ChannelLayout channel_layout, | 57 ChannelLayout channel_layout, |
58 int sample_rate) { | 58 int sample_rate) { |
59 // We use the AUDIO_PCM_LINEAR flag because AUDIO_PCM_LOW_LATENCY | 59 // We use the AUDIO_PCM_LINEAR flag because AUDIO_PCM_LOW_LATENCY |
60 // does not currently support all the sample-rates that we require. | 60 // does not currently support all the sample-rates that we require. |
61 // Please see: http://code.google.com/p/chromium/issues/detail?id=103627 | 61 // Please see: http://code.google.com/p/chromium/issues/detail?id=103627 |
62 // for more details. | 62 // for more details. |
63 audio_parameters_.Reset( | 63 audio_parameters_.Reset( |
64 AudioParameters::AUDIO_PCM_LINEAR, | 64 AudioParameters::AUDIO_PCM_LINEAR, |
| 65 true, |
65 channel_layout, sample_rate, bits_per_channel, | 66 channel_layout, sample_rate, bits_per_channel, |
66 audio_hardware::GetHighLatencyOutputBufferSize(sample_rate)); | 67 audio_hardware::GetHighLatencyOutputBufferSize(sample_rate)); |
67 | 68 |
68 bytes_per_second_ = audio_parameters_.GetBytesPerSecond(); | 69 bytes_per_second_ = audio_parameters_.GetBytesPerSecond(); |
69 | 70 |
70 DCHECK(sink_.get()); | 71 DCHECK(sink_.get()); |
71 | 72 |
72 if (!is_initialized_) { | 73 if (!is_initialized_) { |
73 sink_->Initialize(audio_parameters_, this); | 74 sink_->Initialize(audio_parameters_, this); |
74 | 75 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 221 |
221 void AudioRendererImpl::OnRenderError() { | 222 void AudioRendererImpl::OnRenderError() { |
222 host()->DisableAudioRenderer(); | 223 host()->DisableAudioRenderer(); |
223 } | 224 } |
224 | 225 |
225 void AudioRendererImpl::OnRenderEndOfStream() { | 226 void AudioRendererImpl::OnRenderEndOfStream() { |
226 // TODO(enal): schedule callback instead of polling. | 227 // TODO(enal): schedule callback instead of polling. |
227 if (base::Time::Now() >= earliest_end_time_) | 228 if (base::Time::Now() >= earliest_end_time_) |
228 SignalEndOfStream(); | 229 SignalEndOfStream(); |
229 } | 230 } |
OLD | NEW |