diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-23 19:11:19 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-23 19:11:19 +0000 |
commit | 91e7504a739edae81016d88cadd1d46c626e047d (patch) | |
tree | 6d35056a5f38b9255d92e462f486446ca73c6bdd /media | |
parent | cca1863f256c2847c2943e5348327159969f6429 (diff) | |
download | chromium_src-91e7504a739edae81016d88cadd1d46c626e047d.zip chromium_src-91e7504a739edae81016d88cadd1d46c626e047d.tar.gz chromium_src-91e7504a739edae81016d88cadd1d46c626e047d.tar.bz2 |
Don't uninitialize FFmpegVideoDecodeEngine if we haven't initialized it.
BUG=67303
TEST=media_unittests
Review URL: http://codereview.chromium.org/6046006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70077 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/filters/ffmpeg_video_decoder.cc | 6 | ||||
-rw-r--r-- | media/filters/ffmpeg_video_decoder.h | 1 | ||||
-rw-r--r-- | media/filters/ffmpeg_video_decoder_unittest.cc | 11 |
3 files changed, 13 insertions, 5 deletions
diff --git a/media/filters/ffmpeg_video_decoder.cc b/media/filters/ffmpeg_video_decoder.cc index b3c21b944..bdaee8c 100644 --- a/media/filters/ffmpeg_video_decoder.cc +++ b/media/filters/ffmpeg_video_decoder.cc @@ -97,6 +97,7 @@ void FFmpegVideoDecoder::Initialize(DemuxerStream* demuxer_stream, config.opaque_context = av_stream; config.width = width_; config.height = height_; + state_ = kInitializing; decode_engine_->Initialize(message_loop(), this, NULL, config); } @@ -139,7 +140,10 @@ void FFmpegVideoDecoder::Stop(FilterCallback* callback) { DCHECK(!uninitialize_callback_.get()); uninitialize_callback_.reset(callback); - decode_engine_->Uninitialize(); + if (state_ != kUnInitialized) + decode_engine_->Uninitialize(); + else + OnUninitializeComplete(); } void FFmpegVideoDecoder::OnUninitializeComplete() { diff --git a/media/filters/ffmpeg_video_decoder.h b/media/filters/ffmpeg_video_decoder.h index 617dfc1..76e60e8 100644 --- a/media/filters/ffmpeg_video_decoder.h +++ b/media/filters/ffmpeg_video_decoder.h @@ -72,6 +72,7 @@ class FFmpegVideoDecoder : public VideoDecoder, enum DecoderState { kUnInitialized, + kInitializing, kNormal, kFlushCodec, kDecodeFinished, diff --git a/media/filters/ffmpeg_video_decoder_unittest.cc b/media/filters/ffmpeg_video_decoder_unittest.cc index 9c1cc4c..779a48f 100644 --- a/media/filters/ffmpeg_video_decoder_unittest.cc +++ b/media/filters/ffmpeg_video_decoder_unittest.cc @@ -160,12 +160,15 @@ class FFmpegVideoDecoderTest : public testing::Test { } virtual ~FFmpegVideoDecoderTest() { - // We had to set this because not all tests had initialized the engine. - engine_->event_handler_ = decoder_.get(); EXPECT_CALL(callback_, OnFilterCallback()); EXPECT_CALL(callback_, OnCallbackDestroyed()); - EXPECT_CALL(*engine_, Uninitialize()) - .WillOnce(EngineUninitialize(engine_)); + + // The presence of an event handler means we need to uninitialize. + if (engine_->event_handler_) { + EXPECT_CALL(*engine_, Uninitialize()) + .WillOnce(EngineUninitialize(engine_)); + } + decoder_->Stop(callback_.NewCallback()); // Finish up any remaining tasks. |