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

Unified Diff: media/filters/source_buffer_stream_unittest.cc

Issue 328223002: Fix crash caused by removing the gap at the beginning of a media segment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address CR comments. Created 6 years, 6 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 b706fb18cbbe70482a1a2d2b169672a0f76d7105..50efdacd4f2bdd93007bec10bec8070bd9096095 100644
--- a/media/filters/source_buffer_stream_unittest.cc
+++ b/media/filters/source_buffer_stream_unittest.cc
@@ -3562,6 +3562,36 @@ TEST_F(SourceBufferStreamTest,
CheckExpectedBuffers("90K 121 151");
}
+TEST_F(SourceBufferStreamTest, Remove_GapAtBeginningOfMediaSegment) {
+ Seek(0);
+
+ // Append a media segment that has a gap at the beginning of it.
+ NewSegmentAppend(base::TimeDelta::FromMilliseconds(0),
+ "30K 60 90 120K 150");
+ CheckExpectedRangesByTimestamp("{ [0,180) }");
+
+ // Remove the gap that doesn't contain any buffers.
+ RemoveInMs(0, 10, 180);
+ CheckExpectedRangesByTimestamp("{ [10,180) }");
+
+ // Verify we still get the first buffer still since only part of
+ // the gap was removed.
+ // TODO(acolwell/wolenetz): Consider not returning a buffer at this
+ // point since the current seek position has been explicitly
+ // removed but didn't happen to remove any buffers.
+ // http://crbug.com/384016
+ CheckExpectedBuffers("30K");
+
+ // Remove a range that includes the first GOP.
+ RemoveInMs(0, 60, 180);
+
+ // Verify that no buffer is returned because the current buffer
+ // position has been removed.
+ CheckNoNextBuffer();
+
+ CheckExpectedRangesByTimestamp("{ [120,180) }");
+}
+
TEST_F(SourceBufferStreamTest, Text_Append_SingleRange) {
SetTextStream();
NewSegmentAppend("0K 500K 1000K");
« 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