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

Unified Diff: media/filters/source_buffer_stream_unittest.cc

Issue 1692403002: MSE - Fix crash caused by incorrect GC of GOP with next buffer position (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Stick with DCHECKs for this to ease merging. +unit test Created 4 years, 10 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
Index: media/filters/source_buffer_stream_unittest.cc
diff --git a/media/filters/source_buffer_stream_unittest.cc b/media/filters/source_buffer_stream_unittest.cc
index fd807083862cac1c4911c952de86e36312deb55d..70711ffd365a29f4e00558dc3d55d31967a5cd2c 100644
--- a/media/filters/source_buffer_stream_unittest.cc
+++ b/media/filters/source_buffer_stream_unittest.cc
@@ -2451,6 +2451,32 @@ TEST_F(SourceBufferStreamTest, GarbageCollection_DeleteFront) {
CheckExpectedBuffers(5, 9, &kDataA);
}
+TEST_F(SourceBufferStreamTest,
wolenetz 2016/02/13 01:35:07 Note: I tried this test alone against ToT, and it
+ GarbageCollection_DeleteFront_PreserveSeekedGOP) {
+ // Set memory limit to 10 buffers.
chcunningham 2016/02/16 21:27:02 typo: 15 buffers
wolenetz 2016/02/16 22:05:05 Done.
+ SetMemoryLimit(15);
+
+ NewSegmentAppend("0K 10 20 30 40 50K 60 70 80 90");
+ NewSegmentAppend("1000K 1010 1020 1030 1040");
wolenetz 2016/02/13 01:35:07 Aside: A subsequent range was necessary to ensure
wolenetz 2016/02/13 01:52:01 Comment clarification: the last appended GOP is st
+
+ // GC should be a no-op, since we are just under memory limit.
+ EXPECT_TRUE(stream_->GarbageCollectIfNeeded(DecodeTimestamp(), 0));
+ CheckExpectedRangesByTimestamp("{ [0,100) [1000,1050) }");
+
+ // Seek to the near the end of the first range
+ SeekToTimestampMs(95);
+
+ // We are about to append 7 new buffers and current playback position is at
+ // the end of the last GOP in the first range, so the GC algorithm should be
+ // able to delete some old data from the front, but must not collect the last
+ // GOP in that first range. Neither can it collect the last appended GOP
+ // (which is the entire second range), so GC should return false since it
+ // couldn't collect enough.
+ EXPECT_FALSE(stream_->GarbageCollectIfNeeded(
+ DecodeTimestamp::FromMilliseconds(95), 7));
+ CheckExpectedRangesByTimestamp("{ [50,100) [1000,1050) }");
+}
+
TEST_F(SourceBufferStreamTest, GarbageCollection_DeleteFrontGOPsAtATime) {
// Set memory limit to 20 buffers.
SetMemoryLimit(20);
« media/filters/source_buffer_stream.cc ('K') | « media/filters/source_buffer_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698