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

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

Issue 1573753002: Handle invalid hardware output parameters in AudioRendererHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2564
Patch Set: Created 4 years, 11 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
« no previous file with comments | « content/renderer/media/audio_renderer_mixer_manager.cc ('k') | no next file » | 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/renderers/audio_renderer_impl.h" 5 #include "media/renderers/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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 // failed. 332 // failed.
333 init_cb_ = BindToCurrentLoop(init_cb); 333 init_cb_ = BindToCurrentLoop(init_cb);
334 334
335 buffering_state_cb_ = buffering_state_cb; 335 buffering_state_cb_ = buffering_state_cb;
336 ended_cb_ = ended_cb; 336 ended_cb_ = ended_cb;
337 error_cb_ = error_cb; 337 error_cb_ = error_cb;
338 statistics_cb_ = statistics_cb; 338 statistics_cb_ = statistics_cb;
339 339
340 const AudioParameters& hw_params = hardware_config_.GetOutputConfig(); 340 const AudioParameters& hw_params = hardware_config_.GetOutputConfig();
341 expecting_config_changes_ = stream->SupportsConfigChanges(); 341 expecting_config_changes_ = stream->SupportsConfigChanges();
342 if (!expecting_config_changes_ || !hw_params.IsValid()) { 342 if (!expecting_config_changes_ || !hw_params.IsValid() ||
343 hw_params.format() == AudioParameters::AUDIO_FAKE) {
343 // The actual buffer size is controlled via the size of the AudioBus 344 // The actual buffer size is controlled via the size of the AudioBus
344 // provided to Render(), so just choose something reasonable here for looks. 345 // provided to Render(), so just choose something reasonable here for looks.
345 int buffer_size = stream->audio_decoder_config().samples_per_second() / 100; 346 int buffer_size = stream->audio_decoder_config().samples_per_second() / 100;
346 audio_parameters_.Reset( 347 audio_parameters_.Reset(
347 AudioParameters::AUDIO_PCM_LOW_LATENCY, 348 AudioParameters::AUDIO_PCM_LOW_LATENCY,
348 stream->audio_decoder_config().channel_layout(), 349 stream->audio_decoder_config().channel_layout(),
349 stream->audio_decoder_config().samples_per_second(), 350 stream->audio_decoder_config().samples_per_second(),
350 stream->audio_decoder_config().bits_per_channel(), 351 stream->audio_decoder_config().bits_per_channel(),
351 buffer_size); 352 buffer_size);
352 buffer_converter_.reset(); 353 buffer_converter_.reset();
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 << buffering_state; 807 << buffering_state;
807 DCHECK_NE(buffering_state_, buffering_state); 808 DCHECK_NE(buffering_state_, buffering_state);
808 lock_.AssertAcquired(); 809 lock_.AssertAcquired();
809 buffering_state_ = buffering_state; 810 buffering_state_ = buffering_state;
810 811
811 task_runner_->PostTask(FROM_HERE, 812 task_runner_->PostTask(FROM_HERE,
812 base::Bind(buffering_state_cb_, buffering_state_)); 813 base::Bind(buffering_state_cb_, buffering_state_));
813 } 814 }
814 815
815 } // namespace media 816 } // namespace media
OLDNEW
« no previous file with comments | « content/renderer/media/audio_renderer_mixer_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698