OLD | NEW |
---|---|
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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
390 block_duration = kTextBlockDuration; | 390 block_duration = kTextBlockDuration; |
391 break; | 391 break; |
392 } | 392 } |
393 ASSERT_NE(block_duration, 0); | 393 ASSERT_NE(block_duration, 0); |
394 int end_timecode = timecode + block_count * block_duration; | 394 int end_timecode = timecode + block_count * block_duration; |
395 AppendCluster(source_id, | 395 AppendCluster(source_id, |
396 GenerateSingleStreamCluster( | 396 GenerateSingleStreamCluster( |
397 timecode, end_timecode, track_number, block_duration)); | 397 timecode, end_timecode, track_number, block_duration)); |
398 } | 398 } |
399 | 399 |
400 // |cluster_description| - A space delimited string of buffer info that | 400 struct BlockInfo { |
401 // is used to construct a cluster. Each buffer info is a timestamp in | 401 int track_number; |
402 // milliseconds and optionally followed by a 'K' to indicate that a buffer | 402 int timestamp_in_ms; |
403 // should be marked as a keyframe. For example "0K 30 60" should constuct | 403 int flags; |
404 // a cluster with 3 blocks: a keyframe with timestamp 0 and 2 non-keyframes | 404 int duration; |
405 // at 30ms and 60ms. | 405 |
406 void AppendSingleStreamCluster(const std::string& source_id, int track_number, | 406 bool operator< (const BlockInfo& rhs) const { |
407 const std::string& cluster_description) { | 407 // We want pop() to return blocks in timestamp increasing order |
wolenetz
2014/07/08 19:33:53
nit: This could become confusing later if BlockInf
acolwell GONE FROM CHROMIUM
2014/07/08 22:00:38
Done.
| |
408 // so timestamps with lower values have higher priority. | |
409 return timestamp_in_ms > rhs.timestamp_in_ms; | |
410 } | |
411 }; | |
412 | |
413 // |track_number| - The track number to place in | |
414 // |blocks_description| - A space delimited string of block info that | |
415 // is used to populate |blocks|. Each block info has a timestamp in | |
416 // milliseconds and optionally followed by a 'K' to indicate that a block | |
417 // should be marked as a keyframe. For example "0K 30 60" should populate | |
418 // |blocks| with 3 BlockInfo objects: a keyframe with timestamp 0 |and 2 | |
wolenetz
2014/07/08 19:33:53
nit: s/|and/and
acolwell GONE FROM CHROMIUM
2014/07/08 22:00:38
Done.
| |
419 // non-keyframes at 30ms and 60ms. | |
420 void ParseBlockDescription(int track_number, | |
421 const std::string blocks_description, | |
422 std::vector<BlockInfo>* blocks) { | |
408 std::vector<std::string> timestamps; | 423 std::vector<std::string> timestamps; |
409 base::SplitString(cluster_description, ' ', ×tamps); | 424 base::SplitString(blocks_description, ' ', ×tamps); |
410 | 425 |
411 ClusterBuilder cb; | |
412 std::vector<uint8> data(10); | |
413 for (size_t i = 0; i < timestamps.size(); ++i) { | 426 for (size_t i = 0; i < timestamps.size(); ++i) { |
414 std::string timestamp_str = timestamps[i]; | 427 std::string timestamp_str = timestamps[i]; |
415 int block_flags = 0; | 428 BlockInfo block_info; |
429 | |
430 block_info.track_number = track_number; | |
431 block_info.flags = 0; | |
432 block_info.duration = 0; | |
433 | |
416 if (EndsWith(timestamp_str, "K", true)) { | 434 if (EndsWith(timestamp_str, "K", true)) { |
417 block_flags = kWebMFlagKeyframe; | 435 block_info.flags = kWebMFlagKeyframe; |
418 // Remove the "K" off of the token. | 436 // Remove the "K" off of the token. |
419 timestamp_str = timestamp_str.substr(0, timestamps[i].length() - 1); | 437 timestamp_str = timestamp_str.substr(0, timestamps[i].length() - 1); |
420 } | 438 } |
421 int timestamp_in_ms; | 439 CHECK(base::StringToInt(timestamp_str, &block_info.timestamp_in_ms)); |
422 CHECK(base::StringToInt(timestamp_str, ×tamp_in_ms)); | |
423 | |
424 if (i == 0) | |
425 cb.SetClusterTimecode(timestamp_in_ms); | |
426 | 440 |
427 if (track_number == kTextTrackNum || | 441 if (track_number == kTextTrackNum || |
428 track_number == kAlternateTextTrackNum) { | 442 track_number == kAlternateTextTrackNum) { |
429 cb.AddBlockGroup(track_number, timestamp_in_ms, kTextBlockDuration, | 443 block_info.duration = kTextBlockDuration; |
430 block_flags, &data[0], data.size()); | 444 ASSERT_EQ(block_info.flags, kWebMFlagKeyframe) |
wolenetz
2014/07/08 19:33:53
nit: ASSERT_EQ(expected, actual) per https://code.
acolwell GONE FROM CHROMIUM
2014/07/08 22:00:37
Done.
/me shakes fist at junit.
| |
445 << "Text block with timestamp " << block_info.timestamp_in_ms | |
446 << " was not marked as a keyframe." | |
447 << " All text blocks must be keyframes"; | |
448 } | |
449 | |
450 blocks->push_back(block_info); | |
451 } | |
452 } | |
453 | |
454 scoped_ptr<Cluster> GenerateCluster(const std::vector<BlockInfo>& blocks) { | |
455 ClusterBuilder cb; | |
wolenetz
2014/07/08 19:33:53
nit: Add ASSERT_LT(0, blocks.size()); since we won
acolwell GONE FROM CHROMIUM
2014/07/08 22:00:38
Done.
| |
456 | |
457 std::vector<uint8> data(10); | |
458 for (size_t i = 0; i < blocks.size(); ++i) { | |
459 if (i == 0) | |
460 cb.SetClusterTimecode(blocks[i].timestamp_in_ms); | |
461 | |
462 if (blocks[i].duration) { | |
463 cb.AddBlockGroup(blocks[i].track_number, blocks[i].timestamp_in_ms, | |
464 blocks[i].duration, blocks[i].flags, | |
465 &data[0], data.size()); | |
431 } else { | 466 } else { |
432 cb.AddSimpleBlock(track_number, timestamp_in_ms, block_flags, | 467 cb.AddSimpleBlock(blocks[i].track_number, blocks[i].timestamp_in_ms, |
468 blocks[i].flags, | |
433 &data[0], data.size()); | 469 &data[0], data.size()); |
434 } | 470 } |
435 } | 471 } |
436 AppendCluster(source_id, cb.Finish()); | 472 |
473 return cb.Finish(); | |
474 } | |
475 | |
476 // |block_description| - The block description used to construct the cluster. | |
477 // See the documentation for ParseBlockDescription() for details on the string | |
478 // format. | |
479 void AppendSingleStreamCluster(const std::string& source_id, int track_number, | |
480 const std::string& block_description) { | |
481 std::vector<BlockInfo> blocks; | |
482 ParseBlockDescription(track_number, block_description, &blocks); | |
483 AppendCluster(source_id, GenerateCluster(blocks)); | |
437 } | 484 } |
438 | 485 |
439 struct MuxedStreamInfo { | 486 struct MuxedStreamInfo { |
440 MuxedStreamInfo() | 487 MuxedStreamInfo() |
441 : track_number(0), | 488 : track_number(0), |
442 cluster_description("") | 489 block_description("") |
443 {} | 490 {} |
444 | 491 |
445 MuxedStreamInfo(int track_num, const char* cluster_desc) | 492 MuxedStreamInfo(int track_num, const char* block_desc) |
446 : track_number(track_num), | 493 : track_number(track_num), |
447 cluster_description(cluster_desc) { | 494 block_description(block_desc) { |
448 } | 495 } |
449 | 496 |
450 int track_number; | 497 int track_number; |
451 // The cluster description passed to AppendSingleStreamCluster(). | 498 // The block description passed to ParseBlockDescription(). |
452 // See the documentation for that method for details on the string format. | 499 // See the documentation for that method for details on the string format. |
453 const char* cluster_description; | 500 const char* block_description; |
wolenetz
2014/07/08 19:33:53
nit: s/block_description/block_descriptions or blo
acolwell GONE FROM CHROMIUM
2014/07/08 22:00:38
Done.
| |
454 }; | 501 }; |
455 | 502 |
456 void AppendMuxedCluster(const MuxedStreamInfo& msi_1, | 503 void AppendMuxedCluster(const MuxedStreamInfo& msi_1, |
457 const MuxedStreamInfo& msi_2) { | 504 const MuxedStreamInfo& msi_2) { |
458 std::vector<MuxedStreamInfo> msi(2); | 505 std::vector<MuxedStreamInfo> msi(2); |
459 msi[0] = msi_1; | 506 msi[0] = msi_1; |
460 msi[1] = msi_2; | 507 msi[1] = msi_2; |
461 AppendMuxedCluster(msi); | 508 AppendMuxedCluster(msi); |
462 } | 509 } |
463 | 510 |
464 void AppendMuxedCluster(const MuxedStreamInfo& msi_1, | 511 void AppendMuxedCluster(const MuxedStreamInfo& msi_1, |
465 const MuxedStreamInfo& msi_2, | 512 const MuxedStreamInfo& msi_2, |
466 const MuxedStreamInfo& msi_3) { | 513 const MuxedStreamInfo& msi_3) { |
467 std::vector<MuxedStreamInfo> msi(3); | 514 std::vector<MuxedStreamInfo> msi(3); |
468 msi[0] = msi_1; | 515 msi[0] = msi_1; |
469 msi[1] = msi_2; | 516 msi[1] = msi_2; |
470 msi[2] = msi_3; | 517 msi[2] = msi_3; |
471 AppendMuxedCluster(msi); | 518 AppendMuxedCluster(msi); |
472 } | 519 } |
473 | 520 |
474 void AppendMuxedCluster(const std::vector<MuxedStreamInfo> msi) { | 521 void AppendMuxedCluster(const std::vector<MuxedStreamInfo> msi) { |
522 std::priority_queue<BlockInfo> block_queue; | |
475 for (size_t i = 0; i < msi.size(); ++i) { | 523 for (size_t i = 0; i < msi.size(); ++i) { |
476 AppendSingleStreamCluster(kSourceId, | 524 std::vector<BlockInfo> track_blocks; |
477 msi[i].track_number, | 525 ParseBlockDescription(msi[i].track_number, msi[i].block_description, |
478 msi[i].cluster_description); | 526 &track_blocks); |
527 | |
528 for (size_t j = 0; j < track_blocks.size(); ++j) | |
529 block_queue.push(track_blocks[j]); | |
479 } | 530 } |
531 | |
532 std::vector<BlockInfo> blocks(block_queue.size()); | |
533 for (size_t i = 0; !block_queue.empty(); ++i) { | |
534 blocks[i] = block_queue.top(); | |
535 block_queue.pop(); | |
536 } | |
537 | |
538 AppendCluster(kSourceId, GenerateCluster(blocks)); | |
480 } | 539 } |
481 | 540 |
482 void AppendData(const std::string& source_id, | 541 void AppendData(const std::string& source_id, |
483 const uint8* data, size_t length) { | 542 const uint8* data, size_t length) { |
484 EXPECT_CALL(host_, AddBufferedTimeRange(_, _)).Times(AnyNumber()); | 543 EXPECT_CALL(host_, AddBufferedTimeRange(_, _)).Times(AnyNumber()); |
485 | 544 |
486 demuxer_->AppendData(source_id, data, length, | 545 demuxer_->AppendData(source_id, data, length, |
487 append_window_start_for_next_append_, | 546 append_window_start_for_next_append_, |
488 append_window_end_for_next_append_, | 547 append_window_end_for_next_append_, |
489 ×tamp_offset_map_[source_id]); | 548 ×tamp_offset_map_[source_id]); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
708 sizeof(kVP8Interframe); | 767 sizeof(kVP8Interframe); |
709 cb->AddBlockGroup(track_num, timecode, duration, flags, data, size); | 768 cb->AddBlockGroup(track_num, timecode, duration, flags, data, size); |
710 } | 769 } |
711 | 770 |
712 scoped_ptr<Cluster> GenerateCluster(int first_audio_timecode, | 771 scoped_ptr<Cluster> GenerateCluster(int first_audio_timecode, |
713 int first_video_timecode, | 772 int first_video_timecode, |
714 int block_count) { | 773 int block_count) { |
715 return GenerateCluster(first_audio_timecode, first_video_timecode, | 774 return GenerateCluster(first_audio_timecode, first_video_timecode, |
716 block_count, false); | 775 block_count, false); |
717 } | 776 } |
718 scoped_ptr<Cluster> GenerateCluster(int first_audio_timecode, | 777 scoped_ptr<Cluster> GenerateCluster(int first_audio_timecode, |
wolenetz
2014/07/08 19:33:53
We also have this version of GenerateCluster that
acolwell GONE FROM CHROMIUM
2014/07/08 22:00:38
Done. Converted this method to use BlockInfo to ge
| |
719 int first_video_timecode, | 778 int first_video_timecode, |
720 int block_count, | 779 int block_count, |
721 bool unknown_size) { | 780 bool unknown_size) { |
722 CHECK_GT(block_count, 0); | 781 CHECK_GT(block_count, 0); |
723 | 782 |
724 int size = 10; | 783 int size = 10; |
725 scoped_ptr<uint8[]> data(new uint8[size]); | 784 scoped_ptr<uint8[]> data(new uint8[size]); |
726 | 785 |
727 ClusterBuilder cb; | 786 ClusterBuilder cb; |
728 cb.SetClusterTimecode(std::min(first_audio_timecode, first_video_timecode)); | 787 cb.SetClusterTimecode(std::min(first_audio_timecode, first_video_timecode)); |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1283 .WillOnce(SaveArg<0>(&text_stream)); | 1342 .WillOnce(SaveArg<0>(&text_stream)); |
1284 ASSERT_TRUE(InitDemuxerWithEncryptionInfo( | 1343 ASSERT_TRUE(InitDemuxerWithEncryptionInfo( |
1285 HAS_TEXT | HAS_AUDIO | HAS_VIDEO, false, false)); | 1344 HAS_TEXT | HAS_AUDIO | HAS_VIDEO, false, false)); |
1286 DemuxerStream* audio_stream = demuxer_->GetStream(DemuxerStream::AUDIO); | 1345 DemuxerStream* audio_stream = demuxer_->GetStream(DemuxerStream::AUDIO); |
1287 DemuxerStream* video_stream = demuxer_->GetStream(DemuxerStream::VIDEO); | 1346 DemuxerStream* video_stream = demuxer_->GetStream(DemuxerStream::VIDEO); |
1288 ASSERT_TRUE(audio_stream && video_stream && text_stream); | 1347 ASSERT_TRUE(audio_stream && video_stream && text_stream); |
1289 | 1348 |
1290 AppendMuxedCluster( | 1349 AppendMuxedCluster( |
1291 MuxedStreamInfo(kAudioTrackNum, "0 23K"), | 1350 MuxedStreamInfo(kAudioTrackNum, "0 23K"), |
1292 MuxedStreamInfo(kVideoTrackNum, "0 30K"), | 1351 MuxedStreamInfo(kVideoTrackNum, "0 30K"), |
1293 MuxedStreamInfo(kTextTrackNum, "0 40K")); | 1352 MuxedStreamInfo(kTextTrackNum, "25K 40K")); |
acolwell GONE FROM CHROMIUM
2014/07/08 16:32:00
This was moved to avoid the text keyframe from cau
| |
1294 CheckExpectedRanges(kSourceId, "{ [30,46) }"); | 1353 CheckExpectedRanges(kSourceId, "{ [23,46) }"); |
wolenetz
2014/07/08 19:33:53
IIUC, this change from 30 to 23 is unrelated to th
acolwell GONE FROM CHROMIUM
2014/07/08 22:00:37
That is correct.
| |
1295 | 1354 |
1296 AppendInitSegment(HAS_TEXT | HAS_AUDIO | HAS_VIDEO); | 1355 AppendInitSegment(HAS_TEXT | HAS_AUDIO | HAS_VIDEO); |
1297 AppendMuxedCluster( | 1356 AppendMuxedCluster( |
1298 MuxedStreamInfo(kAudioTrackNum, "46 69K"), | 1357 MuxedStreamInfo(kAudioTrackNum, "46 69K"), |
1299 MuxedStreamInfo(kVideoTrackNum, "60 90K"), | 1358 MuxedStreamInfo(kVideoTrackNum, "60 90K"), |
1300 MuxedStreamInfo(kTextTrackNum, "80 90K")); | 1359 MuxedStreamInfo(kTextTrackNum, "80K 90K")); |
1301 CheckExpectedRanges(kSourceId, "{ [30,92) }"); | 1360 CheckExpectedRanges(kSourceId, "{ [23,92) }"); |
1302 | 1361 |
1303 CheckExpectedBuffers(audio_stream, "23 69"); | 1362 CheckExpectedBuffers(audio_stream, "23 69"); |
1304 CheckExpectedBuffers(video_stream, "30 90"); | 1363 CheckExpectedBuffers(video_stream, "30 90"); |
1305 | 1364 CheckExpectedBuffers(text_stream, "25 40 80 90"); |
1306 // WebM parser marks all text buffers as keyframes. | |
1307 CheckExpectedBuffers(text_stream, "0 40 80 90"); | |
1308 } | 1365 } |
1309 | 1366 |
1310 // Make sure that the demuxer reports an error if Shutdown() | 1367 // Make sure that the demuxer reports an error if Shutdown() |
1311 // is called before all the initialization segments are appended. | 1368 // is called before all the initialization segments are appended. |
1312 TEST_F(ChunkDemuxerTest, Shutdown_BeforeAllInitSegmentsAppended) { | 1369 TEST_F(ChunkDemuxerTest, Shutdown_BeforeAllInitSegmentsAppended) { |
1313 EXPECT_CALL(*this, DemuxerOpened()); | 1370 EXPECT_CALL(*this, DemuxerOpened()); |
1314 demuxer_->Initialize( | 1371 demuxer_->Initialize( |
1315 &host_, CreateInitDoneCB( | 1372 &host_, CreateInitDoneCB( |
1316 kDefaultDuration(), DEMUXER_ERROR_COULD_NOT_OPEN), true); | 1373 kDefaultDuration(), DEMUXER_ERROR_COULD_NOT_OPEN), true); |
1317 | 1374 |
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2461 // Verify that the range extends to the end of the video data. | 2518 // Verify that the range extends to the end of the video data. |
2462 CheckExpectedRanges("{ [0,66) }"); | 2519 CheckExpectedRanges("{ [0,66) }"); |
2463 | 2520 |
2464 // Verify that the range reverts to the intersection when end of stream | 2521 // Verify that the range reverts to the intersection when end of stream |
2465 // has been cancelled. | 2522 // has been cancelled. |
2466 demuxer_->UnmarkEndOfStream(); | 2523 demuxer_->UnmarkEndOfStream(); |
2467 CheckExpectedRanges("{ [0,46) }"); | 2524 CheckExpectedRanges("{ [0,46) }"); |
2468 | 2525 |
2469 // Append and remove data so that the 2 streams' end ranges do not overlap. | 2526 // Append and remove data so that the 2 streams' end ranges do not overlap. |
2470 | 2527 |
2471 EXPECT_CALL(host_, SetDuration(base::TimeDelta::FromMilliseconds(246))); | |
acolwell GONE FROM CHROMIUM
2014/07/08 16:32:00
This extra call was being triggered because there
| |
2472 EXPECT_CALL(host_, SetDuration(base::TimeDelta::FromMilliseconds(398))); | 2528 EXPECT_CALL(host_, SetDuration(base::TimeDelta::FromMilliseconds(398))); |
2473 AppendMuxedCluster( | 2529 AppendMuxedCluster( |
2474 MuxedStreamInfo(kAudioTrackNum, "200K 223K"), | 2530 MuxedStreamInfo(kAudioTrackNum, "200K 223K"), |
2475 MuxedStreamInfo(kVideoTrackNum, "200K 233 266 299 332K 365")); | 2531 MuxedStreamInfo(kVideoTrackNum, "200K 233 266 299 332K 365")); |
2476 | 2532 |
2477 // At this point, the per-stream ranges are as follows: | 2533 // At this point, the per-stream ranges are as follows: |
2478 // Audio: [0,46) [200,246) | 2534 // Audio: [0,46) [200,246) |
2479 // Video: [0,66) [200,398) | 2535 // Video: [0,66) [200,398) |
2480 CheckExpectedRanges("{ [0,46) [200,246) }"); | 2536 CheckExpectedRanges("{ [0,46) [200,246) }"); |
2481 | 2537 |
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3346 // Append a cluster that starts before and ends after the append | 3402 // Append a cluster that starts before and ends after the append |
3347 // window. | 3403 // window. |
3348 AppendMuxedCluster( | 3404 AppendMuxedCluster( |
3349 MuxedStreamInfo(kVideoTrackNum, | 3405 MuxedStreamInfo(kVideoTrackNum, |
3350 "0K 30 60 90 120K 150 180 210 240K 270 300 330K"), | 3406 "0K 30 60 90 120K 150 180 210 240K 270 300 330K"), |
3351 MuxedStreamInfo(kTextTrackNum, "0K 100K 200K 300K" )); | 3407 MuxedStreamInfo(kTextTrackNum, "0K 100K 200K 300K" )); |
3352 | 3408 |
3353 // Verify that text cues that start outside the window are not included | 3409 // Verify that text cues that start outside the window are not included |
3354 // in the buffer. Also verify that cues that extend beyond the | 3410 // in the buffer. Also verify that cues that extend beyond the |
3355 // window are not included. | 3411 // window are not included. |
3356 CheckExpectedRanges(kSourceId, "{ [120,270) }"); | 3412 CheckExpectedRanges(kSourceId, "{ [100,270) }"); |
acolwell GONE FROM CHROMIUM
2014/07/08 16:32:00
The text buffer is the first frame within the appe
| |
3357 CheckExpectedBuffers(video_stream, "120 150 180 210 240"); | 3413 CheckExpectedBuffers(video_stream, "120 150 180 210 240"); |
3358 CheckExpectedBuffers(text_stream, "100"); | 3414 CheckExpectedBuffers(text_stream, "100"); |
3359 | 3415 |
3360 // Extend the append window to [20,650). | 3416 // Extend the append window to [20,650). |
3361 append_window_end_for_next_append_ = base::TimeDelta::FromMilliseconds(650); | 3417 append_window_end_for_next_append_ = base::TimeDelta::FromMilliseconds(650); |
3362 | 3418 |
3363 // Append more data and verify that a new range is created. | 3419 // Append more data and verify that a new range is created. |
3364 AppendMuxedCluster( | 3420 AppendMuxedCluster( |
3365 MuxedStreamInfo(kVideoTrackNum, | 3421 MuxedStreamInfo(kVideoTrackNum, |
3366 "360 390 420K 450 480 510 540K 570 600 630K"), | 3422 "360 390 420K 450 480 510 540K 570 600 630K"), |
3367 MuxedStreamInfo(kTextTrackNum, "400K 500K 600K 700K" )); | 3423 MuxedStreamInfo(kTextTrackNum, "400K 500K 600K 700K" )); |
3368 CheckExpectedRanges(kSourceId, "{ [120,270) [420,630) }"); | 3424 CheckExpectedRanges(kSourceId, "{ [100,270) [400,630) }"); |
3369 | 3425 |
3370 // Seek to the new range and verify that the expected buffers are returned. | 3426 // Seek to the new range and verify that the expected buffers are returned. |
3371 Seek(base::TimeDelta::FromMilliseconds(420)); | 3427 Seek(base::TimeDelta::FromMilliseconds(420)); |
3372 CheckExpectedBuffers(video_stream, "420 450 480 510 540 570 600"); | 3428 CheckExpectedBuffers(video_stream, "420 450 480 510 540 570 600"); |
3373 CheckExpectedBuffers(text_stream, "400 500"); | 3429 CheckExpectedBuffers(text_stream, "400 500"); |
3374 } | 3430 } |
3375 | 3431 |
3376 TEST_F(ChunkDemuxerTest, StartWaitingForSeekAfterParseError) { | 3432 TEST_F(ChunkDemuxerTest, StartWaitingForSeekAfterParseError) { |
3377 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO)); | 3433 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO)); |
3378 EXPECT_CALL(host_, OnDemuxerError(PIPELINE_ERROR_DECODE)); | 3434 EXPECT_CALL(host_, OnDemuxerError(PIPELINE_ERROR_DECODE)); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3491 // Append text cues that start after the seek point and verify that | 3547 // Append text cues that start after the seek point and verify that |
3492 // they are returned by Read() calls. | 3548 // they are returned by Read() calls. |
3493 AppendMuxedCluster( | 3549 AppendMuxedCluster( |
3494 MuxedStreamInfo(kAudioTrackNum, "220K 240K 260K 280K"), | 3550 MuxedStreamInfo(kAudioTrackNum, "220K 240K 260K 280K"), |
3495 MuxedStreamInfo(kVideoTrackNum, "240K 270 300 330"), | 3551 MuxedStreamInfo(kVideoTrackNum, "240K 270 300 330"), |
3496 MuxedStreamInfo(kTextTrackNum, "225K 275K 325K")); | 3552 MuxedStreamInfo(kTextTrackNum, "225K 275K 325K")); |
3497 | 3553 |
3498 message_loop_.RunUntilIdle(); | 3554 message_loop_.RunUntilIdle(); |
3499 EXPECT_TRUE(text_read_done); | 3555 EXPECT_TRUE(text_read_done); |
3500 | 3556 |
3501 // NOTE: we start at 175 here because the buffer at 125 was returned | 3557 // NOTE: we start at 175 here because the buffer at 125 was returned |
wolenetz
2014/07/08 19:33:53
nit: Precursor CL introduced change to 275. s/175/
acolwell GONE FROM CHROMIUM
2014/07/08 22:00:37
Done.
| |
3502 // to the pending read initiated above. | 3558 // to the pending read initiated above. |
3503 CheckExpectedBuffers(text_stream, "275 325"); | 3559 CheckExpectedBuffers(text_stream, "275 325"); |
3504 | 3560 |
3505 // Verify that audio & video streams continue to return expected values. | 3561 // Verify that audio & video streams continue to return expected values. |
3506 CheckExpectedBuffers(audio_stream, "160 180"); | 3562 CheckExpectedBuffers(audio_stream, "160 180"); |
3507 CheckExpectedBuffers(video_stream, "180 210"); | 3563 CheckExpectedBuffers(video_stream, "180 210"); |
3508 } | 3564 } |
3509 | 3565 |
3510 TEST_F(ChunkDemuxerTest, ClusterWithUnknownSize) { | 3566 TEST_F(ChunkDemuxerTest, ClusterWithUnknownSize) { |
3511 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO)); | 3567 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO)); |
(...skipping 23 matching lines...) Expand all Loading... | |
3535 TEST_F(ChunkDemuxerTest, CuesBetweenClusters) { | 3591 TEST_F(ChunkDemuxerTest, CuesBetweenClusters) { |
3536 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO)); | 3592 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO)); |
3537 | 3593 |
3538 AppendCluster(GenerateCluster(0, 0, 4)); | 3594 AppendCluster(GenerateCluster(0, 0, 4)); |
3539 AppendData(kCuesHeader, sizeof(kCuesHeader)); | 3595 AppendData(kCuesHeader, sizeof(kCuesHeader)); |
3540 AppendCluster(GenerateCluster(46, 66, 5)); | 3596 AppendCluster(GenerateCluster(46, 66, 5)); |
3541 CheckExpectedRanges(kSourceId, "{ [0,115) }"); | 3597 CheckExpectedRanges(kSourceId, "{ [0,115) }"); |
3542 } | 3598 } |
3543 | 3599 |
3544 } // namespace media | 3600 } // namespace media |
OLD | NEW |