Index: media/filters/chunk_demuxer_unittest.cc |
diff --git a/media/filters/chunk_demuxer_unittest.cc b/media/filters/chunk_demuxer_unittest.cc |
index 3bca45f646b51bb66089490e565e3680dc6f5841..ad1e56fdcc7d10cd0a56337e6b17f0ab03f0625a 100644 |
--- a/media/filters/chunk_demuxer_unittest.cc |
+++ b/media/filters/chunk_demuxer_unittest.cc |
@@ -880,6 +880,23 @@ class ChunkDemuxerTest : public ::testing::TestWithParam<bool> { |
if (i > 0) |
ss << " "; |
ss << buffer->timestamp().InMilliseconds(); |
+ |
+ // Handle preroll buffers. |
+ if (EndsWith(timestamps[i], "P", true)) { |
+ scoped_refptr<DecoderBuffer> preroll_buffer; |
+ preroll_buffer.swap(buffer); |
+ |
+ // When a preroll buffer is encountered we should be able to request one |
+ // more buffer. The first buffer should have a timestamp equal to the |
+ // second buffer and its discard_padding() should be its duration. |
+ stream->Read(base::Bind(&ChunkDemuxerTest::StoreStatusAndBuffer, |
+ base::Unretained(this), &status, &buffer)); |
+ base::MessageLoop::current()->RunUntilIdle(); |
+ ASSERT_EQ(preroll_buffer->timestamp(), buffer->timestamp()); |
+ ASSERT_EQ(preroll_buffer->discard_padding().first, |
+ preroll_buffer->duration()); |
+ ss << "P"; |
+ } |
} |
EXPECT_EQ(expected, ss.str()); |
} |
@@ -3059,8 +3076,8 @@ TEST_P(ChunkDemuxerTest, AppendWindow_Video) { |
ASSERT_TRUE(InitDemuxer(HAS_VIDEO)); |
DemuxerStream* stream = demuxer_->GetStream(DemuxerStream::VIDEO); |
- // Set the append window to [20,280). |
- append_window_start_for_next_append_ = base::TimeDelta::FromMilliseconds(20); |
+ // Set the append window to [50,280). |
wolenetz
2014/05/17 00:41:17
Why increase 20 -> 50? Currently, video does not s
DaleCurtis
2014/05/17 00:55:41
I changed them both because I thought it was a bet
|
+ append_window_start_for_next_append_ = base::TimeDelta::FromMilliseconds(50); |
append_window_end_for_next_append_ = base::TimeDelta::FromMilliseconds(280); |
// Append a cluster that starts before and ends after the append window. |
@@ -3087,8 +3104,8 @@ TEST_P(ChunkDemuxerTest, AppendWindow_Audio) { |
ASSERT_TRUE(InitDemuxer(HAS_AUDIO)); |
DemuxerStream* stream = demuxer_->GetStream(DemuxerStream::AUDIO); |
- // Set the append window to [20,280). |
- append_window_start_for_next_append_ = base::TimeDelta::FromMilliseconds(20); |
+ // Set the append window to [50,280). |
+ append_window_start_for_next_append_ = base::TimeDelta::FromMilliseconds(50); |
append_window_end_for_next_append_ = base::TimeDelta::FromMilliseconds(280); |
// Append a cluster that starts before and ends after the append window. |
@@ -3100,19 +3117,20 @@ TEST_P(ChunkDemuxerTest, AppendWindow_Audio) { |
// in the buffer. Also verify that buffers that start inside the |
// window and extend beyond the end of the window are not included. |
// |
- // The first 20ms of the first buffer should be trimmed off since it |
- // overlaps the start of the append window. |
- CheckExpectedRanges(kSourceId, "{ [20,270) }"); |
- CheckExpectedBuffers(stream, "20 30 60 90 120 150 180 210 240"); |
+ // The first 20ms of the second buffer should be trimmed off since it |
+ // overlaps the start of the append window. The first buffer should be |
+ // added as preroll to the second buffer. |
+ CheckExpectedRanges(kSourceId, "{ [50,270) }"); |
+ CheckExpectedBuffers(stream, "50P 60 90 120 150 180 210 240"); |
- // Extend the append window to [20,650). |
+ // Extend the append window to [50,650). |
append_window_end_for_next_append_ = base::TimeDelta::FromMilliseconds(650); |
// Append more data and verify that a new range is created. |
AppendSingleStreamCluster( |
kSourceId, kAudioTrackNum, |
"360K 390K 420K 450K 480K 510K 540K 570K 600K 630K"); |
- CheckExpectedRanges(kSourceId, "{ [20,270) [360,630) }"); |
+ CheckExpectedRanges(kSourceId, "{ [50,270) [360,630) }"); |
} |
TEST_P(ChunkDemuxerTest, AppendWindow_AudioOverlapStartAndEnd) { |