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

Side by Side Diff: media/filters/chunk_demuxer_unittest.cc

Issue 322273003: MSE: On init segment received, set need random access point flag on all track buffers (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/filters/chunk_demuxer.cc ('k') | media/filters/frame_processor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm> 5 #include <algorithm>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 AppendSingleStreamCluster(kSourceId, kAlternateTextTrackNum, "45K"); 1216 AppendSingleStreamCluster(kSourceId, kAlternateTextTrackNum, "45K");
1217 1217
1218 CheckExpectedRanges(kSourceId, "{ [0,92) }"); 1218 CheckExpectedRanges(kSourceId, "{ [0,92) }");
1219 CheckExpectedBuffers(audio_stream, "0 23 46 69"); 1219 CheckExpectedBuffers(audio_stream, "0 23 46 69");
1220 CheckExpectedBuffers(video_stream, "0 30 60"); 1220 CheckExpectedBuffers(video_stream, "0 30 60");
1221 CheckExpectedBuffers(text_stream, "10 45"); 1221 CheckExpectedBuffers(text_stream, "10 45");
1222 1222
1223 ShutdownDemuxer(); 1223 ShutdownDemuxer();
1224 } 1224 }
1225 1225
1226 TEST_P(ChunkDemuxerTest, InitSegmentSetsNeedRandomAccessPointFlag) {
1227 // Tests that non-keyframes following an init segment are allowed
1228 // and dropped, as expected if the initialization segment received
1229 // algorithm correctly sets the needs random access point flag to true for all
1230 // track buffers. Note that the first initialization segment is insufficient
1231 // to fully test this since needs random access point flag initializes to
1232 // true.
1233 CreateNewDemuxer();
1234 DemuxerStream* text_stream = NULL;
1235 EXPECT_CALL(host_, AddTextStream(_, _))
1236 .WillOnce(SaveArg<0>(&text_stream));
1237 ASSERT_TRUE(InitDemuxerWithEncryptionInfo(
1238 HAS_TEXT | HAS_AUDIO | HAS_VIDEO, false, false));
1239 DemuxerStream* audio_stream = demuxer_->GetStream(DemuxerStream::AUDIO);
1240 DemuxerStream* video_stream = demuxer_->GetStream(DemuxerStream::VIDEO);
1241 ASSERT_TRUE(audio_stream && video_stream && text_stream);
1242
1243 AppendSingleStreamCluster(kSourceId, kAudioTrackNum, "0 23K");
1244 AppendSingleStreamCluster(kSourceId, kVideoTrackNum, "0 30K");
1245 AppendSingleStreamCluster(kSourceId, kTextTrackNum, "0 40K");
1246 CheckExpectedRanges(kSourceId, "{ [30,46) }");
1247
1248 AppendInitSegment(HAS_TEXT | HAS_AUDIO | HAS_VIDEO);
1249 AppendSingleStreamCluster(kSourceId, kAudioTrackNum, "46 69K");
1250 AppendSingleStreamCluster(kSourceId, kVideoTrackNum, "60 90K");
1251 AppendSingleStreamCluster(kSourceId, kTextTrackNum, "80 90K");
1252 CheckExpectedRanges(kSourceId, "{ [30,92) }");
1253
1254 CheckExpectedBuffers(audio_stream, "23 69");
1255 CheckExpectedBuffers(video_stream, "30 90");
1256
1257 // WebM parser marks all text buffers as keyframes.
1258 CheckExpectedBuffers(text_stream, "0 40 80 90");
1259 }
1260
1226 // Make sure that the demuxer reports an error if Shutdown() 1261 // Make sure that the demuxer reports an error if Shutdown()
1227 // is called before all the initialization segments are appended. 1262 // is called before all the initialization segments are appended.
1228 TEST_P(ChunkDemuxerTest, Shutdown_BeforeAllInitSegmentsAppended) { 1263 TEST_P(ChunkDemuxerTest, Shutdown_BeforeAllInitSegmentsAppended) {
1229 EXPECT_CALL(*this, DemuxerOpened()); 1264 EXPECT_CALL(*this, DemuxerOpened());
1230 demuxer_->Initialize( 1265 demuxer_->Initialize(
1231 &host_, CreateInitDoneCB( 1266 &host_, CreateInitDoneCB(
1232 kDefaultDuration(), DEMUXER_ERROR_COULD_NOT_OPEN), true); 1267 kDefaultDuration(), DEMUXER_ERROR_COULD_NOT_OPEN), true);
1233 1268
1234 EXPECT_EQ(AddId("audio", HAS_AUDIO), ChunkDemuxer::kOk); 1269 EXPECT_EQ(AddId("audio", HAS_AUDIO), ChunkDemuxer::kOk);
1235 EXPECT_EQ(AddId("video", HAS_VIDEO), ChunkDemuxer::kOk); 1270 EXPECT_EQ(AddId("video", HAS_VIDEO), ChunkDemuxer::kOk);
(...skipping 2182 matching lines...) Expand 10 before | Expand all | Expand 10 after
3418 CheckExpectedBuffers(audio_stream, "160 180"); 3453 CheckExpectedBuffers(audio_stream, "160 180");
3419 CheckExpectedBuffers(video_stream, "180 210"); 3454 CheckExpectedBuffers(video_stream, "180 210");
3420 } 3455 }
3421 3456
3422 // Generate two sets of tests: one using FrameProcessor, and one using 3457 // Generate two sets of tests: one using FrameProcessor, and one using
3423 // LegacyFrameProcessor. 3458 // LegacyFrameProcessor.
3424 INSTANTIATE_TEST_CASE_P(NewFrameProcessor, ChunkDemuxerTest, Values(false)); 3459 INSTANTIATE_TEST_CASE_P(NewFrameProcessor, ChunkDemuxerTest, Values(false));
3425 INSTANTIATE_TEST_CASE_P(LegacyFrameProcessor, ChunkDemuxerTest, Values(true)); 3460 INSTANTIATE_TEST_CASE_P(LegacyFrameProcessor, ChunkDemuxerTest, Values(true));
3426 3461
3427 } // namespace media 3462 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/chunk_demuxer.cc ('k') | media/filters/frame_processor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698