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

Unified Diff: media/filters/source_buffer_stream_unittest.cc

Issue 10736021: Reland r145965 - Make sure previous seek points in SourceBufferStream are ignored during overlaps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix asan Created 8 years, 5 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 3a116616a54eb4554771c5076f08355e35c6700f..30fcf071b03de712987ea32fcc444c25df758375 100644
--- a/media/filters/source_buffer_stream_unittest.cc
+++ b/media/filters/source_buffer_stream_unittest.cc
@@ -1131,6 +1131,142 @@ TEST_F(SourceBufferStreamTest, Seek_StartOfSegment) {
CheckExpectedBuffers(16, 19);
}
+TEST_F(SourceBufferStreamTest, OldSeekPoint_CompleteOverlap) {
+ // Append 5 buffers at positions 0 through 4.
+ NewSegmentAppend(0, 4);
+
+ // Append 5 buffers at positions 10 through 14, and seek to the beginning of
+ // this range.
+ NewSegmentAppend(10, 5);
+ Seek(10);
+
+ // Now seek to the beginning of the first range.
+ Seek(0);
+
+ // Completely overlap the old seek point.
+ NewSegmentAppend(5, 15);
+
+ // The GetNextBuffer() call should respect the 2nd seek point.
+ CheckExpectedBuffers(0, 0);
+}
+
+TEST_F(SourceBufferStreamTest, OldSeekPoint_CompleteOverlap_Pending) {
+ // Append 5 buffers at positions 10 through 14 and seek to beginning of the
+ // range.
+ NewSegmentAppend(10, 5);
+ Seek(10);
+
+ // Now seek to the beginning of the stream.
+ Seek(0);
+
+ // Completely overlap the old seek point.
+ NewSegmentAppend(5, 15);
+
+ // The seek at time 0 should still be pending.
+ CheckNoNextBuffer();
+}
+
+TEST_F(SourceBufferStreamTest, OldSeekPoint_MiddleOverlap) {
+ // Append 2 buffers at positions 0 through 1.
+ NewSegmentAppend(0, 2);
+
+ // Append 15 buffers at positions 5 through 19 and seek to position 15.
+ NewSegmentAppend(5, 15);
+ Seek(15);
+
+ // Now seek to the beginning of the stream.
+ Seek(0);
+
+ // Overlap the middle of the range such that there are now three ranges.
+ NewSegmentAppend(10, 3);
+ CheckExpectedRanges("{ [0,1) [5,12) [15,19) }");
+
+ // The GetNextBuffer() call should respect the 2nd seek point.
+ CheckExpectedBuffers(0, 0);
+}
+
+TEST_F(SourceBufferStreamTest, OldSeekPoint_MiddleOverlap_Pending) {
+ // Append 15 buffers at positions 5 through 19 and seek to position 15.
+ NewSegmentAppend(5, 15);
+ Seek(15);
+
+ // Now seek to the beginning of the stream.
+ Seek(0);
+
+ // Overlap the middle of the range such that there are now two ranges.
+ NewSegmentAppend(10, 3);
+ CheckExpectedRanges("{ [5,12) [15,19) }");
+
+ // The seek at time 0 should still be pending.
+ CheckNoNextBuffer();
+}
+
+TEST_F(SourceBufferStreamTest, OldSeekPoint_StartOverlap) {
+ // Append 2 buffers at positions 0 through 1.
+ NewSegmentAppend(0, 2);
+
+ // Append 15 buffers at positions 5 through 19 and seek to position 15.
+ NewSegmentAppend(5, 15);
+ Seek(15);
+
+ // Now seek to the beginning of the stream.
+ Seek(0);
+
+ // Start overlap the old seek point.
+ NewSegmentAppend(10, 10);
+
+ // The GetNextBuffer() call should respect the 2nd seek point.
+ CheckExpectedBuffers(0, 0);
+}
+
+TEST_F(SourceBufferStreamTest, OldSeekPoint_StartOverlap_Pending) {
+ // Append 15 buffers at positions 5 through 19 and seek to position 15.
+ NewSegmentAppend(5, 15);
+ Seek(15);
+
+ // Now seek to the beginning of the stream.
+ Seek(0);
+
+ // Start overlap the old seek point.
+ NewSegmentAppend(10, 10);
+
+ // The seek at time 0 should still be pending.
+ CheckNoNextBuffer();
+}
+
+TEST_F(SourceBufferStreamTest, OldSeekPoint_EndOverlap) {
+ // Append 5 buffers at positions 0 through 4.
+ NewSegmentAppend(0, 4);
+
+ // Append 15 buffers at positions 10 through 24 and seek to start of range.
+ NewSegmentAppend(10, 15);
+ Seek(10);
+
+ // Now seek to the beginning of the stream.
+ Seek(0);
+
+ // End overlap the old seek point.
+ NewSegmentAppend(5, 10);
+
+ // The GetNextBuffer() call should respect the 2nd seek point.
+ CheckExpectedBuffers(0, 0);
+}
+
+TEST_F(SourceBufferStreamTest, OldSeekPoint_EndOverlap_Pending) {
+ // Append 15 buffers at positions 10 through 24 and seek to start of range.
+ NewSegmentAppend(10, 15);
+ Seek(10);
+
+ // Now seek to the beginning of the stream.
+ Seek(0);
+
+ // End overlap the old seek point.
+ NewSegmentAppend(5, 10);
+
+ // The seek at time 0 should still be pending.
+ CheckNoNextBuffer();
+}
+
TEST_F(SourceBufferStreamTest, GetNextBuffer_AfterMerges) {
// Append 5 buffers at positions 10 through 14.
NewSegmentAppend(10, 5);
« 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