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

Unified Diff: media/test/pipeline_integration_test.cc

Issue 2827983004: Fix MSE garbage collection for disabled media tracks (Closed)
Patch Set: Created 3 years, 8 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
« media/filters/chunk_demuxer.cc ('K') | « media/filters/source_buffer_state.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/test/pipeline_integration_test.cc
diff --git a/media/test/pipeline_integration_test.cc b/media/test/pipeline_integration_test.cc
index d51bb2eaddd7c0b3f4ac3bedffc422030c584055..3b57543f1de7b0e74a2b8dc787bd1a051cad3310 100644
--- a/media/test/pipeline_integration_test.cc
+++ b/media/test/pipeline_integration_test.cc
@@ -540,8 +540,9 @@ class MockMediaSource {
chunk_demuxer_->SetMemoryLimitsForTest(DemuxerStream::VIDEO, limit_bytes);
}
- void EvictCodedFrames(base::TimeDelta currentMediaTime, size_t newDataSize) {
- chunk_demuxer_->EvictCodedFrames(kSourceId, currentMediaTime, newDataSize);
+ bool EvictCodedFrames(base::TimeDelta currentMediaTime, size_t newDataSize) {
+ return chunk_demuxer_->EvictCodedFrames(kSourceId, currentMediaTime,
+ newDataSize);
}
void RemoveRange(base::TimeDelta start, base::TimeDelta end) {
@@ -1565,6 +1566,36 @@ TEST_F(PipelineIntegrationTest, MediaSource_FillUp_Buffer) {
Stop();
}
+TEST_F(PipelineIntegrationTest, MediaSource_GCWithDisabledVideoStream) {
+ const char* input_filename = "bear-320x240.webm";
+ MockMediaSource source(input_filename, kWebM, kAppendWholeFile);
+ EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source));
+ scoped_refptr<DecoderBuffer> file = ReadTestDataFile(input_filename);
+ // The input file contains audio + video data. Assuming video data size is
+ // larger than audio, so setting memory limits to half of file data_size will
+ // ensure that video SourceBuffer is above memory limit and the audio
+ // SourceBuffer is below the memory limit.
+ source.SetMemoryLimits(file->data_size() / 2);
+
+ // Disable the video track and start playback. Renderer won't read from the
+ // disabled video stream, so the video stream read position should be 0.
+ pipeline_->OnSelectedVideoTrackChanged(base::nullopt);
+ Play();
+
+ // Wait until audio playback advances past 2 seconds and call MSE GC algorithm
+ // to prepare for more data to be appended.
+ base::TimeDelta media_time = base::TimeDelta::FromSeconds(2);
+ ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(media_time));
+ // At this point the video SourceBuffer is over the memory limit (see the
+ // SetMemoryLimits comment above), but MSE GC should be able to remove some
+ // of video data and return true indicating success, even though no data has
+ // been read from the disabled video stream and its read position is 0.
+ ASSERT_TRUE(source.EvictCodedFrames(media_time, 10));
+
+ source.Shutdown();
+ Stop();
+}
+
TEST_F(PipelineIntegrationTest,
MAYBE_EME(MediaSource_ConfigChange_Encrypted_WebM)) {
MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM,
« media/filters/chunk_demuxer.cc ('K') | « media/filters/source_buffer_state.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698