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 "media/filters/pipeline_integration_test_base.h" | 5 #include "media/filters/pipeline_integration_test_base.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "media/base/cdm_promise.h" | 12 #include "media/base/cdm_promise.h" |
13 #include "media/base/decoder_buffer.h" | 13 #include "media/base/decoder_buffer.h" |
14 #include "media/base/media_keys.h" | 14 #include "media/base/media_keys.h" |
15 #include "media/base/media_switches.h" | 15 #include "media/base/media_switches.h" |
16 #include "media/base/test_data_util.h" | 16 #include "media/base/test_data_util.h" |
17 #include "media/cdm/aes_decryptor.h" | 17 #include "media/cdm/aes_decryptor.h" |
18 #include "media/cdm/json_web_key.h" | 18 #include "media/cdm/json_web_key.h" |
19 #include "media/filters/chunk_demuxer.h" | 19 #include "media/filters/chunk_demuxer.h" |
20 | 20 |
21 using testing::_; | 21 using testing::_; |
22 using testing::AnyNumber; | 22 using testing::AnyNumber; |
23 using testing::AtMost; | 23 using testing::AtMost; |
24 using testing::SaveArg; | 24 using testing::SaveArg; |
25 using testing::Values; | |
26 | 25 |
27 namespace media { | 26 namespace media { |
28 | 27 |
29 const char kSourceId[] = "SourceId"; | 28 const char kSourceId[] = "SourceId"; |
30 const uint8 kInitData[] = { 0x69, 0x6e, 0x69, 0x74 }; | 29 const uint8 kInitData[] = { 0x69, 0x6e, 0x69, 0x74 }; |
31 | 30 |
32 const char kWebM[] = "video/webm; codecs=\"vp8,vorbis\""; | 31 const char kWebM[] = "video/webm; codecs=\"vp8,vorbis\""; |
33 const char kWebMVP9[] = "video/webm; codecs=\"vp9\""; | 32 const char kWebMVP9[] = "video/webm; codecs=\"vp9\""; |
34 const char kAudioOnlyWebM[] = "video/webm; codecs=\"vorbis\""; | 33 const char kAudioOnlyWebM[] = "video/webm; codecs=\"vorbis\""; |
35 const char kOpusAudioOnlyWebM[] = "video/webm; codecs=\"opus\""; | 34 const char kOpusAudioOnlyWebM[] = "video/webm; codecs=\"opus\""; |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 AesDecryptor* decryptor) OVERRIDE { | 373 AesDecryptor* decryptor) OVERRIDE { |
375 } | 374 } |
376 }; | 375 }; |
377 | 376 |
378 // Helper class that emulates calls made on the ChunkDemuxer by the | 377 // Helper class that emulates calls made on the ChunkDemuxer by the |
379 // Media Source API. | 378 // Media Source API. |
380 class MockMediaSource { | 379 class MockMediaSource { |
381 public: | 380 public: |
382 MockMediaSource(const std::string& filename, | 381 MockMediaSource(const std::string& filename, |
383 const std::string& mimetype, | 382 const std::string& mimetype, |
384 int initial_append_size, | 383 int initial_append_size) |
385 const bool use_legacy_frame_processor) | |
386 : file_path_(GetTestDataFilePath(filename)), | 384 : file_path_(GetTestDataFilePath(filename)), |
387 current_position_(0), | 385 current_position_(0), |
388 initial_append_size_(initial_append_size), | 386 initial_append_size_(initial_append_size), |
389 mimetype_(mimetype), | 387 mimetype_(mimetype), |
390 chunk_demuxer_(new ChunkDemuxer( | 388 chunk_demuxer_(new ChunkDemuxer( |
391 base::Bind(&MockMediaSource::DemuxerOpened, base::Unretained(this)), | 389 base::Bind(&MockMediaSource::DemuxerOpened, base::Unretained(this)), |
392 base::Bind(&MockMediaSource::DemuxerNeedKey, | 390 base::Bind(&MockMediaSource::DemuxerNeedKey, |
393 base::Unretained(this)), | 391 base::Unretained(this)), |
394 LogCB(), | 392 LogCB(), |
395 true)), | 393 true)), |
396 owned_chunk_demuxer_(chunk_demuxer_), | 394 owned_chunk_demuxer_(chunk_demuxer_) { |
397 use_legacy_frame_processor_(use_legacy_frame_processor) { | |
398 | 395 |
399 file_data_ = ReadTestDataFile(filename); | 396 file_data_ = ReadTestDataFile(filename); |
400 | 397 |
401 if (initial_append_size_ == kAppendWholeFile) | 398 if (initial_append_size_ == kAppendWholeFile) |
402 initial_append_size_ = file_data_->data_size(); | 399 initial_append_size_ = file_data_->data_size(); |
403 | 400 |
404 DCHECK_GT(initial_append_size_, 0); | 401 DCHECK_GT(initial_append_size_, 0); |
405 DCHECK_LE(initial_append_size_, file_data_->data_size()); | 402 DCHECK_LE(initial_append_size_, file_data_->data_size()); |
406 } | 403 } |
407 | 404 |
408 virtual ~MockMediaSource() {} | 405 virtual ~MockMediaSource() {} |
409 | 406 |
410 scoped_ptr<Demuxer> GetDemuxer() { return owned_chunk_demuxer_.Pass(); } | 407 scoped_ptr<Demuxer> GetDemuxer() { return owned_chunk_demuxer_.Pass(); } |
411 | 408 |
412 void set_need_key_cb(const Demuxer::NeedKeyCB& need_key_cb) { | 409 void set_need_key_cb(const Demuxer::NeedKeyCB& need_key_cb) { |
413 need_key_cb_ = need_key_cb; | 410 need_key_cb_ = need_key_cb; |
414 } | 411 } |
415 | 412 |
416 void Seek(base::TimeDelta seek_time, int new_position, int seek_append_size) { | 413 void Seek(base::TimeDelta seek_time, int new_position, int seek_append_size) { |
417 chunk_demuxer_->StartWaitingForSeek(seek_time); | 414 chunk_demuxer_->StartWaitingForSeek(seek_time); |
418 | 415 |
419 // TODO(wolenetz): Test timestamp offset updating once "sequence" append | |
420 // mode processing is implemented. See http://crbug.com/249422. | |
421 chunk_demuxer_->Abort( | 416 chunk_demuxer_->Abort( |
422 kSourceId, | 417 kSourceId, |
423 base::TimeDelta(), kInfiniteDuration(), &last_timestamp_offset_); | 418 base::TimeDelta(), kInfiniteDuration(), &last_timestamp_offset_); |
424 | 419 |
425 DCHECK_GE(new_position, 0); | 420 DCHECK_GE(new_position, 0); |
426 DCHECK_LT(new_position, file_data_->data_size()); | 421 DCHECK_LT(new_position, file_data_->data_size()); |
427 current_position_ = new_position; | 422 current_position_ = new_position; |
428 | 423 |
429 AppendData(seek_append_size); | 424 AppendData(seek_append_size); |
430 } | 425 } |
431 | 426 |
432 void AppendData(int size) { | 427 void AppendData(int size) { |
433 DCHECK(chunk_demuxer_); | 428 DCHECK(chunk_demuxer_); |
434 DCHECK_LT(current_position_, file_data_->data_size()); | 429 DCHECK_LT(current_position_, file_data_->data_size()); |
435 DCHECK_LE(current_position_ + size, file_data_->data_size()); | 430 DCHECK_LE(current_position_ + size, file_data_->data_size()); |
436 | 431 |
437 // TODO(wolenetz): Test timestamp offset updating once "sequence" append | |
438 // mode processing is implemented. See http://crbug.com/249422. | |
439 chunk_demuxer_->AppendData( | 432 chunk_demuxer_->AppendData( |
440 kSourceId, file_data_->data() + current_position_, size, | 433 kSourceId, file_data_->data() + current_position_, size, |
441 base::TimeDelta(), kInfiniteDuration(), &last_timestamp_offset_); | 434 base::TimeDelta(), kInfiniteDuration(), &last_timestamp_offset_); |
442 current_position_ += size; | 435 current_position_ += size; |
443 } | 436 } |
444 | 437 |
445 void AppendAtTime(base::TimeDelta timestamp_offset, | 438 void AppendAtTime(base::TimeDelta timestamp_offset, |
446 const uint8* pData, | 439 const uint8* pData, |
447 int size) { | 440 int size) { |
448 CHECK(!chunk_demuxer_->IsParsingMediaSegment(kSourceId)); | 441 CHECK(!chunk_demuxer_->IsParsingMediaSegment(kSourceId)); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 size_t codecs_param_end = mimetype_.find("\"", codecs_param_start); | 495 size_t codecs_param_end = mimetype_.find("\"", codecs_param_start); |
503 | 496 |
504 CHECK_NE(codecs_param_end, std::string::npos); | 497 CHECK_NE(codecs_param_end, std::string::npos); |
505 | 498 |
506 std::string codecs_param = | 499 std::string codecs_param = |
507 mimetype_.substr(codecs_param_start, | 500 mimetype_.substr(codecs_param_start, |
508 codecs_param_end - codecs_param_start); | 501 codecs_param_end - codecs_param_start); |
509 Tokenize(codecs_param, ",", &codecs); | 502 Tokenize(codecs_param, ",", &codecs); |
510 } | 503 } |
511 | 504 |
512 CHECK_EQ(chunk_demuxer_->AddId(kSourceId, type, codecs, | 505 CHECK_EQ(chunk_demuxer_->AddId(kSourceId, type, codecs), ChunkDemuxer::kOk); |
513 use_legacy_frame_processor_), | |
514 ChunkDemuxer::kOk); | |
515 | 506 |
516 AppendData(initial_append_size_); | 507 AppendData(initial_append_size_); |
517 } | 508 } |
518 | 509 |
519 void DemuxerNeedKey(const std::string& type, | 510 void DemuxerNeedKey(const std::string& type, |
520 const std::vector<uint8>& init_data) { | 511 const std::vector<uint8>& init_data) { |
521 DCHECK(!init_data.empty()); | 512 DCHECK(!init_data.empty()); |
522 CHECK(!need_key_cb_.is_null()); | 513 CHECK(!need_key_cb_.is_null()); |
523 need_key_cb_.Run(type, init_data); | 514 need_key_cb_.Run(type, init_data); |
524 } | 515 } |
525 | 516 |
526 base::TimeDelta last_timestamp_offset() const { | 517 base::TimeDelta last_timestamp_offset() const { |
527 return last_timestamp_offset_; | 518 return last_timestamp_offset_; |
528 } | 519 } |
529 | 520 |
530 private: | 521 private: |
531 base::FilePath file_path_; | 522 base::FilePath file_path_; |
532 scoped_refptr<DecoderBuffer> file_data_; | 523 scoped_refptr<DecoderBuffer> file_data_; |
533 int current_position_; | 524 int current_position_; |
534 int initial_append_size_; | 525 int initial_append_size_; |
535 std::string mimetype_; | 526 std::string mimetype_; |
536 ChunkDemuxer* chunk_demuxer_; | 527 ChunkDemuxer* chunk_demuxer_; |
537 scoped_ptr<Demuxer> owned_chunk_demuxer_; | 528 scoped_ptr<Demuxer> owned_chunk_demuxer_; |
538 Demuxer::NeedKeyCB need_key_cb_; | 529 Demuxer::NeedKeyCB need_key_cb_; |
539 base::TimeDelta last_timestamp_offset_; | 530 base::TimeDelta last_timestamp_offset_; |
540 bool use_legacy_frame_processor_; | |
541 }; | 531 }; |
542 | 532 |
543 // Test parameter determines which coded frame processor is used to process | |
544 // appended data, and is only applicable in tests where the pipeline is using a | |
545 // (Mock)MediaSource (which are TEST_P, not TEST_F). If true, | |
546 // LegacyFrameProcessor is used. Otherwise, the new FrameProcessor is used. | |
547 class PipelineIntegrationTest | 533 class PipelineIntegrationTest |
548 : public testing::TestWithParam<bool>, | 534 : public testing::Test, |
549 public PipelineIntegrationTestBase { | 535 public PipelineIntegrationTestBase { |
550 public: | 536 public: |
551 void StartPipelineWithMediaSource(MockMediaSource* source) { | 537 void StartPipelineWithMediaSource(MockMediaSource* source) { |
552 EXPECT_CALL(*this, OnMetadata(_)).Times(AtMost(1)) | 538 EXPECT_CALL(*this, OnMetadata(_)).Times(AtMost(1)) |
553 .WillRepeatedly(SaveArg<0>(&metadata_)); | 539 .WillRepeatedly(SaveArg<0>(&metadata_)); |
554 EXPECT_CALL(*this, OnPrerollCompleted()).Times(AtMost(1)); | 540 EXPECT_CALL(*this, OnPrerollCompleted()).Times(AtMost(1)); |
555 pipeline_->Start( | 541 pipeline_->Start( |
556 CreateFilterCollection(source->GetDemuxer(), NULL), | 542 CreateFilterCollection(source->GetDemuxer(), NULL), |
557 base::Bind(&PipelineIntegrationTest::OnEnded, base::Unretained(this)), | 543 base::Bind(&PipelineIntegrationTest::OnEnded, base::Unretained(this)), |
558 base::Bind(&PipelineIntegrationTest::OnError, base::Unretained(this)), | 544 base::Bind(&PipelineIntegrationTest::OnError, base::Unretained(this)), |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 // Verifies that seeking works properly for ChunkDemuxer when the | 584 // Verifies that seeking works properly for ChunkDemuxer when the |
599 // seek happens while there is a pending read on the ChunkDemuxer | 585 // seek happens while there is a pending read on the ChunkDemuxer |
600 // and no data is available. | 586 // and no data is available. |
601 bool TestSeekDuringRead(const std::string& filename, | 587 bool TestSeekDuringRead(const std::string& filename, |
602 const std::string& mimetype, | 588 const std::string& mimetype, |
603 int initial_append_size, | 589 int initial_append_size, |
604 base::TimeDelta start_seek_time, | 590 base::TimeDelta start_seek_time, |
605 base::TimeDelta seek_time, | 591 base::TimeDelta seek_time, |
606 int seek_file_position, | 592 int seek_file_position, |
607 int seek_append_size) { | 593 int seek_append_size) { |
608 MockMediaSource source(filename, mimetype, initial_append_size, | 594 MockMediaSource source(filename, mimetype, initial_append_size); |
609 GetParam()); | |
610 StartPipelineWithMediaSource(&source); | 595 StartPipelineWithMediaSource(&source); |
611 | 596 |
612 if (pipeline_status_ != PIPELINE_OK) | 597 if (pipeline_status_ != PIPELINE_OK) |
613 return false; | 598 return false; |
614 | 599 |
615 Play(); | 600 Play(); |
616 if (!WaitUntilCurrentTimeIsAfter(start_seek_time)) | 601 if (!WaitUntilCurrentTimeIsAfter(start_seek_time)) |
617 return false; | 602 return false; |
618 | 603 |
619 source.Seek(seek_time, seek_file_position, seek_append_size); | 604 source.Seek(seek_time, seek_file_position, seek_append_size); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 | 675 |
691 ASSERT_TRUE(Start(GetTestDataFilePath("bear-320x240-av_enc-av.webm"), | 676 ASSERT_TRUE(Start(GetTestDataFilePath("bear-320x240-av_enc-av.webm"), |
692 encrypted_media.decryptor())); | 677 encrypted_media.decryptor())); |
693 | 678 |
694 Play(); | 679 Play(); |
695 | 680 |
696 ASSERT_TRUE(WaitUntilOnEnded()); | 681 ASSERT_TRUE(WaitUntilOnEnded()); |
697 Stop(); | 682 Stop(); |
698 } | 683 } |
699 | 684 |
700 TEST_P(PipelineIntegrationTest, BasicPlayback_MediaSource) { | 685 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource) { |
701 MockMediaSource source("bear-320x240.webm", kWebM, 219229, GetParam()); | 686 MockMediaSource source("bear-320x240.webm", kWebM, 219229); |
702 StartPipelineWithMediaSource(&source); | 687 StartPipelineWithMediaSource(&source); |
703 source.EndOfStream(); | 688 source.EndOfStream(); |
704 | 689 |
705 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 690 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
706 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 691 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
707 EXPECT_EQ(k320WebMFileDurationMs, | 692 EXPECT_EQ(k320WebMFileDurationMs, |
708 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 693 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
709 | 694 |
710 Play(); | 695 Play(); |
711 | 696 |
712 ASSERT_TRUE(WaitUntilOnEnded()); | 697 ASSERT_TRUE(WaitUntilOnEnded()); |
713 | 698 |
714 EXPECT_TRUE(demuxer_->GetTimelineOffset().is_null()); | 699 EXPECT_TRUE(demuxer_->GetTimelineOffset().is_null()); |
715 source.Abort(); | 700 source.Abort(); |
716 Stop(); | 701 Stop(); |
717 } | 702 } |
718 | 703 |
719 TEST_P(PipelineIntegrationTest, BasicPlayback_MediaSource_Live) { | 704 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_Live) { |
720 MockMediaSource source("bear-320x240-live.webm", kWebM, 219221, GetParam()); | 705 MockMediaSource source("bear-320x240-live.webm", kWebM, 219221); |
721 StartPipelineWithMediaSource(&source); | 706 StartPipelineWithMediaSource(&source); |
722 source.EndOfStream(); | 707 source.EndOfStream(); |
723 | 708 |
724 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 709 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
725 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 710 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
726 EXPECT_EQ(k320WebMFileDurationMs, | 711 EXPECT_EQ(k320WebMFileDurationMs, |
727 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 712 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
728 | 713 |
729 Play(); | 714 Play(); |
730 | 715 |
731 ASSERT_TRUE(WaitUntilOnEnded()); | 716 ASSERT_TRUE(WaitUntilOnEnded()); |
732 | 717 |
733 EXPECT_EQ(kLiveTimelineOffset(), | 718 EXPECT_EQ(kLiveTimelineOffset(), |
734 demuxer_->GetTimelineOffset()); | 719 demuxer_->GetTimelineOffset()); |
735 source.Abort(); | 720 source.Abort(); |
736 Stop(); | 721 Stop(); |
737 } | 722 } |
738 | 723 |
739 TEST_P(PipelineIntegrationTest, BasicPlayback_MediaSource_VP9_WebM) { | 724 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VP9_WebM) { |
740 MockMediaSource source("bear-vp9.webm", kWebMVP9, 67504, GetParam()); | 725 MockMediaSource source("bear-vp9.webm", kWebMVP9, 67504); |
741 StartPipelineWithMediaSource(&source); | 726 StartPipelineWithMediaSource(&source); |
742 source.EndOfStream(); | 727 source.EndOfStream(); |
743 | 728 |
744 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 729 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
745 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 730 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
746 EXPECT_EQ(kVP9WebMFileDurationMs, | 731 EXPECT_EQ(kVP9WebMFileDurationMs, |
747 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 732 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
748 | 733 |
749 Play(); | 734 Play(); |
750 | 735 |
751 ASSERT_TRUE(WaitUntilOnEnded()); | 736 ASSERT_TRUE(WaitUntilOnEnded()); |
752 source.Abort(); | 737 source.Abort(); |
753 Stop(); | 738 Stop(); |
754 } | 739 } |
755 | 740 |
756 TEST_P(PipelineIntegrationTest, BasicPlayback_MediaSource_VP8A_WebM) { | 741 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VP8A_WebM) { |
757 MockMediaSource source("bear-vp8a.webm", kVideoOnlyWebM, kAppendWholeFile, | 742 MockMediaSource source("bear-vp8a.webm", kVideoOnlyWebM, kAppendWholeFile); |
758 GetParam()); | |
759 StartPipelineWithMediaSource(&source); | 743 StartPipelineWithMediaSource(&source); |
760 source.EndOfStream(); | 744 source.EndOfStream(); |
761 | 745 |
762 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 746 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
763 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 747 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
764 EXPECT_EQ(kVP8AWebMFileDurationMs, | 748 EXPECT_EQ(kVP8AWebMFileDurationMs, |
765 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 749 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
766 | 750 |
767 Play(); | 751 Play(); |
768 | 752 |
769 ASSERT_TRUE(WaitUntilOnEnded()); | 753 ASSERT_TRUE(WaitUntilOnEnded()); |
770 source.Abort(); | 754 source.Abort(); |
771 Stop(); | 755 Stop(); |
772 } | 756 } |
773 | 757 |
774 TEST_P(PipelineIntegrationTest, BasicPlayback_MediaSource_Opus_WebM) { | 758 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_Opus_WebM) { |
775 MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM, | 759 MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM, |
776 kAppendWholeFile, GetParam()); | 760 kAppendWholeFile); |
777 StartPipelineWithMediaSource(&source); | 761 StartPipelineWithMediaSource(&source); |
778 source.EndOfStream(); | 762 source.EndOfStream(); |
779 | 763 |
780 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 764 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
781 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 765 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
782 EXPECT_EQ(kOpusEndTrimmingWebMFileDurationMs, | 766 EXPECT_EQ(kOpusEndTrimmingWebMFileDurationMs, |
783 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 767 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
784 Play(); | 768 Play(); |
785 | 769 |
786 ASSERT_TRUE(WaitUntilOnEnded()); | 770 ASSERT_TRUE(WaitUntilOnEnded()); |
787 source.Abort(); | 771 source.Abort(); |
788 Stop(); | 772 Stop(); |
789 } | 773 } |
790 | 774 |
791 // Flaky. http://crbug.com/304776 | 775 // Flaky. http://crbug.com/304776 |
792 TEST_P(PipelineIntegrationTest, DISABLED_MediaSource_Opus_Seeking_WebM) { | 776 TEST_F(PipelineIntegrationTest, DISABLED_MediaSource_Opus_Seeking_WebM) { |
793 MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM, | 777 MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM, |
794 kAppendWholeFile, GetParam()); | 778 kAppendWholeFile); |
795 StartHashedPipelineWithMediaSource(&source); | 779 StartHashedPipelineWithMediaSource(&source); |
796 | 780 |
797 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 781 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
798 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 782 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
799 EXPECT_EQ(kOpusEndTrimmingWebMFileDurationMs, | 783 EXPECT_EQ(kOpusEndTrimmingWebMFileDurationMs, |
800 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 784 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
801 | 785 |
802 base::TimeDelta start_seek_time = base::TimeDelta::FromMilliseconds(1000); | 786 base::TimeDelta start_seek_time = base::TimeDelta::FromMilliseconds(1000); |
803 base::TimeDelta seek_time = base::TimeDelta::FromMilliseconds(2000); | 787 base::TimeDelta seek_time = base::TimeDelta::FromMilliseconds(2000); |
804 | 788 |
805 Play(); | 789 Play(); |
806 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time)); | 790 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time)); |
807 source.Seek(seek_time, 0x1D5, 34017); | 791 source.Seek(seek_time, 0x1D5, 34017); |
808 source.EndOfStream(); | 792 source.EndOfStream(); |
809 ASSERT_TRUE(Seek(seek_time)); | 793 ASSERT_TRUE(Seek(seek_time)); |
810 | 794 |
811 ASSERT_TRUE(WaitUntilOnEnded()); | 795 ASSERT_TRUE(WaitUntilOnEnded()); |
812 | 796 |
813 EXPECT_EQ("0.76,0.20,-0.82,-0.58,-1.29,-0.29,", GetAudioHash()); | 797 EXPECT_EQ("0.76,0.20,-0.82,-0.58,-1.29,-0.29,", GetAudioHash()); |
814 | 798 |
815 source.Abort(); | 799 source.Abort(); |
816 Stop(); | 800 Stop(); |
817 } | 801 } |
818 | 802 |
819 TEST_P(PipelineIntegrationTest, MediaSource_ConfigChange_WebM) { | 803 TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_WebM) { |
820 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, | 804 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, |
821 kAppendWholeFile, GetParam()); | 805 kAppendWholeFile); |
822 StartPipelineWithMediaSource(&source); | 806 StartPipelineWithMediaSource(&source); |
823 | 807 |
824 scoped_refptr<DecoderBuffer> second_file = | 808 scoped_refptr<DecoderBuffer> second_file = |
825 ReadTestDataFile("bear-640x360.webm"); | 809 ReadTestDataFile("bear-640x360.webm"); |
826 | 810 |
827 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), | 811 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
828 second_file->data(), second_file->data_size()); | 812 second_file->data(), second_file->data_size()); |
829 | 813 |
830 source.EndOfStream(); | 814 source.EndOfStream(); |
831 | 815 |
832 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 816 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
833 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 817 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
834 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs, | 818 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs, |
835 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 819 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
836 | 820 |
837 Play(); | 821 Play(); |
838 | 822 |
839 EXPECT_TRUE(WaitUntilOnEnded()); | 823 EXPECT_TRUE(WaitUntilOnEnded()); |
840 source.Abort(); | 824 source.Abort(); |
841 Stop(); | 825 Stop(); |
842 } | 826 } |
843 | 827 |
844 TEST_P(PipelineIntegrationTest, MediaSource_ConfigChange_Encrypted_WebM) { | 828 TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_Encrypted_WebM) { |
845 MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM, | 829 MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM, |
846 kAppendWholeFile, GetParam()); | 830 kAppendWholeFile); |
847 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); | 831 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
848 StartPipelineWithEncryptedMedia(&source, &encrypted_media); | 832 StartPipelineWithEncryptedMedia(&source, &encrypted_media); |
849 | 833 |
850 scoped_refptr<DecoderBuffer> second_file = | 834 scoped_refptr<DecoderBuffer> second_file = |
851 ReadTestDataFile("bear-640x360-av_enc-av.webm"); | 835 ReadTestDataFile("bear-640x360-av_enc-av.webm"); |
852 | 836 |
853 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), | 837 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
854 second_file->data(), second_file->data_size()); | 838 second_file->data(), second_file->data_size()); |
855 | 839 |
856 source.EndOfStream(); | 840 source.EndOfStream(); |
857 | 841 |
858 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 842 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
859 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 843 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
860 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs, | 844 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs, |
861 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 845 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
862 | 846 |
863 Play(); | 847 Play(); |
864 | 848 |
865 EXPECT_TRUE(WaitUntilOnEnded()); | 849 EXPECT_TRUE(WaitUntilOnEnded()); |
866 source.Abort(); | 850 source.Abort(); |
867 Stop(); | 851 Stop(); |
868 } | 852 } |
869 | 853 |
870 // Config changes from encrypted to clear are not currently supported. | 854 // Config changes from encrypted to clear are not currently supported. |
871 TEST_P(PipelineIntegrationTest, | 855 TEST_F(PipelineIntegrationTest, |
872 MediaSource_ConfigChange_ClearThenEncrypted_WebM) { | 856 MediaSource_ConfigChange_ClearThenEncrypted_WebM) { |
873 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, | 857 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, |
874 kAppendWholeFile, GetParam()); | 858 kAppendWholeFile); |
875 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); | 859 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
876 StartPipelineWithEncryptedMedia(&source, &encrypted_media); | 860 StartPipelineWithEncryptedMedia(&source, &encrypted_media); |
877 | 861 |
878 scoped_refptr<DecoderBuffer> second_file = | 862 scoped_refptr<DecoderBuffer> second_file = |
879 ReadTestDataFile("bear-640x360-av_enc-av.webm"); | 863 ReadTestDataFile("bear-640x360-av_enc-av.webm"); |
880 | 864 |
881 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), | 865 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
882 second_file->data(), second_file->data_size()); | 866 second_file->data(), second_file->data_size()); |
883 | 867 |
884 source.EndOfStream(); | 868 source.EndOfStream(); |
885 | 869 |
886 message_loop_.Run(); | 870 message_loop_.Run(); |
887 EXPECT_EQ(PIPELINE_ERROR_DECODE, pipeline_status_); | 871 EXPECT_EQ(PIPELINE_ERROR_DECODE, pipeline_status_); |
888 | 872 |
889 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 873 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
890 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 874 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
891 // The second video was not added, so its time has not been added. | 875 // The second video was not added, so its time has not been added. |
892 EXPECT_EQ(k320WebMFileDurationMs, | 876 EXPECT_EQ(k320WebMFileDurationMs, |
893 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 877 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
894 | 878 |
895 Play(); | 879 Play(); |
896 | 880 |
897 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); | 881 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); |
898 source.Abort(); | 882 source.Abort(); |
899 } | 883 } |
900 | 884 |
901 // Config changes from clear to encrypted are not currently supported. | 885 // Config changes from clear to encrypted are not currently supported. |
902 TEST_P(PipelineIntegrationTest, | 886 TEST_F(PipelineIntegrationTest, |
903 MediaSource_ConfigChange_EncryptedThenClear_WebM) { | 887 MediaSource_ConfigChange_EncryptedThenClear_WebM) { |
904 MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM, | 888 MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM, |
905 kAppendWholeFile, GetParam()); | 889 kAppendWholeFile); |
906 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); | 890 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
907 StartPipelineWithEncryptedMedia(&source, &encrypted_media); | 891 StartPipelineWithEncryptedMedia(&source, &encrypted_media); |
908 | 892 |
909 scoped_refptr<DecoderBuffer> second_file = | 893 scoped_refptr<DecoderBuffer> second_file = |
910 ReadTestDataFile("bear-640x360.webm"); | 894 ReadTestDataFile("bear-640x360.webm"); |
911 | 895 |
912 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), | 896 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
913 second_file->data(), second_file->data_size()); | 897 second_file->data(), second_file->data_size()); |
914 | 898 |
915 source.EndOfStream(); | 899 source.EndOfStream(); |
916 | 900 |
917 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 901 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
918 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 902 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
919 // The second video was not added, so its time has not been added. | 903 // The second video was not added, so its time has not been added. |
920 EXPECT_EQ(k320WebMFileDurationMs, | 904 EXPECT_EQ(k320WebMFileDurationMs, |
921 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 905 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
922 | 906 |
923 Play(); | 907 Play(); |
924 | 908 |
925 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); | 909 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); |
926 source.Abort(); | 910 source.Abort(); |
927 } | 911 } |
928 | 912 |
929 #if defined(USE_PROPRIETARY_CODECS) | 913 #if defined(USE_PROPRIETARY_CODECS) |
930 TEST_P(PipelineIntegrationTest, MediaSource_ADTS) { | 914 TEST_F(PipelineIntegrationTest, MediaSource_ADTS) { |
931 MockMediaSource source("sfx.adts", kADTS, kAppendWholeFile, GetParam()); | 915 MockMediaSource source("sfx.adts", kADTS, kAppendWholeFile); |
932 StartPipelineWithMediaSource(&source); | 916 StartPipelineWithMediaSource(&source); |
933 source.EndOfStream(); | 917 source.EndOfStream(); |
934 | 918 |
935 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 919 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
936 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 920 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
937 EXPECT_EQ(325, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 921 EXPECT_EQ(325, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
938 | 922 |
939 Play(); | 923 Play(); |
940 | 924 |
941 EXPECT_TRUE(WaitUntilOnEnded()); | 925 EXPECT_TRUE(WaitUntilOnEnded()); |
942 } | 926 } |
943 | 927 |
944 TEST_P(PipelineIntegrationTest, MediaSource_ADTS_TimestampOffset) { | 928 TEST_F(PipelineIntegrationTest, MediaSource_ADTS_TimestampOffset) { |
945 MockMediaSource source("sfx.adts", kADTS, kAppendWholeFile, GetParam()); | 929 MockMediaSource source("sfx.adts", kADTS, kAppendWholeFile); |
946 StartHashedPipelineWithMediaSource(&source); | 930 StartHashedPipelineWithMediaSource(&source); |
947 EXPECT_EQ(325, source.last_timestamp_offset().InMilliseconds()); | 931 EXPECT_EQ(325, source.last_timestamp_offset().InMilliseconds()); |
948 | 932 |
949 // Trim off multiple frames off the beginning of the segment which will cause | 933 // Trim off multiple frames off the beginning of the segment which will cause |
950 // the first decoded frame to be incorrect if preroll isn't implemented. | 934 // the first decoded frame to be incorrect if preroll isn't implemented. |
951 const base::TimeDelta adts_preroll_duration = | 935 const base::TimeDelta adts_preroll_duration = |
952 base::TimeDelta::FromSecondsD(2.5 * 1024 / 44100); | 936 base::TimeDelta::FromSecondsD(2.5 * 1024 / 44100); |
953 const base::TimeDelta append_time = | 937 const base::TimeDelta append_time = |
954 source.last_timestamp_offset() - adts_preroll_duration; | 938 source.last_timestamp_offset() - adts_preroll_duration; |
955 | 939 |
(...skipping 22 matching lines...) Expand all Loading... |
978 ASSERT_TRUE(Start(GetTestDataFilePath("sfx.mp3"), PIPELINE_OK, kHashed)); | 962 ASSERT_TRUE(Start(GetTestDataFilePath("sfx.mp3"), PIPELINE_OK, kHashed)); |
979 | 963 |
980 Play(); | 964 Play(); |
981 | 965 |
982 ASSERT_TRUE(WaitUntilOnEnded()); | 966 ASSERT_TRUE(WaitUntilOnEnded()); |
983 | 967 |
984 // Verify codec delay and preroll are stripped. | 968 // Verify codec delay and preroll are stripped. |
985 EXPECT_EQ("3.05,2.87,3.00,3.32,3.58,4.08,", GetAudioHash()); | 969 EXPECT_EQ("3.05,2.87,3.00,3.32,3.58,4.08,", GetAudioHash()); |
986 } | 970 } |
987 | 971 |
988 TEST_P(PipelineIntegrationTest, MediaSource_MP3) { | 972 TEST_F(PipelineIntegrationTest, MediaSource_MP3) { |
989 MockMediaSource source("sfx.mp3", kMP3, kAppendWholeFile, GetParam()); | 973 MockMediaSource source("sfx.mp3", kMP3, kAppendWholeFile); |
990 StartHashedPipelineWithMediaSource(&source); | 974 StartHashedPipelineWithMediaSource(&source); |
991 source.EndOfStream(); | 975 source.EndOfStream(); |
992 | 976 |
993 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 977 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
994 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 978 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
995 EXPECT_EQ(313, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 979 EXPECT_EQ(313, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
996 | 980 |
997 Play(); | 981 Play(); |
998 | 982 |
999 EXPECT_TRUE(WaitUntilOnEnded()); | 983 EXPECT_TRUE(WaitUntilOnEnded()); |
1000 | 984 |
1001 // Verify that codec delay was stripped. | 985 // Verify that codec delay was stripped. |
1002 EXPECT_EQ("1.01,2.71,4.18,4.32,3.04,1.12,", GetAudioHash()); | 986 EXPECT_EQ("1.01,2.71,4.18,4.32,3.04,1.12,", GetAudioHash()); |
1003 } | 987 } |
1004 | 988 |
1005 TEST_P(PipelineIntegrationTest, MediaSource_MP3_TimestampOffset) { | 989 TEST_F(PipelineIntegrationTest, MediaSource_MP3_TimestampOffset) { |
1006 MockMediaSource source("sfx.mp3", kMP3, kAppendWholeFile, GetParam()); | 990 MockMediaSource source("sfx.mp3", kMP3, kAppendWholeFile); |
1007 StartPipelineWithMediaSource(&source); | 991 StartPipelineWithMediaSource(&source); |
1008 EXPECT_EQ(313, source.last_timestamp_offset().InMilliseconds()); | 992 EXPECT_EQ(313, source.last_timestamp_offset().InMilliseconds()); |
1009 | 993 |
1010 // There are 576 silent frames at the start of this mp3. The second append | 994 // There are 576 silent frames at the start of this mp3. The second append |
1011 // should trim them off. | 995 // should trim them off. |
1012 const base::TimeDelta mp3_preroll_duration = | 996 const base::TimeDelta mp3_preroll_duration = |
1013 base::TimeDelta::FromSecondsD(576.0 / 44100); | 997 base::TimeDelta::FromSecondsD(576.0 / 44100); |
1014 const base::TimeDelta append_time = | 998 const base::TimeDelta append_time = |
1015 source.last_timestamp_offset() - mp3_preroll_duration; | 999 source.last_timestamp_offset() - mp3_preroll_duration; |
1016 | 1000 |
1017 scoped_refptr<DecoderBuffer> second_file = ReadTestDataFile("sfx.mp3"); | 1001 scoped_refptr<DecoderBuffer> second_file = ReadTestDataFile("sfx.mp3"); |
1018 source.AppendAtTimeWithWindow(append_time, | 1002 source.AppendAtTimeWithWindow(append_time, |
1019 append_time + mp3_preroll_duration, | 1003 append_time + mp3_preroll_duration, |
1020 kInfiniteDuration(), | 1004 kInfiniteDuration(), |
1021 second_file->data(), | 1005 second_file->data(), |
1022 second_file->data_size()); | 1006 second_file->data_size()); |
1023 source.EndOfStream(); | 1007 source.EndOfStream(); |
1024 | 1008 |
1025 EXPECT_EQ(613, source.last_timestamp_offset().InMilliseconds()); | 1009 EXPECT_EQ(613, source.last_timestamp_offset().InMilliseconds()); |
1026 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 1010 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
1027 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 1011 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
1028 EXPECT_EQ(613, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 1012 EXPECT_EQ(613, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
1029 | 1013 |
1030 Play(); | 1014 Play(); |
1031 | 1015 |
1032 EXPECT_TRUE(WaitUntilOnEnded()); | 1016 EXPECT_TRUE(WaitUntilOnEnded()); |
1033 } | 1017 } |
1034 | 1018 |
1035 TEST_P(PipelineIntegrationTest, MediaSource_MP3_Icecast) { | 1019 TEST_F(PipelineIntegrationTest, MediaSource_MP3_Icecast) { |
1036 MockMediaSource source("icy_sfx.mp3", kMP3, kAppendWholeFile, GetParam()); | 1020 MockMediaSource source("icy_sfx.mp3", kMP3, kAppendWholeFile); |
1037 StartPipelineWithMediaSource(&source); | 1021 StartPipelineWithMediaSource(&source); |
1038 source.EndOfStream(); | 1022 source.EndOfStream(); |
1039 | 1023 |
1040 Play(); | 1024 Play(); |
1041 | 1025 |
1042 EXPECT_TRUE(WaitUntilOnEnded()); | 1026 EXPECT_TRUE(WaitUntilOnEnded()); |
1043 } | 1027 } |
1044 | 1028 |
1045 TEST_P(PipelineIntegrationTest, MediaSource_ConfigChange_MP4) { | 1029 TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_MP4) { |
1046 MockMediaSource source("bear-640x360-av_frag.mp4", kMP4, kAppendWholeFile, | 1030 MockMediaSource source("bear-640x360-av_frag.mp4", kMP4, kAppendWholeFile); |
1047 GetParam()); | |
1048 StartPipelineWithMediaSource(&source); | 1031 StartPipelineWithMediaSource(&source); |
1049 | 1032 |
1050 scoped_refptr<DecoderBuffer> second_file = | 1033 scoped_refptr<DecoderBuffer> second_file = |
1051 ReadTestDataFile("bear-1280x720-av_frag.mp4"); | 1034 ReadTestDataFile("bear-1280x720-av_frag.mp4"); |
1052 | 1035 |
1053 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), | 1036 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
1054 second_file->data(), second_file->data_size()); | 1037 second_file->data(), second_file->data_size()); |
1055 | 1038 |
1056 source.EndOfStream(); | 1039 source.EndOfStream(); |
1057 | 1040 |
1058 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 1041 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
1059 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 1042 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
1060 EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs, | 1043 EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs, |
1061 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 1044 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
1062 | 1045 |
1063 Play(); | 1046 Play(); |
1064 | 1047 |
1065 EXPECT_TRUE(WaitUntilOnEnded()); | 1048 EXPECT_TRUE(WaitUntilOnEnded()); |
1066 source.Abort(); | 1049 source.Abort(); |
1067 Stop(); | 1050 Stop(); |
1068 } | 1051 } |
1069 | 1052 |
1070 TEST_P(PipelineIntegrationTest, | 1053 TEST_F(PipelineIntegrationTest, |
1071 MediaSource_ConfigChange_Encrypted_MP4_CENC_VideoOnly) { | 1054 MediaSource_ConfigChange_Encrypted_MP4_CENC_VideoOnly) { |
1072 MockMediaSource source("bear-640x360-v_frag-cenc.mp4", | 1055 MockMediaSource source("bear-640x360-v_frag-cenc.mp4", kMP4Video, |
1073 kMP4Video, kAppendWholeFile, GetParam()); | 1056 kAppendWholeFile); |
1074 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); | 1057 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
1075 StartPipelineWithEncryptedMedia(&source, &encrypted_media); | 1058 StartPipelineWithEncryptedMedia(&source, &encrypted_media); |
1076 | 1059 |
1077 scoped_refptr<DecoderBuffer> second_file = | 1060 scoped_refptr<DecoderBuffer> second_file = |
1078 ReadTestDataFile("bear-1280x720-v_frag-cenc.mp4"); | 1061 ReadTestDataFile("bear-1280x720-v_frag-cenc.mp4"); |
1079 | 1062 |
1080 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), | 1063 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
1081 second_file->data(), second_file->data_size()); | 1064 second_file->data(), second_file->data_size()); |
1082 | 1065 |
1083 source.EndOfStream(); | 1066 source.EndOfStream(); |
1084 | 1067 |
1085 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 1068 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
1086 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 1069 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
1087 EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs, | 1070 EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs, |
1088 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 1071 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
1089 | 1072 |
1090 Play(); | 1073 Play(); |
1091 | 1074 |
1092 EXPECT_TRUE(WaitUntilOnEnded()); | 1075 EXPECT_TRUE(WaitUntilOnEnded()); |
1093 source.Abort(); | 1076 source.Abort(); |
1094 Stop(); | 1077 Stop(); |
1095 } | 1078 } |
1096 | 1079 |
1097 TEST_P(PipelineIntegrationTest, | 1080 TEST_F(PipelineIntegrationTest, |
1098 MediaSource_ConfigChange_Encrypted_MP4_CENC_KeyRotation_VideoOnly) { | 1081 MediaSource_ConfigChange_Encrypted_MP4_CENC_KeyRotation_VideoOnly) { |
1099 MockMediaSource source("bear-640x360-v_frag-cenc-key_rotation.mp4", | 1082 MockMediaSource source("bear-640x360-v_frag-cenc-key_rotation.mp4", kMP4Video, |
1100 kMP4Video, kAppendWholeFile, GetParam()); | 1083 kAppendWholeFile); |
1101 FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp()); | 1084 FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp()); |
1102 StartPipelineWithEncryptedMedia(&source, &encrypted_media); | 1085 StartPipelineWithEncryptedMedia(&source, &encrypted_media); |
1103 | 1086 |
1104 scoped_refptr<DecoderBuffer> second_file = | 1087 scoped_refptr<DecoderBuffer> second_file = |
1105 ReadTestDataFile("bear-1280x720-v_frag-cenc-key_rotation.mp4"); | 1088 ReadTestDataFile("bear-1280x720-v_frag-cenc-key_rotation.mp4"); |
1106 | 1089 |
1107 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), | 1090 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
1108 second_file->data(), second_file->data_size()); | 1091 second_file->data(), second_file->data_size()); |
1109 | 1092 |
1110 source.EndOfStream(); | 1093 source.EndOfStream(); |
1111 | 1094 |
1112 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 1095 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
1113 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 1096 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
1114 EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs, | 1097 EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs, |
1115 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 1098 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
1116 | 1099 |
1117 Play(); | 1100 Play(); |
1118 | 1101 |
1119 EXPECT_TRUE(WaitUntilOnEnded()); | 1102 EXPECT_TRUE(WaitUntilOnEnded()); |
1120 source.Abort(); | 1103 source.Abort(); |
1121 Stop(); | 1104 Stop(); |
1122 } | 1105 } |
1123 | 1106 |
1124 // Config changes from clear to encrypted are not currently supported. | 1107 // Config changes from clear to encrypted are not currently supported. |
1125 // TODO(ddorwin): Figure out why this CHECKs in AppendAtTime(). | 1108 // TODO(ddorwin): Figure out why this CHECKs in AppendAtTime(). |
1126 TEST_P(PipelineIntegrationTest, | 1109 TEST_F(PipelineIntegrationTest, |
1127 DISABLED_MediaSource_ConfigChange_ClearThenEncrypted_MP4_CENC) { | 1110 DISABLED_MediaSource_ConfigChange_ClearThenEncrypted_MP4_CENC) { |
1128 MockMediaSource source("bear-640x360-av_frag.mp4", kMP4Video, | 1111 MockMediaSource source("bear-640x360-av_frag.mp4", kMP4Video, |
1129 kAppendWholeFile, GetParam()); | 1112 kAppendWholeFile); |
1130 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); | 1113 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
1131 StartPipelineWithEncryptedMedia(&source, &encrypted_media); | 1114 StartPipelineWithEncryptedMedia(&source, &encrypted_media); |
1132 | 1115 |
1133 scoped_refptr<DecoderBuffer> second_file = | 1116 scoped_refptr<DecoderBuffer> second_file = |
1134 ReadTestDataFile("bear-1280x720-v_frag-cenc.mp4"); | 1117 ReadTestDataFile("bear-1280x720-v_frag-cenc.mp4"); |
1135 | 1118 |
1136 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), | 1119 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
1137 second_file->data(), second_file->data_size()); | 1120 second_file->data(), second_file->data_size()); |
1138 | 1121 |
1139 source.EndOfStream(); | 1122 source.EndOfStream(); |
1140 | 1123 |
1141 message_loop_.Run(); | 1124 message_loop_.Run(); |
1142 EXPECT_EQ(PIPELINE_ERROR_DECODE, pipeline_status_); | 1125 EXPECT_EQ(PIPELINE_ERROR_DECODE, pipeline_status_); |
1143 | 1126 |
1144 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 1127 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
1145 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 1128 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
1146 // The second video was not added, so its time has not been added. | 1129 // The second video was not added, so its time has not been added. |
1147 EXPECT_EQ(k640IsoFileDurationMs, | 1130 EXPECT_EQ(k640IsoFileDurationMs, |
1148 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 1131 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
1149 | 1132 |
1150 Play(); | 1133 Play(); |
1151 | 1134 |
1152 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); | 1135 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); |
1153 source.Abort(); | 1136 source.Abort(); |
1154 } | 1137 } |
1155 | 1138 |
1156 // Config changes from encrypted to clear are not currently supported. | 1139 // Config changes from encrypted to clear are not currently supported. |
1157 TEST_P(PipelineIntegrationTest, | 1140 TEST_F(PipelineIntegrationTest, |
1158 MediaSource_ConfigChange_EncryptedThenClear_MP4_CENC) { | 1141 MediaSource_ConfigChange_EncryptedThenClear_MP4_CENC) { |
1159 MockMediaSource source("bear-640x360-v_frag-cenc.mp4", | 1142 MockMediaSource source("bear-640x360-v_frag-cenc.mp4", kMP4Video, |
1160 kMP4Video, kAppendWholeFile, GetParam()); | 1143 kAppendWholeFile); |
1161 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); | 1144 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
1162 StartPipelineWithEncryptedMedia(&source, &encrypted_media); | 1145 StartPipelineWithEncryptedMedia(&source, &encrypted_media); |
1163 | 1146 |
1164 scoped_refptr<DecoderBuffer> second_file = | 1147 scoped_refptr<DecoderBuffer> second_file = |
1165 ReadTestDataFile("bear-1280x720-av_frag.mp4"); | 1148 ReadTestDataFile("bear-1280x720-av_frag.mp4"); |
1166 | 1149 |
1167 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), | 1150 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
1168 second_file->data(), second_file->data_size()); | 1151 second_file->data(), second_file->data_size()); |
1169 | 1152 |
1170 source.EndOfStream(); | 1153 source.EndOfStream(); |
(...skipping 20 matching lines...) Expand all Loading... |
1191 | 1174 |
1192 #endif | 1175 #endif |
1193 | 1176 |
1194 TEST_F(PipelineIntegrationTest, BasicPlayback_16x9AspectRatio) { | 1177 TEST_F(PipelineIntegrationTest, BasicPlayback_16x9AspectRatio) { |
1195 ASSERT_TRUE(Start(GetTestDataFilePath("bear-320x240-16x9-aspect.webm"), | 1178 ASSERT_TRUE(Start(GetTestDataFilePath("bear-320x240-16x9-aspect.webm"), |
1196 PIPELINE_OK)); | 1179 PIPELINE_OK)); |
1197 Play(); | 1180 Play(); |
1198 ASSERT_TRUE(WaitUntilOnEnded()); | 1181 ASSERT_TRUE(WaitUntilOnEnded()); |
1199 } | 1182 } |
1200 | 1183 |
1201 TEST_P(PipelineIntegrationTest, EncryptedPlayback_WebM) { | 1184 TEST_F(PipelineIntegrationTest, EncryptedPlayback_WebM) { |
1202 MockMediaSource source("bear-320x240-av_enc-av.webm", kWebM, 219816, | 1185 MockMediaSource source("bear-320x240-av_enc-av.webm", kWebM, 219816); |
1203 GetParam()); | |
1204 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); | 1186 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
1205 StartPipelineWithEncryptedMedia(&source, &encrypted_media); | 1187 StartPipelineWithEncryptedMedia(&source, &encrypted_media); |
1206 | 1188 |
1207 source.EndOfStream(); | 1189 source.EndOfStream(); |
1208 ASSERT_EQ(PIPELINE_OK, pipeline_status_); | 1190 ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
1209 | 1191 |
1210 Play(); | 1192 Play(); |
1211 | 1193 |
1212 ASSERT_TRUE(WaitUntilOnEnded()); | 1194 ASSERT_TRUE(WaitUntilOnEnded()); |
1213 source.Abort(); | 1195 source.Abort(); |
1214 Stop(); | 1196 Stop(); |
1215 } | 1197 } |
1216 | 1198 |
1217 TEST_P(PipelineIntegrationTest, EncryptedPlayback_ClearStart_WebM) { | 1199 TEST_F(PipelineIntegrationTest, EncryptedPlayback_ClearStart_WebM) { |
1218 MockMediaSource source("bear-320x240-av_enc-av_clear-1s.webm", | 1200 MockMediaSource source("bear-320x240-av_enc-av_clear-1s.webm", kWebM, |
1219 kWebM, kAppendWholeFile, GetParam()); | 1201 kAppendWholeFile); |
1220 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); | 1202 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
1221 StartPipelineWithEncryptedMedia(&source, &encrypted_media); | 1203 StartPipelineWithEncryptedMedia(&source, &encrypted_media); |
1222 | 1204 |
1223 source.EndOfStream(); | 1205 source.EndOfStream(); |
1224 ASSERT_EQ(PIPELINE_OK, pipeline_status_); | 1206 ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
1225 | 1207 |
1226 Play(); | 1208 Play(); |
1227 | 1209 |
1228 ASSERT_TRUE(WaitUntilOnEnded()); | 1210 ASSERT_TRUE(WaitUntilOnEnded()); |
1229 source.Abort(); | 1211 source.Abort(); |
1230 Stop(); | 1212 Stop(); |
1231 } | 1213 } |
1232 | 1214 |
1233 TEST_P(PipelineIntegrationTest, EncryptedPlayback_NoEncryptedFrames_WebM) { | 1215 TEST_F(PipelineIntegrationTest, EncryptedPlayback_NoEncryptedFrames_WebM) { |
1234 MockMediaSource source("bear-320x240-av_enc-av_clear-all.webm", | 1216 MockMediaSource source("bear-320x240-av_enc-av_clear-all.webm", kWebM, |
1235 kWebM, kAppendWholeFile, GetParam()); | 1217 kAppendWholeFile); |
1236 FakeEncryptedMedia encrypted_media(new NoResponseApp()); | 1218 FakeEncryptedMedia encrypted_media(new NoResponseApp()); |
1237 StartPipelineWithEncryptedMedia(&source, &encrypted_media); | 1219 StartPipelineWithEncryptedMedia(&source, &encrypted_media); |
1238 | 1220 |
1239 source.EndOfStream(); | 1221 source.EndOfStream(); |
1240 ASSERT_EQ(PIPELINE_OK, pipeline_status_); | 1222 ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
1241 | 1223 |
1242 Play(); | 1224 Play(); |
1243 | 1225 |
1244 ASSERT_TRUE(WaitUntilOnEnded()); | 1226 ASSERT_TRUE(WaitUntilOnEnded()); |
1245 source.Abort(); | 1227 source.Abort(); |
1246 Stop(); | 1228 Stop(); |
1247 } | 1229 } |
1248 | 1230 |
1249 #if defined(USE_PROPRIETARY_CODECS) | 1231 #if defined(USE_PROPRIETARY_CODECS) |
1250 TEST_P(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_VideoOnly) { | 1232 TEST_F(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_VideoOnly) { |
1251 MockMediaSource source("bear-1280x720-v_frag-cenc.mp4", | 1233 MockMediaSource source("bear-1280x720-v_frag-cenc.mp4", kMP4Video, |
1252 kMP4Video, kAppendWholeFile, GetParam()); | 1234 kAppendWholeFile); |
1253 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); | 1235 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
1254 StartPipelineWithEncryptedMedia(&source, &encrypted_media); | 1236 StartPipelineWithEncryptedMedia(&source, &encrypted_media); |
1255 | 1237 |
1256 source.EndOfStream(); | 1238 source.EndOfStream(); |
1257 ASSERT_EQ(PIPELINE_OK, pipeline_status_); | 1239 ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
1258 | 1240 |
1259 Play(); | 1241 Play(); |
1260 | 1242 |
1261 ASSERT_TRUE(WaitUntilOnEnded()); | 1243 ASSERT_TRUE(WaitUntilOnEnded()); |
1262 source.Abort(); | 1244 source.Abort(); |
1263 Stop(); | 1245 Stop(); |
1264 } | 1246 } |
1265 | 1247 |
1266 TEST_P(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_AudioOnly) { | 1248 TEST_F(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_AudioOnly) { |
1267 MockMediaSource source("bear-1280x720-a_frag-cenc.mp4", | 1249 MockMediaSource source("bear-1280x720-a_frag-cenc.mp4", kMP4Audio, |
1268 kMP4Audio, kAppendWholeFile, GetParam()); | 1250 kAppendWholeFile); |
1269 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); | 1251 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
1270 StartPipelineWithEncryptedMedia(&source, &encrypted_media); | 1252 StartPipelineWithEncryptedMedia(&source, &encrypted_media); |
1271 | 1253 |
1272 source.EndOfStream(); | 1254 source.EndOfStream(); |
1273 ASSERT_EQ(PIPELINE_OK, pipeline_status_); | 1255 ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
1274 | 1256 |
1275 Play(); | 1257 Play(); |
1276 | 1258 |
1277 ASSERT_TRUE(WaitUntilOnEnded()); | 1259 ASSERT_TRUE(WaitUntilOnEnded()); |
1278 source.Abort(); | 1260 source.Abort(); |
1279 Stop(); | 1261 Stop(); |
1280 } | 1262 } |
1281 | 1263 |
1282 TEST_P(PipelineIntegrationTest, | 1264 TEST_F(PipelineIntegrationTest, |
1283 EncryptedPlayback_NoEncryptedFrames_MP4_CENC_VideoOnly) { | 1265 EncryptedPlayback_NoEncryptedFrames_MP4_CENC_VideoOnly) { |
1284 MockMediaSource source("bear-1280x720-v_frag-cenc_clear-all.mp4", | 1266 MockMediaSource source("bear-1280x720-v_frag-cenc_clear-all.mp4", kMP4Video, |
1285 kMP4Video, kAppendWholeFile, GetParam()); | 1267 kAppendWholeFile); |
1286 FakeEncryptedMedia encrypted_media(new NoResponseApp()); | 1268 FakeEncryptedMedia encrypted_media(new NoResponseApp()); |
1287 StartPipelineWithEncryptedMedia(&source, &encrypted_media); | 1269 StartPipelineWithEncryptedMedia(&source, &encrypted_media); |
1288 | 1270 |
1289 source.EndOfStream(); | 1271 source.EndOfStream(); |
1290 ASSERT_EQ(PIPELINE_OK, pipeline_status_); | 1272 ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
1291 | 1273 |
1292 Play(); | 1274 Play(); |
1293 | 1275 |
1294 ASSERT_TRUE(WaitUntilOnEnded()); | 1276 ASSERT_TRUE(WaitUntilOnEnded()); |
1295 source.Abort(); | 1277 source.Abort(); |
1296 Stop(); | 1278 Stop(); |
1297 } | 1279 } |
1298 | 1280 |
1299 TEST_P(PipelineIntegrationTest, | 1281 TEST_F(PipelineIntegrationTest, |
1300 EncryptedPlayback_NoEncryptedFrames_MP4_CENC_AudioOnly) { | 1282 EncryptedPlayback_NoEncryptedFrames_MP4_CENC_AudioOnly) { |
1301 MockMediaSource source("bear-1280x720-a_frag-cenc_clear-all.mp4", | 1283 MockMediaSource source("bear-1280x720-a_frag-cenc_clear-all.mp4", kMP4Audio, |
1302 kMP4Audio, kAppendWholeFile, GetParam()); | 1284 kAppendWholeFile); |
1303 FakeEncryptedMedia encrypted_media(new NoResponseApp()); | 1285 FakeEncryptedMedia encrypted_media(new NoResponseApp()); |
1304 StartPipelineWithEncryptedMedia(&source, &encrypted_media); | 1286 StartPipelineWithEncryptedMedia(&source, &encrypted_media); |
1305 | 1287 |
1306 source.EndOfStream(); | 1288 source.EndOfStream(); |
1307 ASSERT_EQ(PIPELINE_OK, pipeline_status_); | 1289 ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
1308 | 1290 |
1309 Play(); | 1291 Play(); |
1310 | 1292 |
1311 ASSERT_TRUE(WaitUntilOnEnded()); | 1293 ASSERT_TRUE(WaitUntilOnEnded()); |
1312 source.Abort(); | 1294 source.Abort(); |
1313 Stop(); | 1295 Stop(); |
1314 } | 1296 } |
1315 | 1297 |
1316 TEST_P(PipelineIntegrationTest, BasicPlayback_MediaSource_VideoOnly_MP4_AVC3) { | 1298 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VideoOnly_MP4_AVC3) { |
1317 MockMediaSource source("bear-1280x720-v_frag-avc3.mp4", kMP4VideoAVC3, | 1299 MockMediaSource source("bear-1280x720-v_frag-avc3.mp4", kMP4VideoAVC3, |
1318 kAppendWholeFile, GetParam()); | 1300 kAppendWholeFile); |
1319 StartPipelineWithMediaSource(&source); | 1301 StartPipelineWithMediaSource(&source); |
1320 source.EndOfStream(); | 1302 source.EndOfStream(); |
1321 | 1303 |
1322 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 1304 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
1323 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 1305 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
1324 EXPECT_EQ(k1280IsoAVC3FileDurationMs, | 1306 EXPECT_EQ(k1280IsoAVC3FileDurationMs, |
1325 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 1307 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
1326 | 1308 |
1327 Play(); | 1309 Play(); |
1328 | 1310 |
1329 ASSERT_TRUE(WaitUntilOnEnded()); | 1311 ASSERT_TRUE(WaitUntilOnEnded()); |
1330 source.Abort(); | 1312 source.Abort(); |
1331 Stop(); | 1313 Stop(); |
1332 } | 1314 } |
1333 | 1315 |
1334 TEST_P(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_KeyRotation_Video) { | 1316 TEST_F(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_KeyRotation_Video) { |
1335 MockMediaSource source("bear-1280x720-v_frag-cenc-key_rotation.mp4", | 1317 MockMediaSource source("bear-1280x720-v_frag-cenc-key_rotation.mp4", |
1336 kMP4Video, kAppendWholeFile, GetParam()); | 1318 kMP4Video, kAppendWholeFile); |
1337 FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp()); | 1319 FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp()); |
1338 StartPipelineWithEncryptedMedia(&source, &encrypted_media); | 1320 StartPipelineWithEncryptedMedia(&source, &encrypted_media); |
1339 | 1321 |
1340 source.EndOfStream(); | 1322 source.EndOfStream(); |
1341 ASSERT_EQ(PIPELINE_OK, pipeline_status_); | 1323 ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
1342 | 1324 |
1343 Play(); | 1325 Play(); |
1344 | 1326 |
1345 ASSERT_TRUE(WaitUntilOnEnded()); | 1327 ASSERT_TRUE(WaitUntilOnEnded()); |
1346 source.Abort(); | 1328 source.Abort(); |
1347 Stop(); | 1329 Stop(); |
1348 } | 1330 } |
1349 | 1331 |
1350 TEST_P(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_KeyRotation_Audio) { | 1332 TEST_F(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_KeyRotation_Audio) { |
1351 MockMediaSource source("bear-1280x720-a_frag-cenc-key_rotation.mp4", | 1333 MockMediaSource source("bear-1280x720-a_frag-cenc-key_rotation.mp4", |
1352 kMP4Audio, kAppendWholeFile, GetParam()); | 1334 kMP4Audio, kAppendWholeFile); |
1353 FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp()); | 1335 FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp()); |
1354 StartPipelineWithEncryptedMedia(&source, &encrypted_media); | 1336 StartPipelineWithEncryptedMedia(&source, &encrypted_media); |
1355 | 1337 |
1356 source.EndOfStream(); | 1338 source.EndOfStream(); |
1357 ASSERT_EQ(PIPELINE_OK, pipeline_status_); | 1339 ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
1358 | 1340 |
1359 Play(); | 1341 Play(); |
1360 | 1342 |
1361 ASSERT_TRUE(WaitUntilOnEnded()); | 1343 ASSERT_TRUE(WaitUntilOnEnded()); |
1362 source.Abort(); | 1344 source.Abort(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1402 EXPECT_GE(pipeline_->GetMediaTime(), seek_time); | 1384 EXPECT_GE(pipeline_->GetMediaTime(), seek_time); |
1403 ASSERT_TRUE(WaitUntilOnEnded()); | 1385 ASSERT_TRUE(WaitUntilOnEnded()); |
1404 | 1386 |
1405 // Make sure seeking after reaching the end works as expected. | 1387 // Make sure seeking after reaching the end works as expected. |
1406 ASSERT_TRUE(Seek(seek_time)); | 1388 ASSERT_TRUE(Seek(seek_time)); |
1407 EXPECT_GE(pipeline_->GetMediaTime(), seek_time); | 1389 EXPECT_GE(pipeline_->GetMediaTime(), seek_time); |
1408 ASSERT_TRUE(WaitUntilOnEnded()); | 1390 ASSERT_TRUE(WaitUntilOnEnded()); |
1409 } | 1391 } |
1410 | 1392 |
1411 // Verify audio decoder & renderer can handle aborted demuxer reads. | 1393 // Verify audio decoder & renderer can handle aborted demuxer reads. |
1412 TEST_P(PipelineIntegrationTest, ChunkDemuxerAbortRead_AudioOnly) { | 1394 TEST_F(PipelineIntegrationTest, ChunkDemuxerAbortRead_AudioOnly) { |
1413 ASSERT_TRUE(TestSeekDuringRead("bear-320x240-audio-only.webm", kAudioOnlyWebM, | 1395 ASSERT_TRUE(TestSeekDuringRead("bear-320x240-audio-only.webm", kAudioOnlyWebM, |
1414 8192, | 1396 8192, |
1415 base::TimeDelta::FromMilliseconds(464), | 1397 base::TimeDelta::FromMilliseconds(464), |
1416 base::TimeDelta::FromMilliseconds(617), | 1398 base::TimeDelta::FromMilliseconds(617), |
1417 0x10CA, 19730)); | 1399 0x10CA, 19730)); |
1418 } | 1400 } |
1419 | 1401 |
1420 // Verify video decoder & renderer can handle aborted demuxer reads. | 1402 // Verify video decoder & renderer can handle aborted demuxer reads. |
1421 TEST_P(PipelineIntegrationTest, ChunkDemuxerAbortRead_VideoOnly) { | 1403 TEST_F(PipelineIntegrationTest, ChunkDemuxerAbortRead_VideoOnly) { |
1422 ASSERT_TRUE(TestSeekDuringRead("bear-320x240-video-only.webm", kVideoOnlyWebM, | 1404 ASSERT_TRUE(TestSeekDuringRead("bear-320x240-video-only.webm", kVideoOnlyWebM, |
1423 32768, | 1405 32768, |
1424 base::TimeDelta::FromMilliseconds(167), | 1406 base::TimeDelta::FromMilliseconds(167), |
1425 base::TimeDelta::FromMilliseconds(1668), | 1407 base::TimeDelta::FromMilliseconds(1668), |
1426 0x1C896, 65536)); | 1408 0x1C896, 65536)); |
1427 } | 1409 } |
1428 | 1410 |
1429 // Verify that Opus audio in WebM containers can be played back. | 1411 // Verify that Opus audio in WebM containers can be played back. |
1430 TEST_F(PipelineIntegrationTest, BasicPlayback_AudioOnly_Opus_WebM) { | 1412 TEST_F(PipelineIntegrationTest, BasicPlayback_AudioOnly_Opus_WebM) { |
1431 ASSERT_TRUE(Start(GetTestDataFilePath("bear-opus-end-trimming.webm"), | 1413 ASSERT_TRUE(Start(GetTestDataFilePath("bear-opus-end-trimming.webm"), |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1488 } | 1470 } |
1489 | 1471 |
1490 // Verify that videos with an odd frame size playback successfully. | 1472 // Verify that videos with an odd frame size playback successfully. |
1491 TEST_F(PipelineIntegrationTest, BasicPlayback_OddVideoSize) { | 1473 TEST_F(PipelineIntegrationTest, BasicPlayback_OddVideoSize) { |
1492 ASSERT_TRUE(Start(GetTestDataFilePath("butterfly-853x480.webm"), | 1474 ASSERT_TRUE(Start(GetTestDataFilePath("butterfly-853x480.webm"), |
1493 PIPELINE_OK)); | 1475 PIPELINE_OK)); |
1494 Play(); | 1476 Play(); |
1495 ASSERT_TRUE(WaitUntilOnEnded()); | 1477 ASSERT_TRUE(WaitUntilOnEnded()); |
1496 } | 1478 } |
1497 | 1479 |
1498 // For MediaSource tests, generate two sets of tests: one using FrameProcessor, | |
1499 // and one using LegacyFrameProcessor. | |
1500 INSTANTIATE_TEST_CASE_P(NewFrameProcessor, PipelineIntegrationTest, | |
1501 Values(false)); | |
1502 INSTANTIATE_TEST_CASE_P(LegacyFrameProcessor, PipelineIntegrationTest, | |
1503 Values(true)); | |
1504 | |
1505 } // namespace media | 1480 } // namespace media |
OLD | NEW |