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

Unified Diff: media/filters/video_frame_stream_unittest.cc

Issue 2110463003: Remove pending demuxer read state, prefer flag, it's not stable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use expect. Created 4 years, 6 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/decoder_stream.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/video_frame_stream_unittest.cc
diff --git a/media/filters/video_frame_stream_unittest.cc b/media/filters/video_frame_stream_unittest.cc
index 6b16565b83de26cd59efead82d84f925adf79d79..274c2be114e6c9222f5d0ee874510daee0d21679 100644
--- a/media/filters/video_frame_stream_unittest.cc
+++ b/media/filters/video_frame_stream_unittest.cc
@@ -810,6 +810,42 @@ TEST_P(VideoFrameStreamTest, FallbackDecoder_EndOfStreamReachedBeforeFallback) {
frame_read_->metadata()->IsTrue(VideoFrameMetadata::END_OF_STREAM));
}
+TEST_P(VideoFrameStreamTest, FallbackDecoder_DoesReinitializeStompPendingRead) {
+ // Test only the case where there is no decoding delay and parallel decoding.
+ if (GetParam().decoding_delay != 0 || GetParam().parallel_decoding <= 1)
+ return;
+
+ Initialize();
+ decoder1_->HoldDecode();
+
+ // Queue one read, defer the second.
+ frame_read_ = nullptr;
+ pending_read_ = true;
+ video_frame_stream_->Read(
+ base::Bind(&VideoFrameStreamTest::FrameReady, base::Unretained(this)));
+ demuxer_stream_->HoldNextRead();
+
+ // Force an error to occur on the first decode, but ensure it isn't propagated
+ // until after the next read has been started.
+ decoder1_->SimulateError();
+ decoder2_->HoldDecode();
+
+ // Complete the fallback to the second decoder with the read still pending.
+ base::RunLoop().RunUntilIdle();
+
+ // Can't check |decoder1_| right now, it might have been destroyed already.
+ // Verify that there was nothing decoded until we kicked the decoder.
+ EXPECT_EQ(decoder2_->total_bytes_decoded(), 0);
+ decoder2_->SatisfyDecode();
+ const int first_decoded_bytes = decoder2_->total_bytes_decoded();
+ ASSERT_GT(first_decoded_bytes, 0);
+
+ // Satisfy the previously pending read and ensure it is decoded.
+ demuxer_stream_->SatisfyRead();
+ base::RunLoop().RunUntilIdle();
+ ASSERT_GT(decoder2_->total_bytes_decoded(), first_decoded_bytes);
+}
+
TEST_P(VideoFrameStreamTest,
FallbackDecoder_SelectedOnInitialDecodeError_Twice) {
Initialize();
« no previous file with comments | « media/filters/decoder_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698