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