Chromium Code Reviews| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "media/base/cdm_callback_promise.h" | 10 #include "media/base/cdm_callback_promise.h" |
| 11 #include "media/base/cdm_context.h" | 11 #include "media/base/cdm_context.h" |
| 12 #include "media/base/decoder_buffer.h" | 12 #include "media/base/decoder_buffer.h" |
| 13 #include "media/base/media.h" | |
| 13 #include "media/base/media_keys.h" | 14 #include "media/base/media_keys.h" |
| 14 #include "media/base/media_switches.h" | 15 #include "media/base/media_switches.h" |
| 15 #include "media/base/test_data_util.h" | 16 #include "media/base/test_data_util.h" |
| 16 #include "media/cdm/aes_decryptor.h" | 17 #include "media/cdm/aes_decryptor.h" |
| 17 #include "media/cdm/json_web_key.h" | 18 #include "media/cdm/json_web_key.h" |
| 18 #include "media/filters/chunk_demuxer.h" | 19 #include "media/filters/chunk_demuxer.h" |
| 19 #include "media/filters/renderer_impl.h" | 20 #include "media/filters/renderer_impl.h" |
| 20 #include "media/test/pipeline_integration_test_base.h" | 21 #include "media/test/pipeline_integration_test_base.h" |
| 21 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
| 22 | 23 |
| 24 #if defined(MOJO_RENDERER) | |
| 25 #include "media/mojo/services/mojo_renderer_impl.h" | |
| 26 #include "mojo/public/cpp/application/application_impl.h" | |
| 27 #include "mojo/public/cpp/application/application_test_base.h" | |
| 28 #include "mojo/public/cpp/application/connect.h" | |
| 29 | |
| 30 // TODO(dalecurtis): The mojo renderer is in another process, so we have no way | |
| 31 // currently to get hashes for video and audio samples. This also means that | |
| 32 // real audio plays out for each test. | |
| 33 #define DISABLE_HASH_CHECKS 1 | |
|
xhwang
2014/12/17 05:25:03
How about having a EXPECT_HASH or CHECK_HASH macro
DaleCurtis
2014/12/17 21:40:49
This makes sense.
| |
| 34 #define DISABLE_FORMAT_CHECKS 1 | |
|
xhwang
2014/12/17 05:25:03
ditto
DaleCurtis
2014/12/17 21:40:50
As does this.
| |
| 35 | |
| 36 // TODO(xhwang): EME support is not complete for the mojo renderer, so all | |
| 37 // encrypted tests are currently disabled. | |
| 38 #define DISABLE_EME_TESTS 1 | |
| 39 | |
| 40 // TODO(xhwang,dalecurtis): Text tracks are not currently supported by the mojo | |
| 41 // renderer. | |
| 42 #define DISABLE_TEXT_TRACK_TESTS 1 | |
|
xhwang
2014/12/17 05:25:03
ditto
DaleCurtis
2014/12/17 21:40:50
This doesn't make sense though, since it's an enti
| |
| 43 #endif | |
| 44 | |
| 23 using testing::_; | 45 using testing::_; |
| 24 using testing::AnyNumber; | 46 using testing::AnyNumber; |
| 25 using testing::AtLeast; | 47 using testing::AtLeast; |
| 26 using testing::AtMost; | 48 using testing::AtMost; |
| 27 using testing::SaveArg; | 49 using testing::SaveArg; |
| 28 | 50 |
| 29 namespace media { | 51 namespace media { |
| 30 | 52 |
| 31 const char kSourceId[] = "SourceId"; | 53 const char kSourceId[] = "SourceId"; |
| 32 const char kCencInitDataType[] = "cenc"; | 54 const char kCencInitDataType[] = "cenc"; |
| 33 const uint8 kInitData[] = { 0x69, 0x6e, 0x69, 0x74 }; | 55 const uint8 kInitData[] = { 0x69, 0x6e, 0x69, 0x74 }; |
| 34 | 56 |
| 35 const char kWebM[] = "video/webm; codecs=\"vp8,vorbis\""; | 57 const char kWebM[] = "video/webm; codecs=\"vp8,vorbis\""; |
| 36 const char kWebMVP9[] = "video/webm; codecs=\"vp9\""; | 58 const char kWebMVP9[] = "video/webm; codecs=\"vp9\""; |
| 37 const char kAudioOnlyWebM[] = "video/webm; codecs=\"vorbis\""; | 59 const char kAudioOnlyWebM[] = "video/webm; codecs=\"vorbis\""; |
| 38 const char kOpusAudioOnlyWebM[] = "video/webm; codecs=\"opus\""; | 60 const char kOpusAudioOnlyWebM[] = "video/webm; codecs=\"opus\""; |
| 39 const char kVideoOnlyWebM[] = "video/webm; codecs=\"vp8\""; | 61 const char kVideoOnlyWebM[] = "video/webm; codecs=\"vp8\""; |
| 40 #if defined(USE_PROPRIETARY_CODECS) | 62 #if defined(USE_PROPRIETARY_CODECS) |
| 41 const char kADTS[] = "audio/aac"; | 63 const char kADTS[] = "audio/aac"; |
| 42 const char kMP4[] = "video/mp4; codecs=\"avc1.4D4041,mp4a.40.2\""; | 64 const char kMP4[] = "video/mp4; codecs=\"avc1.4D4041,mp4a.40.2\""; |
| 65 const char kMP4VideoAVC3[] = "video/mp4; codecs=\"avc3.64001f\""; | |
| 66 #if !defined(DISABLE_EME_TESTS) | |
| 43 const char kMP4Video[] = "video/mp4; codecs=\"avc1.4D4041\""; | 67 const char kMP4Video[] = "video/mp4; codecs=\"avc1.4D4041\""; |
| 44 const char kMP4VideoAVC3[] = "video/mp4; codecs=\"avc3.64001f\""; | |
| 45 const char kMP4Audio[] = "audio/mp4; codecs=\"mp4a.40.2\""; | 68 const char kMP4Audio[] = "audio/mp4; codecs=\"mp4a.40.2\""; |
| 69 #endif // !defined(DISABLE_EME_TESTS) | |
| 46 const char kMP3[] = "audio/mpeg"; | 70 const char kMP3[] = "audio/mpeg"; |
| 47 #endif // defined(USE_PROPRIETARY_CODECS) | 71 #endif // defined(USE_PROPRIETARY_CODECS) |
| 48 | 72 |
| 49 // Key used to encrypt test files. | 73 // Key used to encrypt test files. |
| 50 const uint8 kSecretKey[] = { | 74 const uint8 kSecretKey[] = { |
| 51 0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b, | 75 0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b, |
| 52 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c | 76 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c |
| 53 }; | 77 }; |
| 54 | 78 |
| 55 // The key ID for all encrypted files. | 79 // The key ID for all encrypted files. |
| 56 const uint8 kKeyId[] = { | 80 const uint8 kKeyId[] = { |
| 57 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, | 81 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, |
| 58 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35 | 82 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35 |
| 59 }; | 83 }; |
| 60 | 84 |
| 61 const int kAppendWholeFile = -1; | 85 const int kAppendWholeFile = -1; |
| 62 | 86 |
| 63 // Constants for the Media Source config change tests. | 87 // Constants for the Media Source config change tests. |
| 64 const int kAppendTimeSec = 1; | 88 const int kAppendTimeSec = 1; |
| 65 const int kAppendTimeMs = kAppendTimeSec * 1000; | 89 const int kAppendTimeMs = kAppendTimeSec * 1000; |
| 66 const int k320WebMFileDurationMs = 2736; | 90 const int k320WebMFileDurationMs = 2736; |
| 67 const int k640WebMFileDurationMs = 2749; | 91 const int k640WebMFileDurationMs = 2749; |
| 68 const int kOpusEndTrimmingWebMFileDurationMs = 2741; | 92 const int kOpusEndTrimmingWebMFileDurationMs = 2741; |
| 69 const int kVP9WebMFileDurationMs = 2736; | 93 const int kVP9WebMFileDurationMs = 2736; |
| 70 const int kVP8AWebMFileDurationMs = 2733; | 94 const int kVP8AWebMFileDurationMs = 2733; |
| 71 | 95 |
| 72 #if defined(USE_PROPRIETARY_CODECS) | 96 #if defined(USE_PROPRIETARY_CODECS) |
| 97 #if !defined(DISABLE_EME_TESTS) | |
| 73 const int k640IsoFileDurationMs = 2737; | 98 const int k640IsoFileDurationMs = 2737; |
| 74 const int k640IsoCencFileDurationMs = 2736; | 99 const int k640IsoCencFileDurationMs = 2736; |
| 100 #endif // !defined(DISABLE_EME_TESTS) | |
| 75 const int k1280IsoFileDurationMs = 2736; | 101 const int k1280IsoFileDurationMs = 2736; |
| 76 const int k1280IsoAVC3FileDurationMs = 2736; | 102 const int k1280IsoAVC3FileDurationMs = 2736; |
| 77 #endif // defined(USE_PROPRIETARY_CODECS) | 103 #endif // defined(USE_PROPRIETARY_CODECS) |
| 78 | 104 |
| 79 // Return a timeline offset for bear-320x240-live.webm. | 105 // Return a timeline offset for bear-320x240-live.webm. |
| 80 static base::Time kLiveTimelineOffset() { | 106 static base::Time kLiveTimelineOffset() { |
| 81 // The file contians the following UTC timeline offset: | 107 // The file contians the following UTC timeline offset: |
| 82 // 2012-11-10 12:34:56.789123456 | 108 // 2012-11-10 12:34:56.789123456 |
| 83 // Since base::Time only has a resolution of microseconds, | 109 // Since base::Time only has a resolution of microseconds, |
| 84 // construct a base::Time for 2012-11-10 12:34:56.789123. | 110 // construct a base::Time for 2012-11-10 12:34:56.789123. |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 549 scoped_refptr<DecoderBuffer> file_data_; | 575 scoped_refptr<DecoderBuffer> file_data_; |
| 550 int current_position_; | 576 int current_position_; |
| 551 int initial_append_size_; | 577 int initial_append_size_; |
| 552 std::string mimetype_; | 578 std::string mimetype_; |
| 553 ChunkDemuxer* chunk_demuxer_; | 579 ChunkDemuxer* chunk_demuxer_; |
| 554 scoped_ptr<Demuxer> owned_chunk_demuxer_; | 580 scoped_ptr<Demuxer> owned_chunk_demuxer_; |
| 555 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb_; | 581 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb_; |
| 556 base::TimeDelta last_timestamp_offset_; | 582 base::TimeDelta last_timestamp_offset_; |
| 557 }; | 583 }; |
| 558 | 584 |
| 559 class PipelineIntegrationTest | 585 #if defined(MOJO_RENDERER) |
| 560 : public testing::Test, | 586 class PipelineIntegrationTestHost : public mojo::test::ApplicationTestBase, |
| 561 public PipelineIntegrationTestBase { | 587 public PipelineIntegrationTestBase { |
| 588 public: | |
| 589 virtual bool ShouldCreateDefaultRunLoop() override { return false; } | |
|
xhwang
2014/12/17 05:25:03
s/virtual//
DaleCurtis
2014/12/17 21:40:50
Done.
| |
| 590 | |
| 591 virtual void SetUp() override { | |
|
xhwang
2014/12/17 05:25:03
s/virtual//
DaleCurtis
2014/12/17 21:40:50
Done.
| |
| 592 ApplicationTestBase::SetUp(); | |
| 593 | |
| 594 // TODO(dalecurtis): For some reason this isn't done... | |
| 595 if (!CommandLine::InitializedForCurrentProcess()) { | |
| 596 CommandLine::Init(0, NULL); | |
| 597 InitializeMediaLibraryForTesting(); | |
| 598 } | |
| 599 } | |
| 600 | |
| 601 protected: | |
| 602 scoped_ptr<Renderer> CreateRenderer() override { | |
| 603 mojo::ServiceProvider* service_provider = | |
| 604 application_impl() | |
| 605 ->ConnectToApplication("mojo://media") | |
| 606 ->GetServiceProvider(); | |
| 607 | |
| 608 mojo::MediaRendererPtr mojo_media_renderer; | |
| 609 mojo::ConnectToService(service_provider, &mojo_media_renderer); | |
| 610 return make_scoped_ptr(new MojoRendererImpl(message_loop_.task_runner(), | |
| 611 mojo_media_renderer.Pass())); | |
| 612 } | |
| 613 }; | |
| 614 #else | |
| 615 class PipelineIntegrationTestHost : public testing::Test, | |
| 616 public PipelineIntegrationTestBase {}; | |
| 617 #endif | |
| 618 | |
| 619 class PipelineIntegrationTest : public PipelineIntegrationTestHost { | |
| 562 public: | 620 public: |
| 563 void StartPipelineWithMediaSource(MockMediaSource* source) { | 621 void StartPipelineWithMediaSource(MockMediaSource* source) { |
| 564 EXPECT_CALL(*source, InitSegmentReceived()).Times(AtLeast(1)); | 622 EXPECT_CALL(*source, InitSegmentReceived()).Times(AtLeast(1)); |
| 565 EXPECT_CALL(*this, OnMetadata(_)) | 623 EXPECT_CALL(*this, OnMetadata(_)) |
| 566 .Times(AtMost(1)) | 624 .Times(AtMost(1)) |
| 567 .WillRepeatedly(SaveArg<0>(&metadata_)); | 625 .WillRepeatedly(SaveArg<0>(&metadata_)); |
| 568 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_ENOUGH)) | 626 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_ENOUGH)) |
| 569 .Times(AtMost(1)); | 627 .Times(AtMost(1)); |
| 570 demuxer_ = source->GetDemuxer().Pass(); | 628 demuxer_ = source->GetDemuxer().Pass(); |
| 571 pipeline_->Start( | 629 pipeline_->Start( |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 679 ASSERT_TRUE(WaitUntilOnEnded()); | 737 ASSERT_TRUE(WaitUntilOnEnded()); |
| 680 } | 738 } |
| 681 | 739 |
| 682 TEST_F(PipelineIntegrationTest, BasicPlaybackHashed) { | 740 TEST_F(PipelineIntegrationTest, BasicPlaybackHashed) { |
| 683 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm", kHashed)); | 741 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm", kHashed)); |
| 684 | 742 |
| 685 Play(); | 743 Play(); |
| 686 | 744 |
| 687 ASSERT_TRUE(WaitUntilOnEnded()); | 745 ASSERT_TRUE(WaitUntilOnEnded()); |
| 688 | 746 |
| 747 #if !defined(DISABLE_HASH_CHECKS) | |
| 689 EXPECT_EQ("f0be120a90a811506777c99a2cdf7cc1", GetVideoHash()); | 748 EXPECT_EQ("f0be120a90a811506777c99a2cdf7cc1", GetVideoHash()); |
| 690 EXPECT_EQ("-3.59,-2.06,-0.43,2.15,0.77,-0.95,", GetAudioHash()); | 749 EXPECT_EQ("-3.59,-2.06,-0.43,2.15,0.77,-0.95,", GetAudioHash()); |
| 750 #endif | |
| 691 EXPECT_TRUE(demuxer_->GetTimelineOffset().is_null()); | 751 EXPECT_TRUE(demuxer_->GetTimelineOffset().is_null()); |
| 692 } | 752 } |
| 693 | 753 |
| 694 TEST_F(PipelineIntegrationTest, BasicPlaybackLive) { | 754 TEST_F(PipelineIntegrationTest, BasicPlaybackLive) { |
| 695 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-live.webm", kHashed)); | 755 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-live.webm", kHashed)); |
| 696 | 756 |
| 697 Play(); | 757 Play(); |
| 698 | 758 |
| 699 ASSERT_TRUE(WaitUntilOnEnded()); | 759 ASSERT_TRUE(WaitUntilOnEnded()); |
| 700 | 760 |
| 761 #if !defined(DISABLE_HASH_CHECKS) | |
| 701 EXPECT_EQ("f0be120a90a811506777c99a2cdf7cc1", GetVideoHash()); | 762 EXPECT_EQ("f0be120a90a811506777c99a2cdf7cc1", GetVideoHash()); |
| 702 EXPECT_EQ("-3.59,-2.06,-0.43,2.15,0.77,-0.95,", GetAudioHash()); | 763 EXPECT_EQ("-3.59,-2.06,-0.43,2.15,0.77,-0.95,", GetAudioHash()); |
| 764 #endif | |
| 703 | 765 |
| 704 // TODO: Fix FFmpeg code to return higher resolution time values so | 766 // TODO: Fix FFmpeg code to return higher resolution time values so |
| 705 // we don't have to truncate our expectations here. | 767 // we don't have to truncate our expectations here. |
| 706 EXPECT_EQ(TruncateToFFmpegTimeResolution(kLiveTimelineOffset()), | 768 EXPECT_EQ(TruncateToFFmpegTimeResolution(kLiveTimelineOffset()), |
| 707 demuxer_->GetTimelineOffset()); | 769 demuxer_->GetTimelineOffset()); |
| 708 } | 770 } |
| 709 | 771 |
| 710 TEST_F(PipelineIntegrationTest, F32PlaybackHashed) { | 772 TEST_F(PipelineIntegrationTest, F32PlaybackHashed) { |
| 711 ASSERT_EQ(PIPELINE_OK, Start("sfx_f32le.wav", kHashed)); | 773 ASSERT_EQ(PIPELINE_OK, Start("sfx_f32le.wav", kHashed)); |
| 712 Play(); | 774 Play(); |
| 713 ASSERT_TRUE(WaitUntilOnEnded()); | 775 ASSERT_TRUE(WaitUntilOnEnded()); |
| 776 #if !defined(DISABLE_HASH_CHECKS) | |
| 714 EXPECT_EQ(std::string(kNullVideoHash), GetVideoHash()); | 777 EXPECT_EQ(std::string(kNullVideoHash), GetVideoHash()); |
| 715 EXPECT_EQ("3.03,2.86,2.99,3.31,3.57,4.06,", GetAudioHash()); | 778 EXPECT_EQ("3.03,2.86,2.99,3.31,3.57,4.06,", GetAudioHash()); |
| 779 #endif | |
| 716 } | 780 } |
| 717 | 781 |
| 782 #if !defined(DISABLE_EME_TESTS) | |
| 718 TEST_F(PipelineIntegrationTest, BasicPlaybackEncrypted) { | 783 TEST_F(PipelineIntegrationTest, BasicPlaybackEncrypted) { |
| 719 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); | 784 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
| 720 set_encrypted_media_init_data_cb( | 785 set_encrypted_media_init_data_cb( |
| 721 base::Bind(&FakeEncryptedMedia::OnEncryptedMediaInitData, | 786 base::Bind(&FakeEncryptedMedia::OnEncryptedMediaInitData, |
| 722 base::Unretained(&encrypted_media))); | 787 base::Unretained(&encrypted_media))); |
| 723 | 788 |
| 724 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-av_enc-av.webm", | 789 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-av_enc-av.webm", |
| 725 encrypted_media.GetCdmContext())); | 790 encrypted_media.GetCdmContext())); |
| 726 | 791 |
| 727 Play(); | 792 Play(); |
| 728 | 793 |
| 729 ASSERT_TRUE(WaitUntilOnEnded()); | 794 ASSERT_TRUE(WaitUntilOnEnded()); |
| 730 Stop(); | 795 Stop(); |
| 731 } | 796 } |
| 797 #endif // !defined(DISABLE_EME_TESTS) | |
| 732 | 798 |
| 733 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource) { | 799 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource) { |
| 734 MockMediaSource source("bear-320x240.webm", kWebM, 219229); | 800 MockMediaSource source("bear-320x240.webm", kWebM, 219229); |
| 735 StartPipelineWithMediaSource(&source); | 801 StartPipelineWithMediaSource(&source); |
| 736 source.EndOfStream(); | 802 source.EndOfStream(); |
| 737 | 803 |
| 738 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 804 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
| 739 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 805 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
| 740 EXPECT_EQ(k320WebMFileDurationMs, | 806 EXPECT_EQ(k320WebMFileDurationMs, |
| 741 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 807 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 835 base::TimeDelta seek_time = base::TimeDelta::FromMilliseconds(2000); | 901 base::TimeDelta seek_time = base::TimeDelta::FromMilliseconds(2000); |
| 836 | 902 |
| 837 Play(); | 903 Play(); |
| 838 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time)); | 904 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time)); |
| 839 source.Seek(seek_time, 0x1D5, 34017); | 905 source.Seek(seek_time, 0x1D5, 34017); |
| 840 source.EndOfStream(); | 906 source.EndOfStream(); |
| 841 ASSERT_TRUE(Seek(seek_time)); | 907 ASSERT_TRUE(Seek(seek_time)); |
| 842 | 908 |
| 843 ASSERT_TRUE(WaitUntilOnEnded()); | 909 ASSERT_TRUE(WaitUntilOnEnded()); |
| 844 | 910 |
| 911 #if !defined(DISABLE_HASH_CHECKS) | |
| 845 EXPECT_EQ("0.76,0.20,-0.82,-0.58,-1.29,-0.29,", GetAudioHash()); | 912 EXPECT_EQ("0.76,0.20,-0.82,-0.58,-1.29,-0.29,", GetAudioHash()); |
| 913 #endif | |
| 846 | 914 |
| 847 source.Abort(); | 915 source.Abort(); |
| 848 Stop(); | 916 Stop(); |
| 849 } | 917 } |
| 850 | 918 |
| 851 TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_WebM) { | 919 TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_WebM) { |
| 852 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, | 920 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, |
| 853 kAppendWholeFile); | 921 kAppendWholeFile); |
| 854 StartPipelineWithMediaSource(&source); | 922 StartPipelineWithMediaSource(&source); |
| 855 | 923 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 866 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs, | 934 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs, |
| 867 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 935 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
| 868 | 936 |
| 869 Play(); | 937 Play(); |
| 870 | 938 |
| 871 EXPECT_TRUE(WaitUntilOnEnded()); | 939 EXPECT_TRUE(WaitUntilOnEnded()); |
| 872 source.Abort(); | 940 source.Abort(); |
| 873 Stop(); | 941 Stop(); |
| 874 } | 942 } |
| 875 | 943 |
| 944 #if !defined(DISABLE_EME_TESTS) | |
| 876 TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_Encrypted_WebM) { | 945 TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_Encrypted_WebM) { |
| 877 MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM, | 946 MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM, |
| 878 kAppendWholeFile); | 947 kAppendWholeFile); |
| 879 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); | 948 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
| 880 StartPipelineWithEncryptedMedia(&source, &encrypted_media); | 949 StartPipelineWithEncryptedMedia(&source, &encrypted_media); |
| 881 | 950 |
| 882 scoped_refptr<DecoderBuffer> second_file = | 951 scoped_refptr<DecoderBuffer> second_file = |
| 883 ReadTestDataFile("bear-640x360-av_enc-av.webm"); | 952 ReadTestDataFile("bear-640x360-av_enc-av.webm"); |
| 884 | 953 |
| 885 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), | 954 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 950 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 1019 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
| 951 // The second video was not added, so its time has not been added. | 1020 // The second video was not added, so its time has not been added. |
| 952 EXPECT_EQ(k320WebMFileDurationMs, | 1021 EXPECT_EQ(k320WebMFileDurationMs, |
| 953 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 1022 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
| 954 | 1023 |
| 955 Play(); | 1024 Play(); |
| 956 | 1025 |
| 957 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); | 1026 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); |
| 958 source.Abort(); | 1027 source.Abort(); |
| 959 } | 1028 } |
| 1029 #endif // !defined(DISABLE_EME_TESTS) | |
| 960 | 1030 |
| 961 #if defined(USE_PROPRIETARY_CODECS) | 1031 #if defined(USE_PROPRIETARY_CODECS) |
| 962 TEST_F(PipelineIntegrationTest, MediaSource_ADTS) { | 1032 TEST_F(PipelineIntegrationTest, MediaSource_ADTS) { |
| 963 MockMediaSource source("sfx.adts", kADTS, kAppendWholeFile); | 1033 MockMediaSource source("sfx.adts", kADTS, kAppendWholeFile); |
| 964 StartPipelineWithMediaSource(&source); | 1034 StartPipelineWithMediaSource(&source); |
| 965 source.EndOfStream(); | 1035 source.EndOfStream(); |
| 966 | 1036 |
| 967 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 1037 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
| 968 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 1038 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
| 969 EXPECT_EQ(325, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 1039 EXPECT_EQ(325, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 995 | 1065 |
| 996 EXPECT_EQ(592, source.last_timestamp_offset().InMilliseconds()); | 1066 EXPECT_EQ(592, source.last_timestamp_offset().InMilliseconds()); |
| 997 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 1067 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
| 998 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 1068 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
| 999 EXPECT_EQ(592, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 1069 EXPECT_EQ(592, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
| 1000 | 1070 |
| 1001 Play(); | 1071 Play(); |
| 1002 | 1072 |
| 1003 EXPECT_TRUE(WaitUntilOnEnded()); | 1073 EXPECT_TRUE(WaitUntilOnEnded()); |
| 1004 | 1074 |
| 1075 #if !defined(DISABLE_HASH_CHECKS) | |
| 1005 // Verify preroll is stripped. | 1076 // Verify preroll is stripped. |
| 1006 EXPECT_EQ("-0.06,0.97,-0.90,-0.70,-0.53,-0.34,", GetAudioHash()); | 1077 EXPECT_EQ("-0.06,0.97,-0.90,-0.70,-0.53,-0.34,", GetAudioHash()); |
| 1078 #endif | |
| 1007 } | 1079 } |
| 1008 | 1080 |
| 1009 TEST_F(PipelineIntegrationTest, BasicPlaybackHashed_MP3) { | 1081 TEST_F(PipelineIntegrationTest, BasicPlaybackHashed_MP3) { |
| 1010 ASSERT_EQ(PIPELINE_OK, Start("sfx.mp3", kHashed)); | 1082 ASSERT_EQ(PIPELINE_OK, Start("sfx.mp3", kHashed)); |
| 1011 | 1083 |
| 1012 Play(); | 1084 Play(); |
| 1013 | 1085 |
| 1014 ASSERT_TRUE(WaitUntilOnEnded()); | 1086 ASSERT_TRUE(WaitUntilOnEnded()); |
| 1015 | 1087 |
| 1088 #if !defined(DISABLE_HASH_CHECKS) | |
| 1016 // Verify codec delay and preroll are stripped. | 1089 // Verify codec delay and preroll are stripped. |
| 1017 EXPECT_EQ("1.30,2.72,4.56,5.08,3.74,2.03,", GetAudioHash()); | 1090 EXPECT_EQ("1.30,2.72,4.56,5.08,3.74,2.03,", GetAudioHash()); |
| 1091 #endif | |
| 1018 } | 1092 } |
| 1019 | 1093 |
| 1020 TEST_F(PipelineIntegrationTest, MediaSource_MP3) { | 1094 TEST_F(PipelineIntegrationTest, MediaSource_MP3) { |
| 1021 MockMediaSource source("sfx.mp3", kMP3, kAppendWholeFile); | 1095 MockMediaSource source("sfx.mp3", kMP3, kAppendWholeFile); |
| 1022 StartHashedPipelineWithMediaSource(&source); | 1096 StartHashedPipelineWithMediaSource(&source); |
| 1023 source.EndOfStream(); | 1097 source.EndOfStream(); |
| 1024 | 1098 |
| 1025 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 1099 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
| 1026 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 1100 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
| 1027 EXPECT_EQ(313, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 1101 EXPECT_EQ(313, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
| 1028 | 1102 |
| 1029 Play(); | 1103 Play(); |
| 1030 | 1104 |
| 1031 EXPECT_TRUE(WaitUntilOnEnded()); | 1105 EXPECT_TRUE(WaitUntilOnEnded()); |
| 1032 | 1106 |
| 1107 #if !defined(DISABLE_HASH_CHECKS) | |
| 1033 // Verify that codec delay was stripped. | 1108 // Verify that codec delay was stripped. |
| 1034 EXPECT_EQ("1.01,2.71,4.18,4.32,3.04,1.12,", GetAudioHash()); | 1109 EXPECT_EQ("1.01,2.71,4.18,4.32,3.04,1.12,", GetAudioHash()); |
| 1110 #endif | |
| 1035 } | 1111 } |
| 1036 | 1112 |
| 1037 TEST_F(PipelineIntegrationTest, MediaSource_MP3_TimestampOffset) { | 1113 TEST_F(PipelineIntegrationTest, MediaSource_MP3_TimestampOffset) { |
| 1038 MockMediaSource source("sfx.mp3", kMP3, kAppendWholeFile); | 1114 MockMediaSource source("sfx.mp3", kMP3, kAppendWholeFile); |
| 1039 StartPipelineWithMediaSource(&source); | 1115 StartPipelineWithMediaSource(&source); |
| 1040 EXPECT_EQ(313, source.last_timestamp_offset().InMilliseconds()); | 1116 EXPECT_EQ(313, source.last_timestamp_offset().InMilliseconds()); |
| 1041 | 1117 |
| 1042 // There are 576 silent frames at the start of this mp3. The second append | 1118 // There are 576 silent frames at the start of this mp3. The second append |
| 1043 // should trim them off. | 1119 // should trim them off. |
| 1044 const base::TimeDelta mp3_preroll_duration = | 1120 const base::TimeDelta mp3_preroll_duration = |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1091 EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs, | 1167 EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs, |
| 1092 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 1168 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
| 1093 | 1169 |
| 1094 Play(); | 1170 Play(); |
| 1095 | 1171 |
| 1096 EXPECT_TRUE(WaitUntilOnEnded()); | 1172 EXPECT_TRUE(WaitUntilOnEnded()); |
| 1097 source.Abort(); | 1173 source.Abort(); |
| 1098 Stop(); | 1174 Stop(); |
| 1099 } | 1175 } |
| 1100 | 1176 |
| 1177 #if !defined(DISABLE_EME_TESTS) | |
| 1101 TEST_F(PipelineIntegrationTest, | 1178 TEST_F(PipelineIntegrationTest, |
| 1102 MediaSource_ConfigChange_Encrypted_MP4_CENC_VideoOnly) { | 1179 MediaSource_ConfigChange_Encrypted_MP4_CENC_VideoOnly) { |
| 1103 MockMediaSource source("bear-640x360-v_frag-cenc.mp4", kMP4Video, | 1180 MockMediaSource source("bear-640x360-v_frag-cenc.mp4", kMP4Video, |
| 1104 kAppendWholeFile); | 1181 kAppendWholeFile); |
| 1105 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); | 1182 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
| 1106 StartPipelineWithEncryptedMedia(&source, &encrypted_media); | 1183 StartPipelineWithEncryptedMedia(&source, &encrypted_media); |
| 1107 | 1184 |
| 1108 scoped_refptr<DecoderBuffer> second_file = | 1185 scoped_refptr<DecoderBuffer> second_file = |
| 1109 ReadTestDataFile("bear-1280x720-v_frag-cenc.mp4"); | 1186 ReadTestDataFile("bear-1280x720-v_frag-cenc.mp4"); |
| 1110 | 1187 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1204 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 1281 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
| 1205 // The second video was not added, so its time has not been added. | 1282 // The second video was not added, so its time has not been added. |
| 1206 EXPECT_EQ(k640IsoCencFileDurationMs, | 1283 EXPECT_EQ(k640IsoCencFileDurationMs, |
| 1207 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 1284 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
| 1208 | 1285 |
| 1209 Play(); | 1286 Play(); |
| 1210 | 1287 |
| 1211 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); | 1288 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); |
| 1212 source.Abort(); | 1289 source.Abort(); |
| 1213 } | 1290 } |
| 1291 #endif // !defined(DISABLE_EME_TESTS) | |
| 1214 | 1292 |
| 1215 // Verify files which change configuration midstream fail gracefully. | 1293 // Verify files which change configuration midstream fail gracefully. |
| 1216 TEST_F(PipelineIntegrationTest, MidStreamConfigChangesFail) { | 1294 TEST_F(PipelineIntegrationTest, MidStreamConfigChangesFail) { |
| 1217 ASSERT_EQ(PIPELINE_OK, Start("midstream_config_change.mp3")); | 1295 ASSERT_EQ(PIPELINE_OK, Start("midstream_config_change.mp3")); |
| 1218 Play(); | 1296 Play(); |
| 1219 ASSERT_EQ(WaitUntilEndedOrError(), PIPELINE_ERROR_DECODE); | 1297 ASSERT_EQ(WaitUntilEndedOrError(), PIPELINE_ERROR_DECODE); |
| 1220 } | 1298 } |
| 1221 | 1299 |
| 1222 #endif | 1300 #endif |
| 1223 | 1301 |
| 1224 TEST_F(PipelineIntegrationTest, BasicPlayback_16x9AspectRatio) { | 1302 TEST_F(PipelineIntegrationTest, BasicPlayback_16x9AspectRatio) { |
| 1225 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-16x9-aspect.webm")); | 1303 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-16x9-aspect.webm")); |
| 1226 Play(); | 1304 Play(); |
| 1227 ASSERT_TRUE(WaitUntilOnEnded()); | 1305 ASSERT_TRUE(WaitUntilOnEnded()); |
| 1228 } | 1306 } |
| 1229 | 1307 |
| 1308 #if !defined(DISABLE_EME_TESTS) | |
| 1230 TEST_F(PipelineIntegrationTest, EncryptedPlayback_WebM) { | 1309 TEST_F(PipelineIntegrationTest, EncryptedPlayback_WebM) { |
| 1231 MockMediaSource source("bear-320x240-av_enc-av.webm", kWebM, 219816); | 1310 MockMediaSource source("bear-320x240-av_enc-av.webm", kWebM, 219816); |
| 1232 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); | 1311 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
| 1233 StartPipelineWithEncryptedMedia(&source, &encrypted_media); | 1312 StartPipelineWithEncryptedMedia(&source, &encrypted_media); |
| 1234 | 1313 |
| 1235 source.EndOfStream(); | 1314 source.EndOfStream(); |
| 1236 ASSERT_EQ(PIPELINE_OK, pipeline_status_); | 1315 ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
| 1237 | 1316 |
| 1238 Play(); | 1317 Play(); |
| 1239 | 1318 |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 1266 | 1345 |
| 1267 source.EndOfStream(); | 1346 source.EndOfStream(); |
| 1268 ASSERT_EQ(PIPELINE_OK, pipeline_status_); | 1347 ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
| 1269 | 1348 |
| 1270 Play(); | 1349 Play(); |
| 1271 | 1350 |
| 1272 ASSERT_TRUE(WaitUntilOnEnded()); | 1351 ASSERT_TRUE(WaitUntilOnEnded()); |
| 1273 source.Abort(); | 1352 source.Abort(); |
| 1274 Stop(); | 1353 Stop(); |
| 1275 } | 1354 } |
| 1355 #endif // !defined(DISABLE_EME_TESTS) | |
| 1276 | 1356 |
| 1277 #if defined(USE_PROPRIETARY_CODECS) | 1357 #if defined(USE_PROPRIETARY_CODECS) |
| 1358 #if !defined(DISABLE_EME_TESTS) | |
| 1278 TEST_F(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_VideoOnly) { | 1359 TEST_F(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_VideoOnly) { |
| 1279 MockMediaSource source("bear-1280x720-v_frag-cenc.mp4", kMP4Video, | 1360 MockMediaSource source("bear-1280x720-v_frag-cenc.mp4", kMP4Video, |
| 1280 kAppendWholeFile); | 1361 kAppendWholeFile); |
| 1281 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); | 1362 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
| 1282 StartPipelineWithEncryptedMedia(&source, &encrypted_media); | 1363 StartPipelineWithEncryptedMedia(&source, &encrypted_media); |
| 1283 | 1364 |
| 1284 source.EndOfStream(); | 1365 source.EndOfStream(); |
| 1285 ASSERT_EQ(PIPELINE_OK, pipeline_status_); | 1366 ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
| 1286 | 1367 |
| 1287 Play(); | 1368 Play(); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1334 source.EndOfStream(); | 1415 source.EndOfStream(); |
| 1335 ASSERT_EQ(PIPELINE_OK, pipeline_status_); | 1416 ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
| 1336 | 1417 |
| 1337 Play(); | 1418 Play(); |
| 1338 | 1419 |
| 1339 ASSERT_TRUE(WaitUntilOnEnded()); | 1420 ASSERT_TRUE(WaitUntilOnEnded()); |
| 1340 source.Abort(); | 1421 source.Abort(); |
| 1341 Stop(); | 1422 Stop(); |
| 1342 } | 1423 } |
| 1343 | 1424 |
| 1344 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VideoOnly_MP4_AVC3) { | |
| 1345 MockMediaSource source("bear-1280x720-v_frag-avc3.mp4", kMP4VideoAVC3, | |
| 1346 kAppendWholeFile); | |
| 1347 StartPipelineWithMediaSource(&source); | |
| 1348 source.EndOfStream(); | |
| 1349 | |
| 1350 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | |
| 1351 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | |
| 1352 EXPECT_EQ(k1280IsoAVC3FileDurationMs, | |
| 1353 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | |
| 1354 | |
| 1355 Play(); | |
| 1356 | |
| 1357 ASSERT_TRUE(WaitUntilOnEnded()); | |
| 1358 source.Abort(); | |
| 1359 Stop(); | |
| 1360 } | |
| 1361 | |
| 1362 TEST_F(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_KeyRotation_Video) { | 1425 TEST_F(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_KeyRotation_Video) { |
| 1363 MockMediaSource source("bear-1280x720-v_frag-cenc-key_rotation.mp4", | 1426 MockMediaSource source("bear-1280x720-v_frag-cenc-key_rotation.mp4", |
| 1364 kMP4Video, kAppendWholeFile); | 1427 kMP4Video, kAppendWholeFile); |
| 1365 FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp()); | 1428 FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp()); |
| 1366 StartPipelineWithEncryptedMedia(&source, &encrypted_media); | 1429 StartPipelineWithEncryptedMedia(&source, &encrypted_media); |
| 1367 | 1430 |
| 1368 source.EndOfStream(); | 1431 source.EndOfStream(); |
| 1369 ASSERT_EQ(PIPELINE_OK, pipeline_status_); | 1432 ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
| 1370 | 1433 |
| 1371 Play(); | 1434 Play(); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1383 | 1446 |
| 1384 source.EndOfStream(); | 1447 source.EndOfStream(); |
| 1385 ASSERT_EQ(PIPELINE_OK, pipeline_status_); | 1448 ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
| 1386 | 1449 |
| 1387 Play(); | 1450 Play(); |
| 1388 | 1451 |
| 1389 ASSERT_TRUE(WaitUntilOnEnded()); | 1452 ASSERT_TRUE(WaitUntilOnEnded()); |
| 1390 source.Abort(); | 1453 source.Abort(); |
| 1391 Stop(); | 1454 Stop(); |
| 1392 } | 1455 } |
| 1393 #endif | 1456 #endif // !defined(DISABLE_EME_TESTS) |
| 1457 | |
| 1458 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VideoOnly_MP4_AVC3) { | |
| 1459 MockMediaSource source("bear-1280x720-v_frag-avc3.mp4", kMP4VideoAVC3, | |
| 1460 kAppendWholeFile); | |
| 1461 StartPipelineWithMediaSource(&source); | |
| 1462 source.EndOfStream(); | |
| 1463 | |
| 1464 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | |
| 1465 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | |
| 1466 EXPECT_EQ(k1280IsoAVC3FileDurationMs, | |
| 1467 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | |
| 1468 | |
| 1469 Play(); | |
| 1470 | |
| 1471 ASSERT_TRUE(WaitUntilOnEnded()); | |
| 1472 source.Abort(); | |
| 1473 Stop(); | |
| 1474 } | |
| 1475 #endif // defined(USE_PROPRIETARY_CODECS) | |
| 1394 | 1476 |
| 1395 TEST_F(PipelineIntegrationTest, SeekWhilePaused) { | 1477 TEST_F(PipelineIntegrationTest, SeekWhilePaused) { |
| 1396 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm")); | 1478 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm")); |
| 1397 | 1479 |
| 1398 base::TimeDelta duration(pipeline_->GetMediaDuration()); | 1480 base::TimeDelta duration(pipeline_->GetMediaDuration()); |
| 1399 base::TimeDelta start_seek_time(duration / 4); | 1481 base::TimeDelta start_seek_time(duration / 4); |
| 1400 base::TimeDelta seek_time(duration * 3 / 4); | 1482 base::TimeDelta seek_time(duration * 3 / 4); |
| 1401 | 1483 |
| 1402 Play(); | 1484 Play(); |
| 1403 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time)); | 1485 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time)); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1452 | 1534 |
| 1453 TEST_F(PipelineIntegrationTest, Rotated_Metadata_270) { | 1535 TEST_F(PipelineIntegrationTest, Rotated_Metadata_270) { |
| 1454 ASSERT_EQ(PIPELINE_OK, Start("bear_rotate_270.mp4")); | 1536 ASSERT_EQ(PIPELINE_OK, Start("bear_rotate_270.mp4")); |
| 1455 ASSERT_EQ(VIDEO_ROTATION_270, metadata_.video_rotation); | 1537 ASSERT_EQ(VIDEO_ROTATION_270, metadata_.video_rotation); |
| 1456 } | 1538 } |
| 1457 #endif | 1539 #endif |
| 1458 | 1540 |
| 1459 // Verify audio decoder & renderer can handle aborted demuxer reads. | 1541 // Verify audio decoder & renderer can handle aborted demuxer reads. |
| 1460 TEST_F(PipelineIntegrationTest, ChunkDemuxerAbortRead_AudioOnly) { | 1542 TEST_F(PipelineIntegrationTest, ChunkDemuxerAbortRead_AudioOnly) { |
| 1461 ASSERT_TRUE(TestSeekDuringRead("bear-320x240-audio-only.webm", kAudioOnlyWebM, | 1543 ASSERT_TRUE(TestSeekDuringRead("bear-320x240-audio-only.webm", kAudioOnlyWebM, |
| 1462 8192, | 1544 16384, |
| 1463 base::TimeDelta::FromMilliseconds(464), | 1545 base::TimeDelta::FromMilliseconds(464), |
| 1464 base::TimeDelta::FromMilliseconds(617), | 1546 base::TimeDelta::FromMilliseconds(617), |
| 1465 0x10CA, 19730)); | 1547 0x10CA, 19730)); |
| 1466 } | 1548 } |
| 1467 | 1549 |
| 1468 // Verify video decoder & renderer can handle aborted demuxer reads. | 1550 // Verify video decoder & renderer can handle aborted demuxer reads. |
| 1469 TEST_F(PipelineIntegrationTest, ChunkDemuxerAbortRead_VideoOnly) { | 1551 TEST_F(PipelineIntegrationTest, ChunkDemuxerAbortRead_VideoOnly) { |
| 1470 ASSERT_TRUE(TestSeekDuringRead("bear-320x240-video-only.webm", kVideoOnlyWebM, | 1552 ASSERT_TRUE(TestSeekDuringRead("bear-320x240-video-only.webm", kVideoOnlyWebM, |
| 1471 32768, | 1553 32768, |
| 1472 base::TimeDelta::FromMilliseconds(167), | 1554 base::TimeDelta::FromMilliseconds(167), |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 1494 ASSERT_EQ(PIPELINE_OK, Start("bear-vp9-opus.webm")); | 1576 ASSERT_EQ(PIPELINE_OK, Start("bear-vp9-opus.webm")); |
| 1495 Play(); | 1577 Play(); |
| 1496 ASSERT_TRUE(WaitUntilOnEnded()); | 1578 ASSERT_TRUE(WaitUntilOnEnded()); |
| 1497 } | 1579 } |
| 1498 | 1580 |
| 1499 // Verify that VP8 video with alpha channel can be played back. | 1581 // Verify that VP8 video with alpha channel can be played back. |
| 1500 TEST_F(PipelineIntegrationTest, BasicPlayback_VP8A_WebM) { | 1582 TEST_F(PipelineIntegrationTest, BasicPlayback_VP8A_WebM) { |
| 1501 ASSERT_EQ(PIPELINE_OK, Start("bear-vp8a.webm")); | 1583 ASSERT_EQ(PIPELINE_OK, Start("bear-vp8a.webm")); |
| 1502 Play(); | 1584 Play(); |
| 1503 ASSERT_TRUE(WaitUntilOnEnded()); | 1585 ASSERT_TRUE(WaitUntilOnEnded()); |
| 1586 | |
| 1587 #if !defined(DISABLE_FORMAT_CHECKS) | |
| 1504 EXPECT_EQ(last_video_frame_format_, VideoFrame::YV12A); | 1588 EXPECT_EQ(last_video_frame_format_, VideoFrame::YV12A); |
| 1589 #endif | |
| 1505 } | 1590 } |
| 1506 | 1591 |
| 1507 // Verify that VP8A video with odd width/height can be played back. | 1592 // Verify that VP8A video with odd width/height can be played back. |
| 1508 TEST_F(PipelineIntegrationTest, BasicPlayback_VP8A_Odd_WebM) { | 1593 TEST_F(PipelineIntegrationTest, BasicPlayback_VP8A_Odd_WebM) { |
| 1509 ASSERT_EQ(PIPELINE_OK, Start("bear-vp8a-odd-dimensions.webm")); | 1594 ASSERT_EQ(PIPELINE_OK, Start("bear-vp8a-odd-dimensions.webm")); |
| 1510 Play(); | 1595 Play(); |
| 1511 ASSERT_TRUE(WaitUntilOnEnded()); | 1596 ASSERT_TRUE(WaitUntilOnEnded()); |
| 1597 #if !defined(DISABLE_FORMAT_CHECKS) | |
| 1512 EXPECT_EQ(last_video_frame_format_, VideoFrame::YV12A); | 1598 EXPECT_EQ(last_video_frame_format_, VideoFrame::YV12A); |
| 1599 #endif | |
| 1513 } | 1600 } |
| 1514 | 1601 |
| 1515 // Verify that VP9 video with odd width/height can be played back. | 1602 // Verify that VP9 video with odd width/height can be played back. |
| 1516 TEST_F(PipelineIntegrationTest, BasicPlayback_VP9_Odd_WebM) { | 1603 TEST_F(PipelineIntegrationTest, BasicPlayback_VP9_Odd_WebM) { |
| 1517 ASSERT_EQ(PIPELINE_OK, Start("bear-vp9-odd-dimensions.webm")); | 1604 ASSERT_EQ(PIPELINE_OK, Start("bear-vp9-odd-dimensions.webm")); |
| 1518 Play(); | 1605 Play(); |
| 1519 ASSERT_TRUE(WaitUntilOnEnded()); | 1606 ASSERT_TRUE(WaitUntilOnEnded()); |
| 1520 } | 1607 } |
| 1521 | 1608 |
| 1609 #if !defined(DISABLE_TEXT_TRACK_TESTS) | |
| 1522 // Verify that VP8 video with inband text track can be played back. | 1610 // Verify that VP8 video with inband text track can be played back. |
| 1523 TEST_F(PipelineIntegrationTest, BasicPlayback_VP8_WebVTT_WebM) { | 1611 TEST_F(PipelineIntegrationTest, BasicPlayback_VP8_WebVTT_WebM) { |
| 1524 EXPECT_CALL(*this, OnAddTextTrack(_, _)); | 1612 EXPECT_CALL(*this, OnAddTextTrack(_, _)); |
| 1525 ASSERT_EQ(PIPELINE_OK, Start("bear-vp8-webvtt.webm")); | 1613 ASSERT_EQ(PIPELINE_OK, Start("bear-vp8-webvtt.webm")); |
| 1526 Play(); | 1614 Play(); |
| 1527 ASSERT_TRUE(WaitUntilOnEnded()); | 1615 ASSERT_TRUE(WaitUntilOnEnded()); |
| 1528 } | 1616 } |
| 1617 #endif // !defined(DISABLE_TEXT_TRACK_TESTS) | |
| 1529 | 1618 |
| 1530 // Verify that VP9 video with 4:4:4 subsampling can be played back. | 1619 // Verify that VP9 video with 4:4:4 subsampling can be played back. |
| 1531 TEST_F(PipelineIntegrationTest, P444_VP9_WebM) { | 1620 TEST_F(PipelineIntegrationTest, P444_VP9_WebM) { |
| 1532 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-P444.webm")); | 1621 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-P444.webm")); |
| 1533 Play(); | 1622 Play(); |
| 1534 ASSERT_TRUE(WaitUntilOnEnded()); | 1623 ASSERT_TRUE(WaitUntilOnEnded()); |
| 1624 #if !defined(DISABLE_FORMAT_CHECKS) | |
| 1535 EXPECT_EQ(last_video_frame_format_, VideoFrame::YV24); | 1625 EXPECT_EQ(last_video_frame_format_, VideoFrame::YV24); |
| 1626 #endif | |
| 1536 } | 1627 } |
| 1537 | 1628 |
| 1538 // Verify that videos with an odd frame size playback successfully. | 1629 // Verify that videos with an odd frame size playback successfully. |
| 1539 TEST_F(PipelineIntegrationTest, BasicPlayback_OddVideoSize) { | 1630 TEST_F(PipelineIntegrationTest, BasicPlayback_OddVideoSize) { |
| 1540 ASSERT_EQ(PIPELINE_OK, Start("butterfly-853x480.webm")); | 1631 ASSERT_EQ(PIPELINE_OK, Start("butterfly-853x480.webm")); |
| 1541 Play(); | 1632 Play(); |
| 1542 ASSERT_TRUE(WaitUntilOnEnded()); | 1633 ASSERT_TRUE(WaitUntilOnEnded()); |
| 1543 } | 1634 } |
| 1544 | 1635 |
| 1545 // Verify that OPUS audio in a webm which reports a 44.1kHz sample rate plays | 1636 // Verify that OPUS audio in a webm which reports a 44.1kHz sample rate plays |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1610 | 1701 |
| 1611 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { | 1702 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { |
| 1612 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); | 1703 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); |
| 1613 Play(); | 1704 Play(); |
| 1614 ASSERT_TRUE(WaitUntilOnEnded()); | 1705 ASSERT_TRUE(WaitUntilOnEnded()); |
| 1615 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), | 1706 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), |
| 1616 demuxer_->GetStartTime()); | 1707 demuxer_->GetStartTime()); |
| 1617 } | 1708 } |
| 1618 | 1709 |
| 1619 } // namespace media | 1710 } // namespace media |
| OLD | NEW |