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