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

Unified Diff: media/filters/source_buffer_stream_unittest.cc

Issue 1119163005: Return EOS when selected_range_ is NULL in SourceBufferStream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final nipicks Created 5 years, 7 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 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.
« 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