diff options
author | fbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-21 01:06:35 +0000 |
---|---|---|
committer | fbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-21 01:06:35 +0000 |
commit | a7d7f6d210ac7c396fd81e4b660a6c19b11871bb (patch) | |
tree | 10567705a2516173d4027b28c03c03d1a7929d9a /media | |
parent | 39c1854f3bd2a959b34115a3fccdb001e9ca186e (diff) | |
download | chromium_src-a7d7f6d210ac7c396fd81e4b660a6c19b11871bb.zip chromium_src-a7d7f6d210ac7c396fd81e4b660a6c19b11871bb.tar.gz chromium_src-a7d7f6d210ac7c396fd81e4b660a6c19b11871bb.tar.bz2 |
Avoid dereferencing null pointer when an audio initialization error occurs.
BUG=17283
TRY=play multichannel audio (ie trek6.mp4) in media player and a crash occurs. This fix avoids the crash.
Review URL: http://codereview.chromium.org/159099
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21138 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/filters/audio_renderer_base.cc | 10 | ||||
-rw-r--r-- | media/filters/audio_renderer_impl.cc | 5 |
2 files changed, 7 insertions, 8 deletions
diff --git a/media/filters/audio_renderer_base.cc b/media/filters/audio_renderer_base.cc index 675fdd6..35a49dc 100644 --- a/media/filters/audio_renderer_base.cc +++ b/media/filters/audio_renderer_base.cc @@ -60,17 +60,17 @@ void AudioRendererBase::Initialize(AudioDecoder* decoder, decoder_ = decoder; initialize_callback_.reset(callback); - // Schedule our initial reads. - for (size_t i = 0; i < max_queue_size_; ++i) { - ScheduleRead(); - } - // Defer initialization until all scheduled reads have completed. if (!OnInitialize(decoder_->media_format())) { host()->SetError(PIPELINE_ERROR_INITIALIZATION_FAILED); initialize_callback_->Run(); initialize_callback_.reset(); } + + // Schedule our initial reads. + for (size_t i = 0; i < max_queue_size_; ++i) { + ScheduleRead(); + } } void AudioRendererBase::OnReadComplete(Buffer* buffer_in) { diff --git a/media/filters/audio_renderer_impl.cc b/media/filters/audio_renderer_impl.cc index 180aa76..f944c88 100644 --- a/media/filters/audio_renderer_impl.cc +++ b/media/filters/audio_renderer_impl.cc @@ -83,7 +83,6 @@ bool AudioRendererImpl::OnInitialize(const MediaFormat& media_format) { // Create our audio stream. stream_ = AudioManager::GetAudioManager()->MakeAudioStream( AudioManager::AUDIO_PCM_LINEAR, channels, sample_rate, sample_bits); - DCHECK(stream_); if (!stream_) return false; @@ -98,8 +97,8 @@ bool AudioRendererImpl::OnInitialize(const MediaFormat& media_format) { } void AudioRendererImpl::OnStop() { - DCHECK(stream_); - stream_->Stop(); + if (stream_) + stream_->Stop(); } } // namespace media |