summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-15 01:48:45 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-15 01:48:45 +0000
commitfc727bb5c50bf08213a870a09d500b043d0dc916 (patch)
treebaf5d834d8d6eba673ccf493dc987e97fe7946a7 /media
parent3748d1b7d368adad45d776cee2dac5729054b7fd (diff)
downloadchromium_src-fc727bb5c50bf08213a870a09d500b043d0dc916.zip
chromium_src-fc727bb5c50bf08213a870a09d500b043d0dc916.tar.gz
chromium_src-fc727bb5c50bf08213a870a09d500b043d0dc916.tar.bz2
Fixes crash due to NullAudioRenderer calling GetPlaybackRate() during initialization.
This mostly affects test_shell as NullAudioRenderer is only used with chrome when passing --disable-audio. BUG=13907 TEST=test should crash less Review URL: http://codereview.chromium.org/172018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23507 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/filters/audio_renderer_base.cc34
1 files changed, 16 insertions, 18 deletions
diff --git a/media/filters/audio_renderer_base.cc b/media/filters/audio_renderer_base.cc
index 4b46b1d..e29d07bc 100644
--- a/media/filters/audio_renderer_base.cc
+++ b/media/filters/audio_renderer_base.cc
@@ -78,25 +78,16 @@ void AudioRendererBase::Initialize(AudioDecoder* decoder,
scoped_ptr<FilterCallback> c(callback);
decoder_ = decoder;
- // Defer initialization until all scheduled reads have completed.
- if (!OnInitialize(decoder_->media_format())) {
- host()->SetError(PIPELINE_ERROR_INITIALIZATION_FAILED);
- callback->Run();
- return;
- }
-
// Get the media properties to initialize our algorithms.
int channels = 0;
int sample_rate = 0;
int sample_bits = 0;
- bool ret = ParseMediaFormat(decoder_->media_format(),
- &channels,
- &sample_rate,
- &sample_bits);
-
- // We should have successfully parsed the media format, or we would not have
- // been created.
- DCHECK(ret);
+ if (!ParseMediaFormat(decoder_->media_format(), &channels, &sample_rate,
+ &sample_bits)) {
+ host()->SetError(PIPELINE_ERROR_INITIALIZATION_FAILED);
+ callback->Run();
+ return;
+ }
// Create a callback so our algorithm can request more reads.
AudioRendererAlgorithmBase::RequestReadCallback* cb =
@@ -105,14 +96,21 @@ void AudioRendererBase::Initialize(AudioDecoder* decoder,
// Construct the algorithm.
algorithm_.reset(new AudioRendererAlgorithmOLA());
- // Initialize our algorithm with media properties, initial playback rate
- // (may be 0), and a callback to request more reads from the data source.
+ // Initialize our algorithm with media properties, initial playback rate,
+ // and a callback to request more reads from the data source.
algorithm_->Initialize(channels,
sample_rate,
sample_bits,
- GetPlaybackRate(),
+ 0.0f,
cb);
+ // Give the subclass an opportunity to initialize itself.
+ if (!OnInitialize(decoder_->media_format())) {
+ host()->SetError(PIPELINE_ERROR_INITIALIZATION_FAILED);
+ callback->Run();
+ return;
+ }
+
// Finally, execute the start callback.
state_ = kPaused;
callback->Run();