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 3828d6c02ec74cfa7f45401a458f1d57b9639e57..d0a03095397851bce396c96c93b3503476fe6968 100644 |
--- a/media/filters/source_buffer_stream_unittest.cc |
+++ b/media/filters/source_buffer_stream_unittest.cc |
@@ -3941,6 +3941,54 @@ TEST_F(SourceBufferStreamTest, BFrames) { |
CheckNoNextBuffer(); |
} |
+TEST_F(SourceBufferStreamTest, Video_DependencyInterrupted) { |
+ NewSegmentAppend("0D30K 30"); |
+ CheckExpectedRangesByTimestamp("{ [0,60) }"); |
+ NewSegmentAppend("10D15K"); |
+ |
+ // Spec lack of clarity: |
+ // The problem is the buffer at time 30 might be decoded *after* 10K has |
+ // interrupted the decode dependency on 0K. |
+ // If this test passes, then at least Chromium seems to be sane, though spec |
+ // is ambiguous. |
+ CheckExpectedRangesByTimestamp("{ [0,25) }"); |
+ |
+ // Seeking here to possibly prevent SBS track_buffer_ from interfering. |
+ Seek(0); |
+ |
+ CheckExpectedBuffers("0K 10K"); |
+ CheckNoNextBuffer(); |
+} |
+ |
+TEST_F(SourceBufferStreamTest, Video_OverlappedFrameDurationShouldChange) { |
+ NewSegmentAppend("0D30K"); |
+ NewSegmentAppend("100D30K"); |
+ CheckExpectedRangesByTimestamp("{ [0,30) [100,130) }"); |
+ NewSegmentAppend("10D15K"); |
+ CheckExpectedRangesByTimestamp("{ [0,25) [100,130) }"); |
+ |
+ RemoveInMs(10, 25, 130); |
+ |
+ // Spec lack of clarity, and Chromium likely exhibiting bad behavior: |
+ // The problem is the removal of the overlapping buffer [10, 15) exposes the |
+ // frame end time of the remaining last buffer in the first range, which the |
+ // spec doesn't say should have been reduced as part of this overlap. Hence, |
+ // due to the remove operation, the buffered duration of the range |
+ // *increases*. This is probably wrong in both spec and implementation. |
+ // tl;dr: Shouldn't it be "{ [0, 10) [100, 130) }" here? |
+ CheckExpectedRangesByTimestamp("{ [0,30) [100,130) }"); |
+ |
+ // Seeking here to possibly prevent SBS track_buffer_ from interfering. |
+ Seek(0); |
+ |
+ CheckExpectedBuffers("0K"); |
+ CheckNoNextBuffer(); |
+ |
+ SeekToTimestamp(base::TimeDelta::FromMilliseconds(100)); |
+ CheckExpectedBuffers("100K"); |
+ CheckNoNextBuffer(); |
+} |
+ |
// TODO(vrk): Add unit tests where keyframes are unaligned between streams. |
// (crbug.com/133557) |