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

Unified Diff: media/filters/source_buffer_stream_unittest.cc

Issue 11785029: Prevent SourceBufferRange.waiting_for_keyframe_ from being lost on range merges. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 722d6d64e47513d9f3dc5ab044a481d12deb4be5..cd12d5ddfa0736601684f220244708b10eb1cc2f 100644
--- a/media/filters/source_buffer_stream_unittest.cc
+++ b/media/filters/source_buffer_stream_unittest.cc
@@ -2559,6 +2559,43 @@ TEST_F(SourceBufferStreamTest, SetExplicitDuration_DeletePartialSelectedRange) {
CheckExpectedRanges("{ [0,4) [10,10) }");
}
+// Test the case were the current playback position is at the end of the
+// buffered data and several overlaps occur that causes the selected
+// range to get split and then merged back into a single range.
+TEST_F(SourceBufferStreamTest, OverlapSplitAndMergeWhileWaitingForMoreData) {
+ // Seek to start of stream.
+ SeekToTimestamp(base::TimeDelta::FromMilliseconds(0));
+
+ NewSegmentAppend("0K 30 60 90 120K 150");
+ CheckExpectedRangesByTimestamp("{ [0,180) }");
+
+ // Read all the buffered data.
+ CheckExpectedBuffers("0K 30 60 90 120K 150");
+ CheckNoNextBuffer();
+
+ // Append data over the current GOP so that a keyframe is needed before
+ // playback can continue from the current position.
+ NewSegmentAppend("120K 150");
+ CheckExpectedRangesByTimestamp("{ [0,180) }");
+
+ // Append buffers that cause the range to get split.
+ NewSegmentAppend("0K 30");
+ CheckExpectedRangesByTimestamp("{ [0,60) [120,180) }");
+
+ // Append buffers that cause the ranges to get merged.
+ AppendBuffers("60 90");
+
+ CheckExpectedRangesByTimestamp("{ [0,180) }");
+
+ // Verify that we still don't have a next buffer.
+ CheckNoNextBuffer();
+
+ // Add more data to the end and verify that this new data is read correctly.
+ NewSegmentAppend("180K 210");
+ CheckExpectedRangesByTimestamp("{ [0,240) }");
+ CheckExpectedBuffers("180K 210");
+}
+
// TODO(vrk): Add unit tests where keyframes are unaligned between streams.
// (crbug.com/133557)
« 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