diff options
author | cevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-08 00:55:03 +0000 |
---|---|---|
committer | cevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-08 00:55:03 +0000 |
commit | 09baac99cc972d0bce4c7f5ada8f7fd10d78a49c (patch) | |
tree | 1b695c21cfe1d9292a7f3b9ff404b830be9f370d | |
parent | a4a97298d0280b99f80776aae940655314fa816c (diff) | |
download | chromium_src-09baac99cc972d0bce4c7f5ada8f7fd10d78a49c.zip chromium_src-09baac99cc972d0bce4c7f5ada8f7fd10d78a49c.tar.gz chromium_src-09baac99cc972d0bce4c7f5ada8f7fd10d78a49c.tar.bz2 |
Merge 70669 - Don't uninitialize FFmpegVideoDecodeEngine if we haven't initialized it.
This was originally commited as r70077 but was accidentally reverted.
BUG=67303
TEST=media_unittests
Review URL: http://codereview.chromium.org/6046006
TBR=scherkus@chromium.org
Review URL: http://codereview.chromium.org/6206001
git-svn-id: svn://svn.chromium.org/chrome/branches/597/src@70816 0039d316-1c4b-4281-b951-d872f2087c98
-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 1629e78..c65bbcb 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 415ab7d..415cff8 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. |