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

Unified Diff: media/filters/chunk_demuxer_unittest.cc

Issue 712593003: Move key frame flag from StreamParserBuffer to DecoderBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits Created 6 years, 1 month 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/audio_decoder_unittest.cc ('k') | media/filters/decrypting_demuxer_stream.cc » ('j') | 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 cc3ab630c75f530838ec481746da0cf72e3864c7..7df159e1389e7a14782814d6fd040969fad38c72 100644
--- a/media/filters/chunk_demuxer_unittest.cc
+++ b/media/filters/chunk_demuxer_unittest.cc
@@ -37,7 +37,7 @@ const uint8 kTracksHeader[] = {
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // tracks(size = 0)
};
-// WebM Block bytes that represent a VP8 keyframe.
+// WebM Block bytes that represent a VP8 key frame.
const uint8 kVP8Keyframe[] = {
0x010, 0x00, 0x00, 0x9d, 0x01, 0x2a, 0x00, 0x10, 0x00, 0x10, 0x00
};
@@ -429,9 +429,9 @@ class ChunkDemuxerTest : public ::testing::Test {
// |block_descriptions| - A space delimited string of block info that
// is used to populate |blocks|. Each block info has a timestamp in
// milliseconds and optionally followed by a 'K' to indicate that a block
- // should be marked as a keyframe. For example "0K 30 60" should populate
- // |blocks| with 3 BlockInfo objects: a keyframe with timestamp 0 and 2
- // non-keyframes at 30ms and 60ms.
+ // should be marked as a key frame. For example "0K 30 60" should populate
+ // |blocks| with 3 BlockInfo objects: a key frame with timestamp 0 and 2
+ // non-key-frames at 30ms and 60ms.
void ParseBlockDescriptions(int track_number,
const std::string block_descriptions,
std::vector<BlockInfo>* blocks) {
@@ -457,8 +457,8 @@ class ChunkDemuxerTest : public ::testing::Test {
block_info.duration = kTextBlockDuration;
ASSERT_EQ(kWebMFlagKeyframe, block_info.flags)
<< "Text block with timestamp " << block_info.timestamp_in_ms
- << " was not marked as a keyframe."
- << " All text blocks must be keyframes";
+ << " was not marked as a key frame."
+ << " All text blocks must be key frames";
}
if (track_number == kAudioTrackNum)
@@ -841,7 +841,7 @@ class ChunkDemuxerTest : public ::testing::Test {
int video_timecode = first_video_timecode;
// Create simple blocks for everything except the last 2 blocks.
- // The first video frame must be a keyframe.
+ // The first video frame must be a key frame.
uint8 video_flag = kWebMFlagKeyframe;
for (int i = 0; i < block_count - 2; i++) {
if (audio_timecode <= video_timecode) {
@@ -1074,6 +1074,9 @@ class ChunkDemuxerTest : public ::testing::Test {
ss << " ";
ss << buffer->timestamp().InMilliseconds();
+ if (buffer->is_key_frame())
+ ss << "K";
+
// Handle preroll buffers.
if (EndsWith(timestamps[i], "P", true)) {
ASSERT_EQ(kInfiniteDuration(), buffer->discard_padding().first);
@@ -1384,15 +1387,15 @@ TEST_F(ChunkDemuxerTest, SingleTextTrackIdChange) {
MuxedStreamInfo(kAlternateTextTrackNum, "45K"));
CheckExpectedRanges(kSourceId, "{ [0,92) }");
- CheckExpectedBuffers(audio_stream, "0 23 46 69");
- CheckExpectedBuffers(video_stream, "0 30 60");
- CheckExpectedBuffers(text_stream, "10 45");
+ CheckExpectedBuffers(audio_stream, "0K 23K 46K 69K");
+ CheckExpectedBuffers(video_stream, "0K 30 60K");
+ CheckExpectedBuffers(text_stream, "10K 45K");
ShutdownDemuxer();
}
TEST_F(ChunkDemuxerTest, InitSegmentSetsNeedRandomAccessPointFlag) {
- // Tests that non-keyframes following an init segment are allowed
+ // Tests that non-key-frames following an init segment are allowed
// and dropped, as expected if the initialization segment received
// algorithm correctly sets the needs random access point flag to true for all
// track buffers. Note that the first initialization segment is insufficient
@@ -1422,9 +1425,9 @@ TEST_F(ChunkDemuxerTest, InitSegmentSetsNeedRandomAccessPointFlag) {
MuxedStreamInfo(kTextTrackNum, "80K 90K"));
CheckExpectedRanges(kSourceId, "{ [23,92) }");
- CheckExpectedBuffers(audio_stream, "23 46 69");
- CheckExpectedBuffers(video_stream, "30 90");
- CheckExpectedBuffers(text_stream, "25 40 80 90");
+ CheckExpectedBuffers(audio_stream, "23K 46K 69K");
+ CheckExpectedBuffers(video_stream, "30K 90K");
+ CheckExpectedBuffers(text_stream, "25K 40K 80K 90K");
}
// Make sure that the demuxer reports an error if Shutdown()
@@ -3409,13 +3412,13 @@ TEST_F(ChunkDemuxerTest, AppendWindow_Video) {
// in the buffer. Also verify that buffers that start inside the
// window and extend beyond the end of the window are not included.
CheckExpectedRanges(kSourceId, "{ [120,270) }");
- CheckExpectedBuffers(stream, "120 150 180 210 240");
+ CheckExpectedBuffers(stream, "120K 150 180 210 240K");
// Extend the append window to [50,650).
append_window_end_for_next_append_ = base::TimeDelta::FromMilliseconds(650);
// Append more data and verify that adding buffers start at the next
- // keyframe.
+ // key frame.
AppendSingleStreamCluster(kSourceId, kVideoTrackNum,
"360 390 420K 450 480 510 540K 570 600 630K");
CheckExpectedRanges(kSourceId, "{ [120,270) [420,630) }");
@@ -3444,7 +3447,7 @@ TEST_F(ChunkDemuxerTest, AppendWindow_Audio) {
// The "50P" buffer is the "0" buffer marked for complete discard. The next
// "50" buffer is the "30" buffer marked with 20ms of start discard.
- CheckExpectedBuffers(stream, "50P 50 60 90 120 150 180 210 240");
+ CheckExpectedBuffers(stream, "50KP 50K 60K 90K 120K 150K 180K 210K 240K");
// Extend the append window to [50,650).
append_window_end_for_next_append_ = base::TimeDelta::FromMilliseconds(650);
@@ -3491,7 +3494,7 @@ TEST_F(ChunkDemuxerTest, AppendWindow_WebMFile_AudioOnly) {
AppendDataInPieces(buffer->data(), buffer->data_size(), 128);
DemuxerStream* stream = demuxer_->GetStream(DemuxerStream::AUDIO);
- CheckExpectedBuffers(stream, "50P 50 62 86 109 122 125 128");
+ CheckExpectedBuffers(stream, "50KP 50K 62K 86K 109K 122K 125K 128K");
}
TEST_F(ChunkDemuxerTest, AppendWindow_AudioConfigUpdateRemovesPreroll) {
@@ -3533,7 +3536,7 @@ TEST_F(ChunkDemuxerTest, AppendWindow_AudioConfigUpdateRemovesPreroll) {
Seek(duration_1);
ExpectConfigChanged(DemuxerStream::AUDIO);
ASSERT_FALSE(config_1.Matches(stream->audio_decoder_config()));
- CheckExpectedBuffers(stream, "2746 2767 2789 2810");
+ CheckExpectedBuffers(stream, "2746K 2767K 2789K 2810K");
}
TEST_F(ChunkDemuxerTest, AppendWindow_Text) {
@@ -3558,8 +3561,8 @@ TEST_F(ChunkDemuxerTest, AppendWindow_Text) {
// in the buffer. Also verify that cues that extend beyond the
// window are not included.
CheckExpectedRanges(kSourceId, "{ [100,270) }");
- CheckExpectedBuffers(video_stream, "120 150 180 210 240");
- CheckExpectedBuffers(text_stream, "100");
+ CheckExpectedBuffers(video_stream, "120K 150 180 210 240K");
+ CheckExpectedBuffers(text_stream, "100K");
// Extend the append window to [20,650).
append_window_end_for_next_append_ = base::TimeDelta::FromMilliseconds(650);
@@ -3573,8 +3576,8 @@ TEST_F(ChunkDemuxerTest, AppendWindow_Text) {
// Seek to the new range and verify that the expected buffers are returned.
Seek(base::TimeDelta::FromMilliseconds(420));
- CheckExpectedBuffers(video_stream, "420 450 480 510 540 570 600");
- CheckExpectedBuffers(text_stream, "400 500");
+ CheckExpectedBuffers(video_stream, "420K 450 480 510 540K 570 600");
+ CheckExpectedBuffers(text_stream, "400K 500K");
}
TEST_F(ChunkDemuxerTest, StartWaitingForSeekAfterParseError) {
@@ -3599,9 +3602,9 @@ TEST_F(ChunkDemuxerTest, Remove_AudioVideoText) {
MuxedStreamInfo(kVideoTrackNum, "0K 30 60 90 120K 150 180"),
MuxedStreamInfo(kTextTrackNum, "0K 100K 200K"));
- CheckExpectedBuffers(audio_stream, "0 20 40 60 80 100 120 140");
- CheckExpectedBuffers(video_stream, "0 30 60 90 120 150 180");
- CheckExpectedBuffers(text_stream, "0 100 200");
+ CheckExpectedBuffers(audio_stream, "0K 20K 40K 60K 80K 100K 120K 140K");
+ CheckExpectedBuffers(video_stream, "0K 30 60 90 120K 150 180");
+ CheckExpectedBuffers(text_stream, "0K 100K 200K");
// Remove the buffers that were added.
demuxer_->Remove(kSourceId, base::TimeDelta(),
@@ -3618,9 +3621,9 @@ TEST_F(ChunkDemuxerTest, Remove_AudioVideoText) {
MuxedStreamInfo(kTextTrackNum, "1K 101K 201K"));
Seek(base::TimeDelta());
- CheckExpectedBuffers(audio_stream, "1 21 41 61 81 101 121 141");
- CheckExpectedBuffers(video_stream, "1 31 61 91 121 151 181");
- CheckExpectedBuffers(text_stream, "1 101 201");
+ CheckExpectedBuffers(audio_stream, "1K 21K 41K 61K 81K 101K 121K 141K");
+ CheckExpectedBuffers(video_stream, "1K 31 61 91 121K 151 181");
+ CheckExpectedBuffers(text_stream, "1K 101K 201K");
}
TEST_F(ChunkDemuxerTest, Remove_StartAtDuration) {
@@ -3639,7 +3642,7 @@ TEST_F(ChunkDemuxerTest, Remove_StartAtDuration) {
"0K 20K 40K 60K 80K 100K 120K 140K");
CheckExpectedRanges(kSourceId, "{ [0,160) }");
- CheckExpectedBuffers(audio_stream, "0 20 40 60 80 100 120 140");
+ CheckExpectedBuffers(audio_stream, "0K 20K 40K 60K 80K 100K 120K 140K");
demuxer_->Remove(kSourceId,
base::TimeDelta::FromSecondsD(demuxer_->GetDuration()),
@@ -3647,7 +3650,7 @@ TEST_F(ChunkDemuxerTest, Remove_StartAtDuration) {
Seek(base::TimeDelta());
CheckExpectedRanges(kSourceId, "{ [0,160) }");
- CheckExpectedBuffers(audio_stream, "0 20 40 60 80 100 120 140");
+ CheckExpectedBuffers(audio_stream, "0K 20K 40K 60K 80K 100K 120K 140K");
}
// Verifies that a Seek() will complete without text cues for
@@ -3687,8 +3690,8 @@ TEST_F(ChunkDemuxerTest, SeekCompletesWithoutTextCues) {
EXPECT_FALSE(text_read_done);
// Read some audio & video buffers to further verify seek completion.
- CheckExpectedBuffers(audio_stream, "120 140");
- CheckExpectedBuffers(video_stream, "120 150");
+ CheckExpectedBuffers(audio_stream, "120K 140K");
+ CheckExpectedBuffers(video_stream, "120K 150");
EXPECT_FALSE(text_read_done);
@@ -3704,10 +3707,10 @@ TEST_F(ChunkDemuxerTest, SeekCompletesWithoutTextCues) {
// NOTE: we start at 275 here because the buffer at 225 was returned
// to the pending read initiated above.
- CheckExpectedBuffers(text_stream, "275 325");
+ CheckExpectedBuffers(text_stream, "275K 325K");
// Verify that audio & video streams continue to return expected values.
- CheckExpectedBuffers(audio_stream, "160 180");
+ CheckExpectedBuffers(audio_stream, "160K 180K");
CheckExpectedBuffers(video_stream, "180 210");
}
« no previous file with comments | « media/filters/audio_decoder_unittest.cc ('k') | media/filters/decrypting_demuxer_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698