Chromium Code Reviews| 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/filters/audio_renderer_impl.h" | 5 #include "media/filters/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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 276 ChannelLayoutToChannelCount( | 276 ChannelLayoutToChannelCount( |
| 277 stream->audio_decoder_config().channel_layout()), | 277 stream->audio_decoder_config().channel_layout()), |
| 278 0, | 278 0, |
| 279 stream->audio_decoder_config().samples_per_second(), | 279 stream->audio_decoder_config().samples_per_second(), |
| 280 stream->audio_decoder_config().bits_per_channel(), | 280 stream->audio_decoder_config().bits_per_channel(), |
| 281 buffer_size); | 281 buffer_size); |
| 282 buffer_converter_.reset(); | 282 buffer_converter_.reset(); |
| 283 } else { | 283 } else { |
| 284 // TODO(rileya): Support hardware config changes | 284 // TODO(rileya): Support hardware config changes |
| 285 const AudioParameters& hw_params = hardware_config_->GetOutputConfig(); | 285 const AudioParameters& hw_params = hardware_config_->GetOutputConfig(); |
| 286 audio_parameters_.Reset(hw_params.format(), | 286 audio_parameters_.Reset( |
| 287 hw_params.channel_layout(), | 287 hw_params.format(), |
| 288 hw_params.channels(), | 288 // To avoid unnecessary upmixing and platform specific issues around |
| 289 hw_params.input_channels(), | 289 // channel layouts (http://crbug.com/266674) only allow channel down |
|
wolenetz
2014/05/30 23:01:00
nit: Upmixing is still allowed, but to no higher t
DaleCurtis
2014/05/30 23:08:57
Done.
| |
| 290 hw_params.sample_rate(), | 290 // mixing within the AudioBufferConverter. |
| 291 hw_params.bits_per_sample(), | 291 stream->audio_decoder_config().channel_layout(), |
| 292 hardware_config_->GetHighLatencyBufferSize()); | 292 ChannelLayoutToChannelCount( |
| 293 stream->audio_decoder_config().channel_layout()), | |
| 294 hw_params.input_channels(), | |
| 295 hw_params.sample_rate(), | |
| 296 hw_params.bits_per_sample(), | |
| 297 hardware_config_->GetHighLatencyBufferSize()); | |
| 293 } | 298 } |
| 294 | 299 |
| 295 audio_clock_.reset(new AudioClock(audio_parameters_.sample_rate())); | 300 audio_clock_.reset(new AudioClock(audio_parameters_.sample_rate())); |
| 296 | 301 |
| 297 audio_buffer_stream_.Initialize( | 302 audio_buffer_stream_.Initialize( |
| 298 stream, | 303 stream, |
| 299 false, | 304 false, |
| 300 statistics_cb, | 305 statistics_cb, |
| 301 base::Bind(&AudioRendererImpl::OnAudioBufferStreamInitialized, | 306 base::Bind(&AudioRendererImpl::OnAudioBufferStreamInitialized, |
| 302 weak_factory_.GetWeakPtr())); | 307 weak_factory_.GetWeakPtr())); |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 756 DCHECK(expecting_config_changes_); | 761 DCHECK(expecting_config_changes_); |
| 757 buffer_converter_->ResetTimestampState(); | 762 buffer_converter_->ResetTimestampState(); |
| 758 // Drain flushed buffers from the converter so the AudioSplicer receives all | 763 // Drain flushed buffers from the converter so the AudioSplicer receives all |
| 759 // data ahead of any OnNewSpliceBuffer() calls. Since discontinuities should | 764 // data ahead of any OnNewSpliceBuffer() calls. Since discontinuities should |
| 760 // only appear after config changes, AddInput() should never fail here. | 765 // only appear after config changes, AddInput() should never fail here. |
| 761 while (buffer_converter_->HasNextBuffer()) | 766 while (buffer_converter_->HasNextBuffer()) |
| 762 CHECK(splicer_->AddInput(buffer_converter_->GetNextBuffer())); | 767 CHECK(splicer_->AddInput(buffer_converter_->GetNextBuffer())); |
| 763 } | 768 } |
| 764 | 769 |
| 765 } // namespace media | 770 } // namespace media |
| OLD | NEW |