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

Side by Side Diff: media/filters/audio_renderer_impl.cc

Issue 315593004: Merge 274068 "Always use the source channel layout with AudioBuf..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1985/src/
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | media/filters/pipeline_integration_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 ChannelLayoutToChannelCount( 267 ChannelLayoutToChannelCount(
268 stream->audio_decoder_config().channel_layout()), 268 stream->audio_decoder_config().channel_layout()),
269 0, 269 0,
270 stream->audio_decoder_config().samples_per_second(), 270 stream->audio_decoder_config().samples_per_second(),
271 stream->audio_decoder_config().bits_per_channel(), 271 stream->audio_decoder_config().bits_per_channel(),
272 buffer_size); 272 buffer_size);
273 buffer_converter_.reset(); 273 buffer_converter_.reset();
274 } else { 274 } else {
275 // TODO(rileya): Support hardware config changes 275 // TODO(rileya): Support hardware config changes
276 const AudioParameters& hw_params = hardware_config_->GetOutputConfig(); 276 const AudioParameters& hw_params = hardware_config_->GetOutputConfig();
277 audio_parameters_.Reset(hw_params.format(), 277 audio_parameters_.Reset(
278 hw_params.channel_layout(), 278 hw_params.format(),
279 hw_params.channels(), 279 // Always use the source's channel layout and channel count to avoid
280 hw_params.input_channels(), 280 // premature downmixing (http://crbug.com/379288), platform specific
281 hw_params.sample_rate(), 281 // issues around channel layouts (http://crbug.com/266674), and
282 hw_params.bits_per_sample(), 282 // unnecessary upmixing overhead.
283 hardware_config_->GetHighLatencyBufferSize()); 283 stream->audio_decoder_config().channel_layout(),
284 ChannelLayoutToChannelCount(
285 stream->audio_decoder_config().channel_layout()),
286 hw_params.input_channels(),
287 hw_params.sample_rate(),
288 hw_params.bits_per_sample(),
289 hardware_config_->GetHighLatencyBufferSize());
284 } 290 }
285 291
286 audio_clock_.reset(new AudioClock(audio_parameters_.sample_rate())); 292 audio_clock_.reset(new AudioClock(audio_parameters_.sample_rate()));
287 293
288 audio_buffer_stream_.Initialize( 294 audio_buffer_stream_.Initialize(
289 stream, 295 stream,
290 false, 296 false,
291 statistics_cb, 297 statistics_cb,
292 base::Bind(&AudioRendererImpl::OnAudioBufferStreamInitialized, 298 base::Bind(&AudioRendererImpl::OnAudioBufferStreamInitialized,
293 weak_factory_.GetWeakPtr())); 299 weak_factory_.GetWeakPtr()));
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 DCHECK(expecting_config_changes_); 753 DCHECK(expecting_config_changes_);
748 buffer_converter_->ResetTimestampState(); 754 buffer_converter_->ResetTimestampState();
749 // Drain flushed buffers from the converter so the AudioSplicer receives all 755 // Drain flushed buffers from the converter so the AudioSplicer receives all
750 // data ahead of any OnNewSpliceBuffer() calls. Since discontinuities should 756 // data ahead of any OnNewSpliceBuffer() calls. Since discontinuities should
751 // only appear after config changes, AddInput() should never fail here. 757 // only appear after config changes, AddInput() should never fail here.
752 while (buffer_converter_->HasNextBuffer()) 758 while (buffer_converter_->HasNextBuffer())
753 CHECK(splicer_->AddInput(buffer_converter_->GetNextBuffer())); 759 CHECK(splicer_->AddInput(buffer_converter_->GetNextBuffer()));
754 } 760 }
755 761
756 } // namespace media 762 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/filters/pipeline_integration_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698