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

Unified Diff: media/filters/ffmpeg_video_decoder_unittest.cc

Issue 159476: Merge 21611 - Implemented proper pausethenseek behaviour for the media pipeli... (Closed) Base URL: svn://chrome-svn/chrome/branches/195/src/
Patch Set: Created 11 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/ffmpeg_video_decoder.cc ('k') | media/filters/video_renderer_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/ffmpeg_video_decoder_unittest.cc
===================================================================
--- media/filters/ffmpeg_video_decoder_unittest.cc (revision 21798)
+++ media/filters/ffmpeg_video_decoder_unittest.cc (working copy)
@@ -271,21 +271,6 @@
EXPECT_TRUE(decoder->DecodeFrame(*buffer_, &codec_context_, &yuv_frame_));
}
-TEST_F(FFmpegVideoDecoderTest, DecodeFrame_DiscontinuousBuffer) {
- buffer_->SetDiscontinuous(true);
-
- // Expect a bunch of avcodec calls.
- EXPECT_CALL(mock_ffmpeg_, AVCodecFlushBuffers(&codec_context_));
- EXPECT_CALL(mock_ffmpeg_, AVInitPacket(_));
- EXPECT_CALL(mock_ffmpeg_,
- AVCodecDecodeVideo2(&codec_context_, &yuv_frame_, _, _))
- .WillOnce(DoAll(SetArgumentPointee<2>(1), // Simulate 1 byte frame.
- Return(0)));
-
- scoped_refptr<FFmpegVideoDecoder> decoder = new FFmpegVideoDecoder();
- EXPECT_TRUE(decoder->DecodeFrame(*buffer_, &codec_context_, &yuv_frame_));
-}
-
TEST_F(FFmpegVideoDecoderTest, DecodeFrame_0ByteFrame) {
// Expect a bunch of avcodec calls.
EXPECT_CALL(mock_ffmpeg_, AVInitPacket(_));
@@ -527,6 +512,38 @@
EXPECT_EQ(FFmpegVideoDecoder::kDecodeFinished, mock_decoder->state_);
}
+TEST_F(FFmpegVideoDecoderTest, OnSeek) {
+ // Simulates receiving a call to OnSeek() while in every possible state. In
+ // every case, it should clear the timestamp queue, flush the decoder and
+ // reset the state to kNormal.
+ scoped_refptr<DecoderPrivateMock> mock_decoder =
+ new StrictMock<DecoderPrivateMock>();
+ mock_decoder->codec_context_ = &codec_context_;
+
+ const base::TimeDelta kZero;
+ const FFmpegVideoDecoder::DecoderState kStates[] = {
+ FFmpegVideoDecoder::kNormal,
+ FFmpegVideoDecoder::kFlushCodec,
+ FFmpegVideoDecoder::kDecodeFinished,
+ };
+
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kStates); ++i) {
+ // Push in some timestamps.
+ mock_decoder->pts_queue_.push(kTestPts1.timestamp);
+ mock_decoder->pts_queue_.push(kTestPts2.timestamp);
+ mock_decoder->pts_queue_.push(kTestPts1.timestamp);
+
+ // Expect a flush.
+ mock_decoder->state_ = kStates[i];
+ EXPECT_CALL(mock_ffmpeg_, AVCodecFlushBuffers(&codec_context_));
+
+ // Seek and verify the results.
+ mock_decoder->OnSeek(kZero);
+ EXPECT_TRUE(mock_decoder->pts_queue_.empty());
+ EXPECT_EQ(FFmpegVideoDecoder::kNormal, mock_decoder->state_);
+ }
+}
+
TEST_F(FFmpegVideoDecoderTest, TimeQueue_Ordering) {
FFmpegVideoDecoder::TimeQueue queue;
queue.push(kTestPts1.timestamp);
Property changes on: media\filters\ffmpeg_video_decoder_unittest.cc
___________________________________________________________________
Added: svn:mergeinfo
Merged /trunk/src/media/filters/ffmpeg_video_decoder_unittest.cc:r21611
Merged /branches/chrome_webkit_merge_branch/media/filters/ffmpeg_video_decoder_unittest.cc:r69-2775
« no previous file with comments | « media/filters/ffmpeg_video_decoder.cc ('k') | media/filters/video_renderer_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698