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

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

Issue 1542103002: Handle invalid hardware output parameters in AudioRendererHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor style change 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 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 // failed. 334 // failed.
335 init_cb_ = BindToCurrentLoop(init_cb); 335 init_cb_ = BindToCurrentLoop(init_cb);
336 336
337 buffering_state_cb_ = buffering_state_cb; 337 buffering_state_cb_ = buffering_state_cb;
338 ended_cb_ = ended_cb; 338 ended_cb_ = ended_cb;
339 error_cb_ = error_cb; 339 error_cb_ = error_cb;
340 statistics_cb_ = statistics_cb; 340 statistics_cb_ = statistics_cb;
341 341
342 const AudioParameters& hw_params = hardware_config_.GetOutputConfig(); 342 const AudioParameters& hw_params = hardware_config_.GetOutputConfig();
343 expecting_config_changes_ = stream->SupportsConfigChanges(); 343 expecting_config_changes_ = stream->SupportsConfigChanges();
344 if (!expecting_config_changes_ || !hw_params.IsValid()) { 344 if (!expecting_config_changes_ || !hw_params.IsValid() ||
345 hw_params.format() == AudioParameters::AUDIO_FAKE) {
345 // The actual buffer size is controlled via the size of the AudioBus 346 // The actual buffer size is controlled via the size of the AudioBus
346 // provided to Render(), so just choose something reasonable here for looks. 347 // provided to Render(), so just choose something reasonable here for looks.
347 int buffer_size = stream->audio_decoder_config().samples_per_second() / 100; 348 int buffer_size = stream->audio_decoder_config().samples_per_second() / 100;
348 audio_parameters_.Reset( 349 audio_parameters_.Reset(
349 AudioParameters::AUDIO_PCM_LOW_LATENCY, 350 AudioParameters::AUDIO_PCM_LOW_LATENCY,
350 stream->audio_decoder_config().channel_layout(), 351 stream->audio_decoder_config().channel_layout(),
351 stream->audio_decoder_config().samples_per_second(), 352 stream->audio_decoder_config().samples_per_second(),
352 stream->audio_decoder_config().bits_per_channel(), 353 stream->audio_decoder_config().bits_per_channel(),
353 buffer_size); 354 buffer_size);
354 buffer_converter_.reset(); 355 buffer_converter_.reset();
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 << buffering_state; 820 << buffering_state;
820 DCHECK_NE(buffering_state_, buffering_state); 821 DCHECK_NE(buffering_state_, buffering_state);
821 lock_.AssertAcquired(); 822 lock_.AssertAcquired();
822 buffering_state_ = buffering_state; 823 buffering_state_ = buffering_state;
823 824
824 task_runner_->PostTask(FROM_HERE, 825 task_runner_->PostTask(FROM_HERE,
825 base::Bind(buffering_state_cb_, buffering_state_)); 826 base::Bind(buffering_state_cb_, buffering_state_));
826 } 827 }
827 828
828 } // namespace media 829 } // 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