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

Unified Diff: media/filters/source_buffer_stream_unittest.cc

Issue 1491513002: [MSE] Fix GC with media_time past the last appended buffer timestamp (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 5d8dfd5d29b334018653a588c7513c0bfaab30fe..73b3f310cc11b5ff612f0d64742fd484965a4688 100644
--- a/media/filters/source_buffer_stream_unittest.cc
+++ b/media/filters/source_buffer_stream_unittest.cc
@@ -3061,6 +3061,26 @@ TEST_F(SourceBufferStreamTest, GarbageCollection_Performance) {
}
}
+TEST_F(SourceBufferStreamTest, GarbageCollection_MediaTimeAfterLastAppend) {
+ // Set memory limit to 10 buffers.
+ SetMemoryLimit(10);
+
+ // Append 12 buffers. The duration of the last buffer is 30
+ NewSegmentAppend("0K 30 60 90 120K 150 180 210K 240 270 300K 330D30");
+ CheckExpectedRangesByTimestamp("{ [0,360) }");
+
+ // Do a garbage collection with the media time higher than the timestamp of
+ // the last appended buffer (330), but lower than the end of buffered ranges
wolenetz 2015/12/01 01:12:43 nit: s/lower/within/ in this comment block? (see m
servolk 2015/12/01 18:51:49 Done.
+ // taking into account the duration of the last frame (i.e. lower than
+ // 330+30=360).
+ EXPECT_TRUE(stream_->GarbageCollectIfNeeded(
+ DecodeTimestamp::FromMilliseconds(350), 0));
wolenetz 2015/12/01 01:12:43 nit: s/350/360 to include the very edge of last ap
servolk 2015/12/01 18:51:49 Done.
+
+ // GC should collect one GOP from the front to bring us back under memory
+ // limit of 10 buffers.
+ CheckExpectedRangesByTimestamp("{ [120,360) }");
+}
+
TEST_F(SourceBufferStreamTest, GetRemovalRange_BytesToFree) {
// Append 2 GOPs starting at 300ms, 30ms apart.
NewSegmentAppend("300K 330 360 390K 420 450");
« 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