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

Unified Diff: media/filters/chunk_demuxer_unittest.cc

Issue 328653002: Fix WebMStreamParser to continue parsing after a cluster end (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « no previous file | media/formats/webm/cluster_builder.h » ('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 294d7692535b9f9a7ae0b78c969a4cce7811867b..74f2a01176fccd1e1e327f7c31699ea370043462 100644
--- a/media/filters/chunk_demuxer_unittest.cc
+++ b/media/filters/chunk_demuxer_unittest.cc
@@ -673,6 +673,13 @@ class ChunkDemuxerTest : public ::testing::TestWithParam<bool> {
scoped_ptr<Cluster> GenerateCluster(int first_audio_timecode,
int first_video_timecode,
int block_count) {
+ return GenerateCluster(first_audio_timecode, first_video_timecode,
+ block_count, false);
+ }
+ scoped_ptr<Cluster> GenerateCluster(int first_audio_timecode,
+ int first_video_timecode,
+ int block_count,
+ bool unknown_size) {
CHECK_GT(block_count, 0);
int size = 10;
@@ -722,7 +729,7 @@ class ChunkDemuxerTest : public ::testing::TestWithParam<bool> {
kWebMFlagKeyframe, data.get(), size);
}
- return cb.Finish();
+ return unknown_size ? cb.FinishWithUnknownSize() : cb.Finish();
}
scoped_ptr<Cluster> GenerateSingleStreamCluster(int timecode,
@@ -2893,11 +2900,14 @@ TEST_P(ChunkDemuxerTest, EmitBuffersDuringAbort) {
#endif
TEST_P(ChunkDemuxerTest, WebMIsParsingMediaSegmentDetection) {
- // TODO(wolenetz): Also test 'unknown' sized clusters.
- // See http://crbug.com/335676.
const uint8 kBuffer[] = {
0x1F, 0x43, 0xB6, 0x75, 0x83, // CLUSTER (size = 3)
0xE7, 0x81, 0x01, // Cluster TIMECODE (value = 1)
+
+ 0x1F, 0x43, 0xB6, 0x75, 0xFF, // CLUSTER (size = unknown; really 3 due to:)
+ 0xE7, 0x81, 0x02, // Cluster TIMECODE (value = 2)
+ /* e.g. put some blocks here... */
+ 0x1A, 0x45, 0xDF, 0xA3, 0x8A, // EBMLHEADER (size = 10, not fully appended)
};
// This array indicates expected return value of IsParsingMediaSegment()
@@ -2905,6 +2915,11 @@ TEST_P(ChunkDemuxerTest, WebMIsParsingMediaSegmentDetection) {
const bool kExpectedReturnValues[] = {
false, false, false, false, true,
true, true, false,
+
+ false, false, false, false, true,
+ true, true, true,
+
+ true, true, true, true, false,
};
COMPILE_ASSERT(arraysize(kBuffer) == arraysize(kExpectedReturnValues),
@@ -3454,6 +3469,17 @@ TEST_P(ChunkDemuxerTest, SeekCompletesWithoutTextCues) {
CheckExpectedBuffers(video_stream, "180 210");
}
+TEST_P(ChunkDemuxerTest, ClusterWithUnknownSize) {
+ ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO));
+
+ AppendCluster(GenerateCluster(0, 0, 4, true));
+ CheckExpectedRanges(kSourceId, "{ [0,46) }");
+
+ // A new cluster indicates end of the previous cluster with unknown size.
+ AppendCluster(GenerateCluster(46, 66, 5, true));
+ CheckExpectedRanges(kSourceId, "{ [0,115) }");
+}
+
// Generate two sets of tests: one using FrameProcessor, and one using
// LegacyFrameProcessor.
INSTANTIATE_TEST_CASE_P(NewFrameProcessor, ChunkDemuxerTest, Values(false));
« no previous file with comments | « no previous file | media/formats/webm/cluster_builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698