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

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: Increased hardening + more code comments per chat w/chcunningham@ 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
« no previous file with comments | « media/filters/source_buffer_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/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..cb8d2174f5ea4001fd03f43f67d1948834b1cdc9 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,
+ GarbageCollection_DeleteFront_PreserveSeekedGOP) {
+ // Set memory limit to 15 buffers.
+ SetMemoryLimit(15);
+
+ NewSegmentAppend("0K 10 20 30 40 50K 60 70 80 90");
+ NewSegmentAppend("1000K 1010 1020 1030 1040");
+
+ // 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);
« no previous file with comments | « media/filters/source_buffer_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698