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

Unified Diff: media/test/pipeline_integration_test.cc

Issue 1526303004: Fix buffered range updates in media::Pipeline (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added unit test Created 5 years 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
Index: media/test/pipeline_integration_test.cc
diff --git a/media/test/pipeline_integration_test.cc b/media/test/pipeline_integration_test.cc
index 755eb1a1c726215772da945399d76ff8d78b40be..f30a5e583a40b6fee8c3dcafa7bcde2acdf8ccd9 100644
--- a/media/test/pipeline_integration_test.cc
+++ b/media/test/pipeline_integration_test.cc
@@ -555,6 +555,15 @@ class MockMediaSource {
last_timestamp_offset_ = timestamp_offset;
}
+ void SetMemoryLimits(size_t limit_bytes) {
+ chunk_demuxer_->SetMemoryLimits(DemuxerStream::AUDIO, limit_bytes);
+ chunk_demuxer_->SetMemoryLimits(DemuxerStream::VIDEO, limit_bytes);
+ }
+
+ void EvictCodedFrames(base::TimeDelta currentMediaTime, size_t newDataSize) {
+ chunk_demuxer_->EvictCodedFrames(kSourceId, currentMediaTime, newDataSize);
+ }
+
void EndOfStream() {
chunk_demuxer_->MarkEndOfStream(PIPELINE_OK);
}
@@ -1083,6 +1092,38 @@ TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_WebM) {
Stop();
}
wolenetz 2016/01/06 19:28:41 I think explicit SourceBuffer.Remove() operations
servolk 2016/01/06 21:05:05 Good catch, done: added signalling from ChunkDemux
+// This test case imitates media playback with advancing media_time and
+// continuously adding new data. At some point we should reach the buffering
+// limit, after that MediaSource should evict some buffered data and that
+// evicted data shold be reflected in the change of media::Pipeline buffered
+// ranges (returned by GetBufferedTimeRanges). At that point the buffered ranges
+// will no longer start at 0.
+TEST_F(PipelineIntegrationTest, MediaSource_FillUp_Buffer) {
+ const char* input_filename = "bear-320x240.webm";
+ MockMediaSource source(input_filename, kWebM, kAppendWholeFile);
+ StartPipelineWithMediaSource(&source);
+ source.SetMemoryLimits(1048576);
+
+ scoped_refptr<DecoderBuffer> file = ReadTestDataFile(input_filename);
+
+ auto buffered_ranges = pipeline_->GetBufferedTimeRanges();
+ do {
wolenetz 2016/01/06 19:28:41 nit: before do, EXPECT_EQ(1u, buffered_ranges.size
servolk 2016/01/06 21:05:05 Done.
+ // Advance media_time to the end of the currently buffered data
+ base::TimeDelta media_time = buffered_ranges.end(0);
+ source.Seek(media_time);
+ // Ask MediaSource to evict buffered data if buffering limit has been
+ // reached (the data will be evicted from the front of the buffered range).
+ source.EvictCodedFrames(media_time, file->data_size());
+ source.AppendAtTime(media_time, file->data(), file->data_size());
+ buffered_ranges = pipeline_->GetBufferedTimeRanges();
+ } while (buffered_ranges.size() == 1 &&
+ buffered_ranges.start(0) == base::TimeDelta::FromSeconds(0));
+
+ EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
+ source.Shutdown();
+ Stop();
+}
+
#if !defined(DISABLE_EME_TESTS)
TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_Encrypted_WebM) {
MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM,
« media/base/pipeline_unittest.cc ('K') | « media/filters/ffmpeg_demuxer_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698