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

Unified Diff: media/filters/chunk_demuxer_unittest.cc

Issue 312403002: Fix crashes caused when SourceBuffer.remove() is called starting at the presentation duration. (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/chunk_demuxer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/chunk_demuxer_unittest.cc
diff --git a/media/filters/chunk_demuxer_unittest.cc b/media/filters/chunk_demuxer_unittest.cc
index 67928e373afb7e2551613496d22343aa77317f52..7cc8fff34e63f00cf0e2e4b8f916d60a98bf2b0c 100644
--- a/media/filters/chunk_demuxer_unittest.cc
+++ b/media/filters/chunk_demuxer_unittest.cc
@@ -3030,17 +3030,6 @@ TEST_P(ChunkDemuxerTest, GCDuringSeek) {
CheckExpectedRanges(kSourceId, "{ [500,592) [792,815) }");
}
-TEST_P(ChunkDemuxerTest, RemoveBeforeInitSegment) {
- EXPECT_CALL(*this, DemuxerOpened());
- demuxer_->Initialize(
- &host_, CreateInitDoneCB(kNoTimestamp(), PIPELINE_OK), true);
-
- EXPECT_EQ(ChunkDemuxer::kOk, AddId(kSourceId, HAS_AUDIO | HAS_VIDEO));
-
- demuxer_->Remove(kSourceId, base::TimeDelta::FromMilliseconds(0),
- base::TimeDelta::FromMilliseconds(1));
-}
-
TEST_P(ChunkDemuxerTest, AppendWindow_Video) {
ASSERT_TRUE(InitDemuxer(HAS_VIDEO));
DemuxerStream* stream = demuxer_->GetStream(DemuxerStream::VIDEO);
@@ -3269,6 +3258,33 @@ TEST_P(ChunkDemuxerTest, Remove_AudioVideoText) {
CheckExpectedBuffers(text_stream, "1 101 201");
}
+TEST_P(ChunkDemuxerTest, Remove_StartAtDuration) {
+ ASSERT_TRUE(InitDemuxer(HAS_AUDIO));
+ DemuxerStream* audio_stream = demuxer_->GetStream(DemuxerStream::AUDIO);
+
+ // Set the duration to something small so that the append that
+ // follows updates the duration to reflect the end of the appended data.
+ EXPECT_CALL(host_, SetDuration(
+ base::TimeDelta::FromMilliseconds(1)));
+ demuxer_->SetDuration(0.001);
+
+ EXPECT_CALL(host_, SetDuration(
+ base::TimeDelta::FromMilliseconds(160)));
+ AppendSingleStreamCluster(kSourceId, kAudioTrackNum,
+ "0K 20K 40K 60K 80K 100K 120K 140K");
+
+ CheckExpectedRanges(kSourceId, "{ [0,160) }");
+ CheckExpectedBuffers(audio_stream, "0 20 40 60 80 100 120 140");
+
+ demuxer_->Remove(kSourceId,
+ base::TimeDelta::FromSecondsD(demuxer_->GetDuration()),
+ kInfiniteDuration());
+
+ Seek(base::TimeDelta());
+ CheckExpectedRanges(kSourceId, "{ [0,160) }");
+ CheckExpectedBuffers(audio_stream, "0 20 40 60 80 100 120 140");
+}
+
// Verifies that a Seek() will complete without text cues for
// the seek point and will return cues after the seek position
// when they are eventually appended.
« no previous file with comments | « media/filters/chunk_demuxer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698