| 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 610e78d75866dcca5ada51b9333b61fdbf80f040..38cace658d2e554a79f3e9d7a5df57714c45766d 100644
|
| --- a/media/filters/source_buffer_stream_unittest.cc
|
| +++ b/media/filters/source_buffer_stream_unittest.cc
|
| @@ -349,6 +349,12 @@ class SourceBufferStreamTest : public testing::Test {
|
| EXPECT_EQ(SourceBufferStream::kNeedBuffer, stream_->GetNextBuffer(&buffer));
|
| }
|
|
|
| + void CheckEOSReached() {
|
| + scoped_refptr<StreamParserBuffer> buffer;
|
| + EXPECT_EQ(SourceBufferStream::kEndOfStream,
|
| + stream_->GetNextBuffer(&buffer));
|
| + }
|
| +
|
| void CheckVideoConfig(const VideoDecoderConfig& config) {
|
| const VideoDecoderConfig& actual = stream_->GetCurrentVideoDecoderConfig();
|
| EXPECT_TRUE(actual.Matches(config))
|
| @@ -3239,6 +3245,55 @@ TEST_F(SourceBufferStreamTest,
|
| CheckExpectedRangesByTimestamp("{ [0,90) }");
|
| }
|
|
|
| +TEST_F(SourceBufferStreamTest, SetExplicitDuration_MarkEOS) {
|
| + // Append 1 buffer at positions 0 through 8.
|
| + NewSegmentAppend(0, 9);
|
| +
|
| + // Check expected ranges.
|
| + CheckExpectedRanges("{ [0,8) }");
|
| +
|
| + // Seek to 5.
|
| + Seek(5);
|
| +
|
| + // Set duration to be before the seeked to position.
|
| + // This will result in truncation of the selected range and a reset
|
| + // of NextBufferPosition.
|
| + stream_->OnSetDuration(frame_duration() * 4);
|
| +
|
| + // Check the expected ranges.
|
| + CheckExpectedRanges("{ [0,3) }");
|
| +
|
| + // Mark EOS reached.
|
| + stream_->MarkEndOfStream();
|
| +
|
| + // Expect EOS to be reached.
|
| + CheckEOSReached();
|
| +}
|
| +
|
| +TEST_F(SourceBufferStreamTest, SetExplicitDuration_MarkEOS_IsSeekPending) {
|
| + // Append 1 buffer at positions 0 through 8.
|
| + NewSegmentAppend(0, 9);
|
| +
|
| + // Check expected ranges.
|
| + CheckExpectedRanges("{ [0,8) }");
|
| +
|
| + // Seek to 9 which will result in a pending seek.
|
| + Seek(9);
|
| +
|
| + // Set duration to be before the seeked to position.
|
| + // This will result in truncation of the selected range and a reset
|
| + // of NextBufferPosition.
|
| + stream_->OnSetDuration(frame_duration() * 4);
|
| +
|
| + // Check the expected ranges.
|
| + CheckExpectedRanges("{ [0,3) }");
|
| +
|
| + EXPECT_TRUE(stream_->IsSeekPending());
|
| + // Mark EOS reached.
|
| + stream_->MarkEndOfStream();
|
| + EXPECT_FALSE(stream_->IsSeekPending());
|
| +}
|
| +
|
| // 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.
|
|
|