| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/filters/audio_renderer_base.h" | 5 #include "media/filters/audio_renderer_base.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 NewCallback(this, &AudioRendererBase::ScheduleRead_Locked); | 100 NewCallback(this, &AudioRendererBase::ScheduleRead_Locked); |
| 101 | 101 |
| 102 // Construct the algorithm. | 102 // Construct the algorithm. |
| 103 algorithm_.reset(new AudioRendererAlgorithmOLA()); | 103 algorithm_.reset(new AudioRendererAlgorithmOLA()); |
| 104 | 104 |
| 105 // Initialize our algorithm with media properties, initial playback rate, | 105 // Initialize our algorithm with media properties, initial playback rate, |
| 106 // and a callback to request more reads from the data source. | 106 // and a callback to request more reads from the data source. |
| 107 ChannelLayout channel_layout = decoder_->channel_layout(); | 107 ChannelLayout channel_layout = decoder_->channel_layout(); |
| 108 int channels = ChannelLayoutToChannelCount(channel_layout); | 108 int channels = ChannelLayoutToChannelCount(channel_layout); |
| 109 int bits_per_channel = decoder_->bits_per_channel(); | 109 int bits_per_channel = decoder_->bits_per_channel(); |
| 110 int sample_rate = decoder_->sample_rate(); | 110 int sample_rate = decoder_->samples_per_second(); |
| 111 algorithm_->Initialize(channels, sample_rate, bits_per_channel, 0.0f, cb); | 111 algorithm_->Initialize(channels, sample_rate, bits_per_channel, 0.0f, cb); |
| 112 | 112 |
| 113 // Give the subclass an opportunity to initialize itself. | 113 // Give the subclass an opportunity to initialize itself. |
| 114 if (!OnInitialize(bits_per_channel, channel_layout, sample_rate)) { | 114 if (!OnInitialize(bits_per_channel, channel_layout, sample_rate)) { |
| 115 host()->SetError(PIPELINE_ERROR_INITIALIZATION_FAILED); | 115 host()->SetError(PIPELINE_ERROR_INITIALIZATION_FAILED); |
| 116 callback->Run(); | 116 callback->Run(); |
| 117 return; | 117 return; |
| 118 } | 118 } |
| 119 | 119 |
| 120 // Finally, execute the start callback. | 120 // Finally, execute the start callback. |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 | 248 |
| 249 void AudioRendererBase::SetPlaybackRate(float playback_rate) { | 249 void AudioRendererBase::SetPlaybackRate(float playback_rate) { |
| 250 algorithm_->set_playback_rate(playback_rate); | 250 algorithm_->set_playback_rate(playback_rate); |
| 251 } | 251 } |
| 252 | 252 |
| 253 float AudioRendererBase::GetPlaybackRate() { | 253 float AudioRendererBase::GetPlaybackRate() { |
| 254 return algorithm_->playback_rate(); | 254 return algorithm_->playback_rate(); |
| 255 } | 255 } |
| 256 | 256 |
| 257 } // namespace media | 257 } // namespace media |
| OLD | NEW |