Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: media/test/pipeline_integration_test.cc

Issue 1591103002: Fix and enable mojo:media_pipeline_integration_apptests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add deps in src/BUILD.gn (plus rebase) Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/mojo/services/BUILD.gn ('k') | mojo/tools/data/apptests » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #define EXPECT_VIDEO_FORMAT_EQ(a, b) 46 #define EXPECT_VIDEO_FORMAT_EQ(a, b)
47 #define EXPECT_COLOR_SPACE_EQ(a, b) 47 #define EXPECT_COLOR_SPACE_EQ(a, b)
48 48
49 // TODO(xhwang): EME support is not complete for the mojo renderer, so all 49 // TODO(xhwang): EME support is not complete for the mojo renderer, so all
50 // encrypted tests are currently disabled. 50 // encrypted tests are currently disabled.
51 #define DISABLE_EME_TESTS 1 51 #define DISABLE_EME_TESTS 1
52 52
53 // TODO(xhwang,dalecurtis): Text tracks are not currently supported by the mojo 53 // TODO(xhwang,dalecurtis): Text tracks are not currently supported by the mojo
54 // renderer. 54 // renderer.
55 #define DISABLE_TEXT_TRACK_TESTS 1 55 #define DISABLE_TEXT_TRACK_TESTS 1
56
57 // TODO(jrummell, dalecurtis): Clockless playback does not currently work with
58 // mojo, so the tests take too long to run.
59 #define DISABLE_CLOCKLESS_TESTS 1
56 #else 60 #else
57 #define EXPECT_HASH_EQ(a, b) EXPECT_EQ(a, b) 61 #define EXPECT_HASH_EQ(a, b) EXPECT_EQ(a, b)
58 #define EXPECT_VIDEO_FORMAT_EQ(a, b) EXPECT_EQ(a, b) 62 #define EXPECT_VIDEO_FORMAT_EQ(a, b) EXPECT_EQ(a, b)
59 #define EXPECT_COLOR_SPACE_EQ(a, b) EXPECT_EQ(a, b) 63 #define EXPECT_COLOR_SPACE_EQ(a, b) EXPECT_EQ(a, b)
64 #endif // defined(MOJO_RENDERER)
65
66 #if defined(DISABLE_EME_TESTS)
67 #define MAYBE_EME(test) DISABLED_##test
68 #else
69 #define MAYBE_EME(test) test
70 #endif
71
72 #if defined(DISABLE_TEXT_TRACK_TESTS)
73 #define MAYBE_TEXT(test) DISABLED_##test
74 #else
75 #define MAYBE_TEXT(test) test
76 #endif
77
78 #if defined(DISABLE_CLOCKLESS_TESTS)
79 #define MAYBE_CLOCKLESS(test) DISABLED_##test
80 #else
81 #define MAYBE_CLOCKLESS(test) test
60 #endif 82 #endif
61 83
62 using testing::_; 84 using testing::_;
63 using testing::AnyNumber; 85 using testing::AnyNumber;
64 using testing::AtLeast; 86 using testing::AtLeast;
65 using testing::AtMost; 87 using testing::AtMost;
66 using testing::SaveArg; 88 using testing::SaveArg;
67 89
68 namespace media { 90 namespace media {
69 91
70 const char kSourceId[] = "SourceId"; 92 const char kSourceId[] = "SourceId";
71 93
72 const char kWebM[] = "video/webm; codecs=\"vp8,vorbis\""; 94 const char kWebM[] = "video/webm; codecs=\"vp8,vorbis\"";
73 const char kWebMVP9[] = "video/webm; codecs=\"vp9\""; 95 const char kWebMVP9[] = "video/webm; codecs=\"vp9\"";
74 const char kAudioOnlyWebM[] = "video/webm; codecs=\"vorbis\""; 96 const char kAudioOnlyWebM[] = "video/webm; codecs=\"vorbis\"";
75 const char kOpusAudioOnlyWebM[] = "video/webm; codecs=\"opus\""; 97 const char kOpusAudioOnlyWebM[] = "video/webm; codecs=\"opus\"";
76 const char kVideoOnlyWebM[] = "video/webm; codecs=\"vp8\""; 98 const char kVideoOnlyWebM[] = "video/webm; codecs=\"vp8\"";
77 #if defined(USE_PROPRIETARY_CODECS) 99 #if defined(USE_PROPRIETARY_CODECS)
78 const char kADTS[] = "audio/aac"; 100 const char kADTS[] = "audio/aac";
79 const char kMP4[] = "video/mp4; codecs=\"avc1.4D4041,mp4a.40.2\""; 101 const char kMP4[] = "video/mp4; codecs=\"avc1.4D4041,mp4a.40.2\"";
80 const char kMP4VideoAVC3[] = "video/mp4; codecs=\"avc3.64001f\""; 102 const char kMP4VideoAVC3[] = "video/mp4; codecs=\"avc3.64001f\"";
81 #if !defined(DISABLE_EME_TESTS)
82 const char kMP4Video[] = "video/mp4; codecs=\"avc1.4D4041\""; 103 const char kMP4Video[] = "video/mp4; codecs=\"avc1.4D4041\"";
83 const char kMP4Audio[] = "audio/mp4; codecs=\"mp4a.40.2\""; 104 const char kMP4Audio[] = "audio/mp4; codecs=\"mp4a.40.2\"";
84 #endif // !defined(DISABLE_EME_TESTS)
85 const char kMP3[] = "audio/mpeg"; 105 const char kMP3[] = "audio/mpeg";
86 #endif // defined(USE_PROPRIETARY_CODECS) 106 #endif // defined(USE_PROPRIETARY_CODECS)
87 107
88 // Key used to encrypt test files. 108 // Key used to encrypt test files.
89 const uint8_t kSecretKey[] = { 109 const uint8_t kSecretKey[] = {
90 0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b, 110 0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b,
91 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c 111 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c
92 }; 112 };
93 113
94 // The key ID for all encrypted files. 114 // The key ID for all encrypted files.
95 const uint8_t kKeyId[] = { 115 const uint8_t kKeyId[] = {
96 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 116 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
97 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35 117 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35
98 }; 118 };
99 119
100 const size_t kAppendWholeFile = std::numeric_limits<size_t>::max(); 120 const size_t kAppendWholeFile = std::numeric_limits<size_t>::max();
101 121
102 // Constants for the Media Source config change tests. 122 // Constants for the Media Source config change tests.
103 const int kAppendTimeSec = 1; 123 const int kAppendTimeSec = 1;
104 const int kAppendTimeMs = kAppendTimeSec * 1000; 124 const int kAppendTimeMs = kAppendTimeSec * 1000;
105 const int k320WebMFileDurationMs = 2736; 125 const int k320WebMFileDurationMs = 2736;
106 #if !defined(DISABLE_EME_TESTS)
107 const int k320EncWebMFileDurationMs = 2737; 126 const int k320EncWebMFileDurationMs = 2737;
108 #endif // !defined(DISABLE_EME_TESTS)
109 const int k640WebMFileDurationMs = 2749; 127 const int k640WebMFileDurationMs = 2749;
110 const int kOpusEndTrimmingWebMFileDurationMs = 2741; 128 const int kOpusEndTrimmingWebMFileDurationMs = 2741;
111 const int kVP9WebMFileDurationMs = 2736; 129 const int kVP9WebMFileDurationMs = 2736;
112 const int kVP8AWebMFileDurationMs = 2734; 130 const int kVP8AWebMFileDurationMs = 2734;
113 131
114 #if !defined(MOJO_RENDERER) 132 #if !defined(MOJO_RENDERER)
115 #if defined(OPUS_FIXED_POINT) 133 #if defined(OPUS_FIXED_POINT)
116 static const char kOpusEndTrimmingHash_1[] = 134 static const char kOpusEndTrimmingHash_1[] =
117 "-4.57,-5.68,-6.54,-6.29,-4.35,-3.59,"; 135 "-4.57,-5.68,-6.54,-6.29,-4.35,-3.59,";
118 static const char kOpusEndTrimmingHash_2[] = 136 static const char kOpusEndTrimmingHash_2[] =
119 "-11.93,-11.12,-8.27,-7.10,-7.84,-10.00,"; 137 "-11.93,-11.12,-8.27,-7.10,-7.84,-10.00,";
120 static const char kOpusEndTrimmingHash_3[] = 138 static const char kOpusEndTrimmingHash_3[] =
121 "-13.32,-14.38,-13.70,-11.69,-10.20,-10.48,"; 139 "-13.32,-14.38,-13.70,-11.69,-10.20,-10.48,";
122 #else 140 #else
123 // Hash for a full playthrough of "opus-trimming-test.(webm|ogg)". 141 // Hash for a full playthrough of "opus-trimming-test.(webm|ogg)".
124 static const char kOpusEndTrimmingHash_1[] = 142 static const char kOpusEndTrimmingHash_1[] =
125 "-4.56,-5.65,-6.51,-6.29,-4.36,-3.59,"; 143 "-4.56,-5.65,-6.51,-6.29,-4.36,-3.59,";
126 // The above hash, plus an additional playthrough starting from T=1s. 144 // The above hash, plus an additional playthrough starting from T=1s.
127 static const char kOpusEndTrimmingHash_2[] = 145 static const char kOpusEndTrimmingHash_2[] =
128 "-11.89,-11.09,-8.25,-7.11,-7.84,-9.97,"; 146 "-11.89,-11.09,-8.25,-7.11,-7.84,-9.97,";
129 // The above hash, plus an additional playthrough starting from T=6.36s. 147 // The above hash, plus an additional playthrough starting from T=6.36s.
130 static const char kOpusEndTrimmingHash_3[] = 148 static const char kOpusEndTrimmingHash_3[] =
131 "-13.28,-14.35,-13.67,-11.68,-10.18,-10.46,"; 149 "-13.28,-14.35,-13.67,-11.68,-10.18,-10.46,";
132 #endif // defined(OPUS_FIXED_POINT) 150 #endif // defined(OPUS_FIXED_POINT)
133 #endif 151 #endif // !defined(MOJO_RENDERER)
134 152
135 #if defined(USE_PROPRIETARY_CODECS) 153 #if defined(USE_PROPRIETARY_CODECS)
136 #if !defined(DISABLE_EME_TESTS)
137 const int k640IsoFileDurationMs = 2737; 154 const int k640IsoFileDurationMs = 2737;
138 const int k640IsoCencFileDurationMs = 2736; 155 const int k640IsoCencFileDurationMs = 2736;
139 #endif // !defined(DISABLE_EME_TESTS)
140 const int k1280IsoFileDurationMs = 2736; 156 const int k1280IsoFileDurationMs = 2736;
141 const int k1280IsoAVC3FileDurationMs = 2736; 157 const int k1280IsoAVC3FileDurationMs = 2736;
142 #endif // defined(USE_PROPRIETARY_CODECS) 158 #endif // defined(USE_PROPRIETARY_CODECS)
143 159
144 // Return a timeline offset for bear-320x240-live.webm. 160 // Return a timeline offset for bear-320x240-live.webm.
145 static base::Time kLiveTimelineOffset() { 161 static base::Time kLiveTimelineOffset() {
146 // The file contians the following UTC timeline offset: 162 // The file contians the following UTC timeline offset:
147 // 2012-11-10 12:34:56.789123456 163 // 2012-11-10 12:34:56.789123456
148 // Since base::Time only has a resolution of microseconds, 164 // Since base::Time only has a resolution of microseconds,
149 // construct a base::Time for 2012-11-10 12:34:56.789123. 165 // construct a base::Time for 2012-11-10 12:34:56.789123.
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 return make_scoped_ptr(new MojoRendererImpl(message_loop_.task_runner(), 686 return make_scoped_ptr(new MojoRendererImpl(message_loop_.task_runner(),
671 std::move(mojo_renderer))); 687 std::move(mojo_renderer)));
672 } 688 }
673 689
674 private: 690 private:
675 interfaces::ServiceFactoryPtr media_service_factory_; 691 interfaces::ServiceFactoryPtr media_service_factory_;
676 }; 692 };
677 #else 693 #else
678 class PipelineIntegrationTestHost : public testing::Test, 694 class PipelineIntegrationTestHost : public testing::Test,
679 public PipelineIntegrationTestBase {}; 695 public PipelineIntegrationTestBase {};
680 #endif 696 #endif // defined(MOJO_RENDERER)
681 697
682 class PipelineIntegrationTest : public PipelineIntegrationTestHost { 698 class PipelineIntegrationTest : public PipelineIntegrationTestHost {
683 public: 699 public:
684 void StartPipelineWithMediaSource(MockMediaSource* source) { 700 void StartPipelineWithMediaSource(MockMediaSource* source) {
685 EXPECT_CALL(*source, InitSegmentReceived()).Times(AtLeast(1)); 701 EXPECT_CALL(*source, InitSegmentReceived()).Times(AtLeast(1));
686 EXPECT_CALL(*this, OnMetadata(_)) 702 EXPECT_CALL(*this, OnMetadata(_))
687 .Times(AtMost(1)) 703 .Times(AtMost(1))
688 .WillRepeatedly(SaveArg<0>(&metadata_)); 704 .WillRepeatedly(SaveArg<0>(&metadata_));
689 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_ENOUGH)) 705 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_ENOUGH))
690 .Times(AnyNumber()); 706 .Times(AnyNumber());
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 839
824 Play(); 840 Play();
825 841
826 ASSERT_TRUE(WaitUntilOnEnded()); 842 ASSERT_TRUE(WaitUntilOnEnded());
827 843
828 EXPECT_HASH_EQ("f0be120a90a811506777c99a2cdf7cc1", GetVideoHash()); 844 EXPECT_HASH_EQ("f0be120a90a811506777c99a2cdf7cc1", GetVideoHash());
829 EXPECT_HASH_EQ("-3.59,-2.06,-0.43,2.15,0.77,-0.95,", GetAudioHash()); 845 EXPECT_HASH_EQ("-3.59,-2.06,-0.43,2.15,0.77,-0.95,", GetAudioHash());
830 EXPECT_TRUE(demuxer_->GetTimelineOffset().is_null()); 846 EXPECT_TRUE(demuxer_->GetTimelineOffset().is_null());
831 } 847 }
832 848
833 TEST_F(PipelineIntegrationTest, BasicPlaybackOpusOggTrimmingHashed) { 849 TEST_F(PipelineIntegrationTest,
850 MAYBE_CLOCKLESS(BasicPlaybackOpusOggTrimmingHashed)) {
834 ASSERT_EQ(PIPELINE_OK, 851 ASSERT_EQ(PIPELINE_OK,
835 Start("opus-trimming-test.webm", kHashed | kClockless)); 852 Start("opus-trimming-test.webm", kHashed | kClockless));
836 853
837 Play(); 854 Play();
838 855
839 ASSERT_TRUE(WaitUntilOnEnded()); 856 ASSERT_TRUE(WaitUntilOnEnded());
840 EXPECT_HASH_EQ(kOpusEndTrimmingHash_1, GetAudioHash()); 857 EXPECT_HASH_EQ(kOpusEndTrimmingHash_1, GetAudioHash());
841 858
842 // Seek within the pre-skip section, this should not cause a beep. 859 // Seek within the pre-skip section, this should not cause a beep.
843 ASSERT_TRUE(Seek(base::TimeDelta::FromSeconds(1))); 860 ASSERT_TRUE(Seek(base::TimeDelta::FromSeconds(1)));
844 Play(); 861 Play();
845 ASSERT_TRUE(WaitUntilOnEnded()); 862 ASSERT_TRUE(WaitUntilOnEnded());
846 EXPECT_HASH_EQ(kOpusEndTrimmingHash_2, GetAudioHash()); 863 EXPECT_HASH_EQ(kOpusEndTrimmingHash_2, GetAudioHash());
847 864
848 // Seek somewhere outside of the pre-skip / end-trim section, demxuer should 865 // Seek somewhere outside of the pre-skip / end-trim section, demxuer should
849 // correctly preroll enough to accurately decode this segment. 866 // correctly preroll enough to accurately decode this segment.
850 ASSERT_TRUE(Seek(base::TimeDelta::FromMilliseconds(6360))); 867 ASSERT_TRUE(Seek(base::TimeDelta::FromMilliseconds(6360)));
851 Play(); 868 Play();
852 ASSERT_TRUE(WaitUntilOnEnded()); 869 ASSERT_TRUE(WaitUntilOnEnded());
853 EXPECT_HASH_EQ(kOpusEndTrimmingHash_3, GetAudioHash()); 870 EXPECT_HASH_EQ(kOpusEndTrimmingHash_3, GetAudioHash());
854 } 871 }
855 872
856 TEST_F(PipelineIntegrationTest, BasicPlaybackOpusWebmTrimmingHashed) { 873 TEST_F(PipelineIntegrationTest,
874 MAYBE_CLOCKLESS(BasicPlaybackOpusWebmTrimmingHashed)) {
857 ASSERT_EQ(PIPELINE_OK, 875 ASSERT_EQ(PIPELINE_OK,
858 Start("opus-trimming-test.webm", kHashed | kClockless)); 876 Start("opus-trimming-test.webm", kHashed | kClockless));
859 877
860 Play(); 878 Play();
861 879
862 ASSERT_TRUE(WaitUntilOnEnded()); 880 ASSERT_TRUE(WaitUntilOnEnded());
863 EXPECT_HASH_EQ(kOpusEndTrimmingHash_1, GetAudioHash()); 881 EXPECT_HASH_EQ(kOpusEndTrimmingHash_1, GetAudioHash());
864 882
865 // Seek within the pre-skip section, this should not cause a beep. 883 // Seek within the pre-skip section, this should not cause a beep.
866 ASSERT_TRUE(Seek(base::TimeDelta::FromSeconds(1))); 884 ASSERT_TRUE(Seek(base::TimeDelta::FromSeconds(1)));
867 Play(); 885 Play();
868 ASSERT_TRUE(WaitUntilOnEnded()); 886 ASSERT_TRUE(WaitUntilOnEnded());
869 EXPECT_HASH_EQ(kOpusEndTrimmingHash_2, GetAudioHash()); 887 EXPECT_HASH_EQ(kOpusEndTrimmingHash_2, GetAudioHash());
870 888
871 // Seek somewhere outside of the pre-skip / end-trim section, demxuer should 889 // Seek somewhere outside of the pre-skip / end-trim section, demxuer should
872 // correctly preroll enough to accurately decode this segment. 890 // correctly preroll enough to accurately decode this segment.
873 ASSERT_TRUE(Seek(base::TimeDelta::FromMilliseconds(6360))); 891 ASSERT_TRUE(Seek(base::TimeDelta::FromMilliseconds(6360)));
874 Play(); 892 Play();
875 ASSERT_TRUE(WaitUntilOnEnded()); 893 ASSERT_TRUE(WaitUntilOnEnded());
876 EXPECT_HASH_EQ(kOpusEndTrimmingHash_3, GetAudioHash()); 894 EXPECT_HASH_EQ(kOpusEndTrimmingHash_3, GetAudioHash());
877 } 895 }
878 896
879 TEST_F(PipelineIntegrationTest, 897 TEST_F(PipelineIntegrationTest,
880 BasicPlaybackOpusWebmTrimmingHashed_MediaSource) { 898 MAYBE_CLOCKLESS(BasicPlaybackOpusWebmTrimmingHashed_MediaSource)) {
881 MockMediaSource source("opus-trimming-test.webm", kOpusAudioOnlyWebM, 899 MockMediaSource source("opus-trimming-test.webm", kOpusAudioOnlyWebM,
882 kAppendWholeFile); 900 kAppendWholeFile);
883 StartHashedClocklessPipelineWithMediaSource(&source); 901 StartHashedClocklessPipelineWithMediaSource(&source);
884 source.EndOfStream(); 902 source.EndOfStream();
885 903
886 Play(); 904 Play();
887 905
888 ASSERT_TRUE(WaitUntilOnEnded()); 906 ASSERT_TRUE(WaitUntilOnEnded());
889 EXPECT_HASH_EQ(kOpusEndTrimmingHash_1, GetAudioHash()); 907 EXPECT_HASH_EQ(kOpusEndTrimmingHash_1, GetAudioHash());
890 908
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 } 953 }
936 954
937 TEST_F(PipelineIntegrationTest, F32PlaybackHashed) { 955 TEST_F(PipelineIntegrationTest, F32PlaybackHashed) {
938 ASSERT_EQ(PIPELINE_OK, Start("sfx_f32le.wav", kHashed)); 956 ASSERT_EQ(PIPELINE_OK, Start("sfx_f32le.wav", kHashed));
939 Play(); 957 Play();
940 ASSERT_TRUE(WaitUntilOnEnded()); 958 ASSERT_TRUE(WaitUntilOnEnded());
941 EXPECT_HASH_EQ(std::string(kNullVideoHash), GetVideoHash()); 959 EXPECT_HASH_EQ(std::string(kNullVideoHash), GetVideoHash());
942 EXPECT_HASH_EQ("3.03,2.86,2.99,3.31,3.57,4.06,", GetAudioHash()); 960 EXPECT_HASH_EQ("3.03,2.86,2.99,3.31,3.57,4.06,", GetAudioHash());
943 } 961 }
944 962
945 #if !defined(DISABLE_EME_TESTS) 963 TEST_F(PipelineIntegrationTest, MAYBE_EME(BasicPlaybackEncrypted)) {
946 TEST_F(PipelineIntegrationTest, BasicPlaybackEncrypted) {
947 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); 964 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
948 set_encrypted_media_init_data_cb( 965 set_encrypted_media_init_data_cb(
949 base::Bind(&FakeEncryptedMedia::OnEncryptedMediaInitData, 966 base::Bind(&FakeEncryptedMedia::OnEncryptedMediaInitData,
950 base::Unretained(&encrypted_media))); 967 base::Unretained(&encrypted_media)));
951 968
952 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-av_enc-av.webm", 969 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-av_enc-av.webm",
953 encrypted_media.GetCdmContext())); 970 encrypted_media.GetCdmContext()));
954 971
955 Play(); 972 Play();
956 973
957 ASSERT_TRUE(WaitUntilOnEnded()); 974 ASSERT_TRUE(WaitUntilOnEnded());
958 Stop(); 975 Stop();
959 } 976 }
960 #endif // !defined(DISABLE_EME_TESTS)
961 977
962 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource) { 978 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource) {
963 MockMediaSource source("bear-320x240.webm", kWebM, 219229); 979 MockMediaSource source("bear-320x240.webm", kWebM, 219229);
964 StartPipelineWithMediaSource(&source); 980 StartPipelineWithMediaSource(&source);
965 source.EndOfStream(); 981 source.EndOfStream();
966 982
967 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 983 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
968 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 984 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
969 EXPECT_EQ(k320WebMFileDurationMs, 985 EXPECT_EQ(k320WebMFileDurationMs,
970 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 986 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 source.AppendAtTime(media_time, file->data(), file->data_size()); 1165 source.AppendAtTime(media_time, file->data(), file->data_size());
1150 buffered_ranges = pipeline_->GetBufferedTimeRanges(); 1166 buffered_ranges = pipeline_->GetBufferedTimeRanges();
1151 } while (buffered_ranges.size() == 1 && 1167 } while (buffered_ranges.size() == 1 &&
1152 buffered_ranges.start(0) == base::TimeDelta::FromSeconds(0)); 1168 buffered_ranges.start(0) == base::TimeDelta::FromSeconds(0));
1153 1169
1154 EXPECT_EQ(1u, buffered_ranges.size()); 1170 EXPECT_EQ(1u, buffered_ranges.size());
1155 source.Shutdown(); 1171 source.Shutdown();
1156 Stop(); 1172 Stop();
1157 } 1173 }
1158 1174
1159 #if !defined(DISABLE_EME_TESTS) 1175 TEST_F(PipelineIntegrationTest,
1160 TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_Encrypted_WebM) { 1176 MAYBE_EME(MediaSource_ConfigChange_Encrypted_WebM)) {
1161 MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM, 1177 MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM,
1162 kAppendWholeFile); 1178 kAppendWholeFile);
1163 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); 1179 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1164 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1180 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1165 1181
1166 scoped_refptr<DecoderBuffer> second_file = 1182 scoped_refptr<DecoderBuffer> second_file =
1167 ReadTestDataFile("bear-640x360-av_enc-av.webm"); 1183 ReadTestDataFile("bear-640x360-av_enc-av.webm");
1168 1184
1169 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), 1185 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
1170 second_file->data(), second_file->data_size()); 1186 second_file->data(), second_file->data_size());
1171 1187
1172 source.EndOfStream(); 1188 source.EndOfStream();
1173 1189
1174 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1190 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1175 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1191 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1176 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs, 1192 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs,
1177 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1193 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1178 1194
1179 Play(); 1195 Play();
1180 1196
1181 EXPECT_TRUE(WaitUntilOnEnded()); 1197 EXPECT_TRUE(WaitUntilOnEnded());
1182 source.Shutdown(); 1198 source.Shutdown();
1183 Stop(); 1199 Stop();
1184 } 1200 }
1185 1201
1186 // Config changes from encrypted to clear are not currently supported. 1202 // Config changes from encrypted to clear are not currently supported.
1187 TEST_F(PipelineIntegrationTest, 1203 TEST_F(PipelineIntegrationTest,
1188 MediaSource_ConfigChange_ClearThenEncrypted_WebM) { 1204 MAYBE_EME(MediaSource_ConfigChange_ClearThenEncrypted_WebM)) {
1189 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, 1205 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM,
1190 kAppendWholeFile); 1206 kAppendWholeFile);
1191 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); 1207 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1192 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1208 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1193 1209
1194 scoped_refptr<DecoderBuffer> second_file = 1210 scoped_refptr<DecoderBuffer> second_file =
1195 ReadTestDataFile("bear-640x360-av_enc-av.webm"); 1211 ReadTestDataFile("bear-640x360-av_enc-av.webm");
1196 1212
1197 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), 1213 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
1198 second_file->data(), second_file->data_size()); 1214 second_file->data(), second_file->data_size());
(...skipping 10 matching lines...) Expand all
1209 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1225 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1210 1226
1211 Play(); 1227 Play();
1212 1228
1213 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); 1229 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError());
1214 source.Shutdown(); 1230 source.Shutdown();
1215 } 1231 }
1216 1232
1217 // Config changes from clear to encrypted are not currently supported. 1233 // Config changes from clear to encrypted are not currently supported.
1218 TEST_F(PipelineIntegrationTest, 1234 TEST_F(PipelineIntegrationTest,
1219 MediaSource_ConfigChange_EncryptedThenClear_WebM) { 1235 MAYBE_EME(MediaSource_ConfigChange_EncryptedThenClear_WebM)) {
1220 MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM, 1236 MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM,
1221 kAppendWholeFile); 1237 kAppendWholeFile);
1222 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); 1238 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1223 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1239 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1224 1240
1225 scoped_refptr<DecoderBuffer> second_file = 1241 scoped_refptr<DecoderBuffer> second_file =
1226 ReadTestDataFile("bear-640x360.webm"); 1242 ReadTestDataFile("bear-640x360.webm");
1227 1243
1228 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), 1244 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
1229 second_file->data(), second_file->data_size()); 1245 second_file->data(), second_file->data_size());
1230 1246
1231 source.EndOfStream(); 1247 source.EndOfStream();
1232 1248
1233 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1249 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1234 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1250 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1235 // The second video was not added, so its time has not been added. 1251 // The second video was not added, so its time has not been added.
1236 EXPECT_EQ(k320EncWebMFileDurationMs, 1252 EXPECT_EQ(k320EncWebMFileDurationMs,
1237 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1253 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1238 1254
1239 Play(); 1255 Play();
1240 1256
1241 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); 1257 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError());
1242 source.Shutdown(); 1258 source.Shutdown();
1243 } 1259 }
1244 #endif // !defined(DISABLE_EME_TESTS)
1245 1260
1246 #if defined(USE_PROPRIETARY_CODECS) 1261 #if defined(USE_PROPRIETARY_CODECS)
1247 TEST_F(PipelineIntegrationTest, MediaSource_ADTS) { 1262 TEST_F(PipelineIntegrationTest, MediaSource_ADTS) {
1248 MockMediaSource source("sfx.adts", kADTS, kAppendWholeFile); 1263 MockMediaSource source("sfx.adts", kADTS, kAppendWholeFile);
1249 StartPipelineWithMediaSource(&source); 1264 StartPipelineWithMediaSource(&source);
1250 source.EndOfStream(); 1265 source.EndOfStream();
1251 1266
1252 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1267 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1253 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1268 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1254 EXPECT_EQ(325, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1269 EXPECT_EQ(325, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 ASSERT_EQ(PIPELINE_OK, Start("sfx.mp3", kHashed)); 1310 ASSERT_EQ(PIPELINE_OK, Start("sfx.mp3", kHashed));
1296 1311
1297 Play(); 1312 Play();
1298 1313
1299 ASSERT_TRUE(WaitUntilOnEnded()); 1314 ASSERT_TRUE(WaitUntilOnEnded());
1300 1315
1301 // Verify codec delay and preroll are stripped. 1316 // Verify codec delay and preroll are stripped.
1302 EXPECT_HASH_EQ("1.30,2.72,4.56,5.08,3.74,2.03,", GetAudioHash()); 1317 EXPECT_HASH_EQ("1.30,2.72,4.56,5.08,3.74,2.03,", GetAudioHash());
1303 } 1318 }
1304 1319
1320 #if !defined(DISABLE_CLOCKLESS_TESTS)
1305 class Mp3FastSeekParams { 1321 class Mp3FastSeekParams {
1306 public: 1322 public:
1307 Mp3FastSeekParams(const char* filename, const char* hash) 1323 Mp3FastSeekParams(const char* filename, const char* hash)
1308 : filename(filename), hash(hash) {} 1324 : filename(filename), hash(hash) {}
1309 const char* filename; 1325 const char* filename;
1310 const char* hash; 1326 const char* hash;
1311 }; 1327 };
1312 1328
1313 class Mp3FastSeekIntegrationTest 1329 class Mp3FastSeekIntegrationTest
1314 : public PipelineIntegrationTest, 1330 : public PipelineIntegrationTest,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 "0.95,0.56,1.34,0.47,1.77,0.84,"))); 1369 "0.95,0.56,1.34,0.47,1.77,0.84,")));
1354 1370
1355 // VBR seeks can be fast *OR* accurate, but not both. We chose fast. 1371 // VBR seeks can be fast *OR* accurate, but not both. We chose fast.
1356 INSTANTIATE_TEST_CASE_P( 1372 INSTANTIATE_TEST_CASE_P(
1357 VBRSeeks, 1373 VBRSeeks,
1358 Mp3FastSeekIntegrationTest, 1374 Mp3FastSeekIntegrationTest,
1359 ::testing::Values(Mp3FastSeekParams("bear-audio-10s-VBR-has-TOC.mp3", 1375 ::testing::Values(Mp3FastSeekParams("bear-audio-10s-VBR-has-TOC.mp3",
1360 "-0.15,-0.83,0.54,1.00,1.94,0.93,"), 1376 "-0.15,-0.83,0.54,1.00,1.94,0.93,"),
1361 Mp3FastSeekParams("bear-audio-10s-VBR-no-TOC.mp3", 1377 Mp3FastSeekParams("bear-audio-10s-VBR-no-TOC.mp3",
1362 "-0.22,0.80,1.19,0.73,-0.31,-1.12,"))); 1378 "-0.22,0.80,1.19,0.73,-0.31,-1.12,")));
1379 #endif // !defined(DISABLE_CLOCKLESS_TESTS)
1363 1380
1364 TEST_F(PipelineIntegrationTest, MediaSource_MP3) { 1381 TEST_F(PipelineIntegrationTest, MediaSource_MP3) {
1365 MockMediaSource source("sfx.mp3", kMP3, kAppendWholeFile); 1382 MockMediaSource source("sfx.mp3", kMP3, kAppendWholeFile);
1366 StartHashedPipelineWithMediaSource(&source); 1383 StartHashedPipelineWithMediaSource(&source);
1367 source.EndOfStream(); 1384 source.EndOfStream();
1368 1385
1369 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1386 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1370 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1387 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1371 EXPECT_EQ(313, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1388 EXPECT_EQ(313, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1372 1389
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1435 EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs, 1452 EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs,
1436 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1453 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1437 1454
1438 Play(); 1455 Play();
1439 1456
1440 EXPECT_TRUE(WaitUntilOnEnded()); 1457 EXPECT_TRUE(WaitUntilOnEnded());
1441 source.Shutdown(); 1458 source.Shutdown();
1442 Stop(); 1459 Stop();
1443 } 1460 }
1444 1461
1445 #if !defined(DISABLE_EME_TESTS)
1446 TEST_F(PipelineIntegrationTest, 1462 TEST_F(PipelineIntegrationTest,
1447 MediaSource_ConfigChange_Encrypted_MP4_CENC_VideoOnly) { 1463 MAYBE_EME(MediaSource_ConfigChange_Encrypted_MP4_CENC_VideoOnly)) {
1448 MockMediaSource source("bear-640x360-v_frag-cenc.mp4", kMP4Video, 1464 MockMediaSource source("bear-640x360-v_frag-cenc.mp4", kMP4Video,
1449 kAppendWholeFile); 1465 kAppendWholeFile);
1450 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); 1466 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1451 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1467 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1452 1468
1453 scoped_refptr<DecoderBuffer> second_file = 1469 scoped_refptr<DecoderBuffer> second_file =
1454 ReadTestDataFile("bear-1280x720-v_frag-cenc.mp4"); 1470 ReadTestDataFile("bear-1280x720-v_frag-cenc.mp4");
1455 1471
1456 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), 1472 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
1457 second_file->data(), second_file->data_size()); 1473 second_file->data(), second_file->data_size());
1458 1474
1459 source.EndOfStream(); 1475 source.EndOfStream();
1460 1476
1461 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1477 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1462 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1478 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1463 EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs, 1479 EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs,
1464 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1480 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1465 1481
1466 Play(); 1482 Play();
1467 1483
1468 EXPECT_TRUE(WaitUntilOnEnded()); 1484 EXPECT_TRUE(WaitUntilOnEnded());
1469 source.Shutdown(); 1485 source.Shutdown();
1470 Stop(); 1486 Stop();
1471 } 1487 }
1472 1488
1473 TEST_F(PipelineIntegrationTest, 1489 TEST_F(PipelineIntegrationTest,
1474 MediaSource_ConfigChange_Encrypted_MP4_CENC_KeyRotation_VideoOnly) { 1490 MAYBE_EME(
1491 MediaSource_ConfigChange_Encrypted_MP4_CENC_KeyRotation_VideoOnly)) {
1475 MockMediaSource source("bear-640x360-v_frag-cenc-key_rotation.mp4", kMP4Video, 1492 MockMediaSource source("bear-640x360-v_frag-cenc-key_rotation.mp4", kMP4Video,
1476 kAppendWholeFile); 1493 kAppendWholeFile);
1477 FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp()); 1494 FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp());
1478 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1495 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1479 1496
1480 scoped_refptr<DecoderBuffer> second_file = 1497 scoped_refptr<DecoderBuffer> second_file =
1481 ReadTestDataFile("bear-1280x720-v_frag-cenc-key_rotation.mp4"); 1498 ReadTestDataFile("bear-1280x720-v_frag-cenc-key_rotation.mp4");
1482 1499
1483 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), 1500 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
1484 second_file->data(), second_file->data_size()); 1501 second_file->data(), second_file->data_size());
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1541 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1525 1542
1526 Play(); 1543 Play();
1527 1544
1528 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); 1545 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError());
1529 source.Shutdown(); 1546 source.Shutdown();
1530 } 1547 }
1531 1548
1532 // Config changes from encrypted to clear are not currently supported. 1549 // Config changes from encrypted to clear are not currently supported.
1533 TEST_F(PipelineIntegrationTest, 1550 TEST_F(PipelineIntegrationTest,
1534 MediaSource_ConfigChange_EncryptedThenClear_MP4_CENC) { 1551 MAYBE_EME(MediaSource_ConfigChange_EncryptedThenClear_MP4_CENC)) {
1535 MockMediaSource source("bear-640x360-v_frag-cenc.mp4", kMP4Video, 1552 MockMediaSource source("bear-640x360-v_frag-cenc.mp4", kMP4Video,
1536 kAppendWholeFile); 1553 kAppendWholeFile);
1537 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); 1554 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1538 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1555 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1539 1556
1540 scoped_refptr<DecoderBuffer> second_file = 1557 scoped_refptr<DecoderBuffer> second_file =
1541 ReadTestDataFile("bear-1280x720-av_frag.mp4"); 1558 ReadTestDataFile("bear-1280x720-av_frag.mp4");
1542 1559
1543 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), 1560 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
1544 second_file->data(), second_file->data_size()); 1561 second_file->data(), second_file->data_size());
1545 1562
1546 source.EndOfStream(); 1563 source.EndOfStream();
1547 1564
1548 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1565 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1549 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1566 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1550 // The second video was not added, so its time has not been added. 1567 // The second video was not added, so its time has not been added.
1551 EXPECT_EQ(k640IsoCencFileDurationMs, 1568 EXPECT_EQ(k640IsoCencFileDurationMs,
1552 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1569 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1553 1570
1554 Play(); 1571 Play();
1555 1572
1556 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); 1573 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError());
1557 source.Shutdown(); 1574 source.Shutdown();
1558 } 1575 }
1559 #endif // !defined(DISABLE_EME_TESTS)
1560 1576
1561 // Verify files which change configuration midstream fail gracefully. 1577 // Verify files which change configuration midstream fail gracefully.
1562 TEST_F(PipelineIntegrationTest, MidStreamConfigChangesFail) { 1578 TEST_F(PipelineIntegrationTest, MidStreamConfigChangesFail) {
1563 ASSERT_EQ(PIPELINE_OK, Start("midstream_config_change.mp3")); 1579 ASSERT_EQ(PIPELINE_OK, Start("midstream_config_change.mp3"));
1564 Play(); 1580 Play();
1565 ASSERT_EQ(WaitUntilEndedOrError(), PIPELINE_ERROR_DECODE); 1581 ASSERT_EQ(WaitUntilEndedOrError(), PIPELINE_ERROR_DECODE);
1566 } 1582 }
1567 1583 #endif // defined(USE_PROPRIETARY_CODECS)
1568 #endif
1569 1584
1570 TEST_F(PipelineIntegrationTest, BasicPlayback_16x9AspectRatio) { 1585 TEST_F(PipelineIntegrationTest, BasicPlayback_16x9AspectRatio) {
1571 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-16x9-aspect.webm")); 1586 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-16x9-aspect.webm"));
1572 Play(); 1587 Play();
1573 ASSERT_TRUE(WaitUntilOnEnded()); 1588 ASSERT_TRUE(WaitUntilOnEnded());
1574 } 1589 }
1575 1590
1576 #if !defined(DISABLE_EME_TESTS) 1591 TEST_F(PipelineIntegrationTest, MAYBE_EME(EncryptedPlayback_WebM)) {
1577 TEST_F(PipelineIntegrationTest, EncryptedPlayback_WebM) {
1578 MockMediaSource source("bear-320x240-av_enc-av.webm", kWebM, 219816); 1592 MockMediaSource source("bear-320x240-av_enc-av.webm", kWebM, 219816);
1579 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); 1593 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1580 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1594 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1581 1595
1582 source.EndOfStream(); 1596 source.EndOfStream();
1583 ASSERT_EQ(PIPELINE_OK, pipeline_status_); 1597 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
1584 1598
1585 Play(); 1599 Play();
1586 1600
1587 ASSERT_TRUE(WaitUntilOnEnded()); 1601 ASSERT_TRUE(WaitUntilOnEnded());
1588 source.Shutdown(); 1602 source.Shutdown();
1589 Stop(); 1603 Stop();
1590 } 1604 }
1591 1605
1592 TEST_F(PipelineIntegrationTest, EncryptedPlayback_ClearStart_WebM) { 1606 TEST_F(PipelineIntegrationTest, MAYBE_EME(EncryptedPlayback_ClearStart_WebM)) {
1593 MockMediaSource source("bear-320x240-av_enc-av_clear-1s.webm", kWebM, 1607 MockMediaSource source("bear-320x240-av_enc-av_clear-1s.webm", kWebM,
1594 kAppendWholeFile); 1608 kAppendWholeFile);
1595 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); 1609 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1596 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1610 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1597 1611
1598 source.EndOfStream(); 1612 source.EndOfStream();
1599 ASSERT_EQ(PIPELINE_OK, pipeline_status_); 1613 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
1600 1614
1601 Play(); 1615 Play();
1602 1616
1603 ASSERT_TRUE(WaitUntilOnEnded()); 1617 ASSERT_TRUE(WaitUntilOnEnded());
1604 source.Shutdown(); 1618 source.Shutdown();
1605 Stop(); 1619 Stop();
1606 } 1620 }
1607 1621
1608 TEST_F(PipelineIntegrationTest, EncryptedPlayback_NoEncryptedFrames_WebM) { 1622 TEST_F(PipelineIntegrationTest,
1623 MAYBE_EME(EncryptedPlayback_NoEncryptedFrames_WebM)) {
1609 MockMediaSource source("bear-320x240-av_enc-av_clear-all.webm", kWebM, 1624 MockMediaSource source("bear-320x240-av_enc-av_clear-all.webm", kWebM,
1610 kAppendWholeFile); 1625 kAppendWholeFile);
1611 FakeEncryptedMedia encrypted_media(new NoResponseApp()); 1626 FakeEncryptedMedia encrypted_media(new NoResponseApp());
1612 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1627 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1613 1628
1614 source.EndOfStream(); 1629 source.EndOfStream();
1615 ASSERT_EQ(PIPELINE_OK, pipeline_status_); 1630 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
1616 1631
1617 Play(); 1632 Play();
1618 1633
1619 ASSERT_TRUE(WaitUntilOnEnded()); 1634 ASSERT_TRUE(WaitUntilOnEnded());
1620 source.Shutdown(); 1635 source.Shutdown();
1621 Stop(); 1636 Stop();
1622 } 1637 }
1623 #endif // !defined(DISABLE_EME_TESTS)
1624 1638
1625 #if defined(USE_PROPRIETARY_CODECS) 1639 #if defined(USE_PROPRIETARY_CODECS)
1626 #if !defined(DISABLE_EME_TESTS) 1640 TEST_F(PipelineIntegrationTest,
1627 TEST_F(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_VideoOnly) { 1641 MAYBE_EME(EncryptedPlayback_MP4_CENC_VideoOnly)) {
1628 MockMediaSource source("bear-1280x720-v_frag-cenc.mp4", kMP4Video, 1642 MockMediaSource source("bear-1280x720-v_frag-cenc.mp4", kMP4Video,
1629 kAppendWholeFile); 1643 kAppendWholeFile);
1630 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); 1644 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1631 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1645 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1632 1646
1633 source.EndOfStream(); 1647 source.EndOfStream();
1634 ASSERT_EQ(PIPELINE_OK, pipeline_status_); 1648 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
1635 1649
1636 Play(); 1650 Play();
1637 1651
1638 ASSERT_TRUE(WaitUntilOnEnded()); 1652 ASSERT_TRUE(WaitUntilOnEnded());
1639 source.Shutdown(); 1653 source.Shutdown();
1640 Stop(); 1654 Stop();
1641 } 1655 }
1642 1656
1643 TEST_F(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_AudioOnly) { 1657 TEST_F(PipelineIntegrationTest,
1658 MAYBE_EME(EncryptedPlayback_MP4_CENC_AudioOnly)) {
1644 MockMediaSource source("bear-1280x720-a_frag-cenc.mp4", kMP4Audio, 1659 MockMediaSource source("bear-1280x720-a_frag-cenc.mp4", kMP4Audio,
1645 kAppendWholeFile); 1660 kAppendWholeFile);
1646 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); 1661 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1647 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1662 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1648 1663
1649 source.EndOfStream(); 1664 source.EndOfStream();
1650 ASSERT_EQ(PIPELINE_OK, pipeline_status_); 1665 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
1651 1666
1652 Play(); 1667 Play();
1653 1668
1654 ASSERT_TRUE(WaitUntilOnEnded()); 1669 ASSERT_TRUE(WaitUntilOnEnded());
1655 source.Shutdown(); 1670 source.Shutdown();
1656 Stop(); 1671 Stop();
1657 } 1672 }
1658 1673
1659 TEST_F(PipelineIntegrationTest, 1674 TEST_F(PipelineIntegrationTest,
1660 EncryptedPlayback_NoEncryptedFrames_MP4_CENC_VideoOnly) { 1675 MAYBE_EME(EncryptedPlayback_NoEncryptedFrames_MP4_CENC_VideoOnly)) {
1661 MockMediaSource source("bear-1280x720-v_frag-cenc_clear-all.mp4", kMP4Video, 1676 MockMediaSource source("bear-1280x720-v_frag-cenc_clear-all.mp4", kMP4Video,
1662 kAppendWholeFile); 1677 kAppendWholeFile);
1663 FakeEncryptedMedia encrypted_media(new NoResponseApp()); 1678 FakeEncryptedMedia encrypted_media(new NoResponseApp());
1664 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1679 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1665 1680
1666 source.EndOfStream(); 1681 source.EndOfStream();
1667 ASSERT_EQ(PIPELINE_OK, pipeline_status_); 1682 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
1668 1683
1669 Play(); 1684 Play();
1670 1685
1671 ASSERT_TRUE(WaitUntilOnEnded()); 1686 ASSERT_TRUE(WaitUntilOnEnded());
1672 source.Shutdown(); 1687 source.Shutdown();
1673 Stop(); 1688 Stop();
1674 } 1689 }
1675 1690
1676 TEST_F(PipelineIntegrationTest, 1691 TEST_F(PipelineIntegrationTest,
1677 EncryptedPlayback_NoEncryptedFrames_MP4_CENC_AudioOnly) { 1692 MAYBE_EME(EncryptedPlayback_NoEncryptedFrames_MP4_CENC_AudioOnly)) {
1678 MockMediaSource source("bear-1280x720-a_frag-cenc_clear-all.mp4", kMP4Audio, 1693 MockMediaSource source("bear-1280x720-a_frag-cenc_clear-all.mp4", kMP4Audio,
1679 kAppendWholeFile); 1694 kAppendWholeFile);
1680 FakeEncryptedMedia encrypted_media(new NoResponseApp()); 1695 FakeEncryptedMedia encrypted_media(new NoResponseApp());
1681 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1696 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1682 1697
1683 source.EndOfStream(); 1698 source.EndOfStream();
1684 ASSERT_EQ(PIPELINE_OK, pipeline_status_); 1699 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
1685 1700
1686 Play(); 1701 Play();
1687 1702
1688 ASSERT_TRUE(WaitUntilOnEnded()); 1703 ASSERT_TRUE(WaitUntilOnEnded());
1689 source.Shutdown(); 1704 source.Shutdown();
1690 Stop(); 1705 Stop();
1691 } 1706 }
1692 1707
1693 TEST_F(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_KeyRotation_Video) { 1708 TEST_F(PipelineIntegrationTest,
1709 MAYBE_EME(EncryptedPlayback_MP4_CENC_KeyRotation_Video)) {
1694 MockMediaSource source("bear-1280x720-v_frag-cenc-key_rotation.mp4", 1710 MockMediaSource source("bear-1280x720-v_frag-cenc-key_rotation.mp4",
1695 kMP4Video, kAppendWholeFile); 1711 kMP4Video, kAppendWholeFile);
1696 FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp()); 1712 FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp());
1697 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1713 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1698 1714
1699 source.EndOfStream(); 1715 source.EndOfStream();
1700 ASSERT_EQ(PIPELINE_OK, pipeline_status_); 1716 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
1701 1717
1702 Play(); 1718 Play();
1703 1719
1704 ASSERT_TRUE(WaitUntilOnEnded()); 1720 ASSERT_TRUE(WaitUntilOnEnded());
1705 source.Shutdown(); 1721 source.Shutdown();
1706 Stop(); 1722 Stop();
1707 } 1723 }
1708 1724
1709 TEST_F(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_KeyRotation_Audio) { 1725 TEST_F(PipelineIntegrationTest,
1726 MAYBE_EME(EncryptedPlayback_MP4_CENC_KeyRotation_Audio)) {
1710 MockMediaSource source("bear-1280x720-a_frag-cenc-key_rotation.mp4", 1727 MockMediaSource source("bear-1280x720-a_frag-cenc-key_rotation.mp4",
1711 kMP4Audio, kAppendWholeFile); 1728 kMP4Audio, kAppendWholeFile);
1712 FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp()); 1729 FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp());
1713 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1730 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1714 1731
1715 source.EndOfStream(); 1732 source.EndOfStream();
1716 ASSERT_EQ(PIPELINE_OK, pipeline_status_); 1733 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
1717 1734
1718 Play(); 1735 Play();
1719 1736
1720 ASSERT_TRUE(WaitUntilOnEnded()); 1737 ASSERT_TRUE(WaitUntilOnEnded());
1721 source.Shutdown(); 1738 source.Shutdown();
1722 Stop(); 1739 Stop();
1723 } 1740 }
1724 #endif // !defined(DISABLE_EME_TESTS)
1725 1741
1726 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VideoOnly_MP4_AVC3) { 1742 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VideoOnly_MP4_AVC3) {
1727 MockMediaSource source("bear-1280x720-v_frag-avc3.mp4", kMP4VideoAVC3, 1743 MockMediaSource source("bear-1280x720-v_frag-avc3.mp4", kMP4VideoAVC3,
1728 kAppendWholeFile); 1744 kAppendWholeFile);
1729 StartPipelineWithMediaSource(&source); 1745 StartPipelineWithMediaSource(&source);
1730 source.EndOfStream(); 1746 source.EndOfStream();
1731 1747
1732 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1748 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1733 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1749 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1734 EXPECT_EQ(k1280IsoAVC3FileDurationMs, 1750 EXPECT_EQ(k1280IsoAVC3FileDurationMs,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1829 1845
1830 TEST_F(PipelineIntegrationTest, Rotated_Metadata_180) { 1846 TEST_F(PipelineIntegrationTest, Rotated_Metadata_180) {
1831 ASSERT_EQ(PIPELINE_OK, Start("bear_rotate_180.mp4")); 1847 ASSERT_EQ(PIPELINE_OK, Start("bear_rotate_180.mp4"));
1832 ASSERT_EQ(VIDEO_ROTATION_180, metadata_.video_rotation); 1848 ASSERT_EQ(VIDEO_ROTATION_180, metadata_.video_rotation);
1833 } 1849 }
1834 1850
1835 TEST_F(PipelineIntegrationTest, Rotated_Metadata_270) { 1851 TEST_F(PipelineIntegrationTest, Rotated_Metadata_270) {
1836 ASSERT_EQ(PIPELINE_OK, Start("bear_rotate_270.mp4")); 1852 ASSERT_EQ(PIPELINE_OK, Start("bear_rotate_270.mp4"));
1837 ASSERT_EQ(VIDEO_ROTATION_270, metadata_.video_rotation); 1853 ASSERT_EQ(VIDEO_ROTATION_270, metadata_.video_rotation);
1838 } 1854 }
1839 #endif 1855 #endif // defined(USE_PROPRIETARY_CODECS)
1840 1856
1841 // Verify audio decoder & renderer can handle aborted demuxer reads. 1857 // Verify audio decoder & renderer can handle aborted demuxer reads.
1842 TEST_F(PipelineIntegrationTest, ChunkDemuxerAbortRead_AudioOnly) { 1858 TEST_F(PipelineIntegrationTest, ChunkDemuxerAbortRead_AudioOnly) {
1843 ASSERT_TRUE(TestSeekDuringRead("bear-320x240-audio-only.webm", kAudioOnlyWebM, 1859 ASSERT_TRUE(TestSeekDuringRead("bear-320x240-audio-only.webm", kAudioOnlyWebM,
1844 16384, 1860 16384,
1845 base::TimeDelta::FromMilliseconds(464), 1861 base::TimeDelta::FromMilliseconds(464),
1846 base::TimeDelta::FromMilliseconds(617), 1862 base::TimeDelta::FromMilliseconds(617),
1847 0x10CA, 19730)); 1863 0x10CA, 19730));
1848 } 1864 }
1849 1865
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1894 EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV12A); 1910 EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV12A);
1895 } 1911 }
1896 1912
1897 // Verify that VP9 video with odd width/height can be played back. 1913 // Verify that VP9 video with odd width/height can be played back.
1898 TEST_F(PipelineIntegrationTest, BasicPlayback_VP9_Odd_WebM) { 1914 TEST_F(PipelineIntegrationTest, BasicPlayback_VP9_Odd_WebM) {
1899 ASSERT_EQ(PIPELINE_OK, Start("bear-vp9-odd-dimensions.webm")); 1915 ASSERT_EQ(PIPELINE_OK, Start("bear-vp9-odd-dimensions.webm"));
1900 Play(); 1916 Play();
1901 ASSERT_TRUE(WaitUntilOnEnded()); 1917 ASSERT_TRUE(WaitUntilOnEnded());
1902 } 1918 }
1903 1919
1904 #if !defined(DISABLE_TEXT_TRACK_TESTS)
1905 // Verify that VP8 video with inband text track can be played back. 1920 // Verify that VP8 video with inband text track can be played back.
1906 TEST_F(PipelineIntegrationTest, BasicPlayback_VP8_WebVTT_WebM) { 1921 TEST_F(PipelineIntegrationTest, MAYBE_TEXT(BasicPlayback_VP8_WebVTT_WebM)) {
1907 EXPECT_CALL(*this, OnAddTextTrack(_, _)); 1922 EXPECT_CALL(*this, OnAddTextTrack(_, _));
1908 ASSERT_EQ(PIPELINE_OK, Start("bear-vp8-webvtt.webm")); 1923 ASSERT_EQ(PIPELINE_OK, Start("bear-vp8-webvtt.webm"));
1909 Play(); 1924 Play();
1910 ASSERT_TRUE(WaitUntilOnEnded()); 1925 ASSERT_TRUE(WaitUntilOnEnded());
1911 } 1926 }
1912 #endif // !defined(DISABLE_TEXT_TRACK_TESTS)
1913 1927
1914 // Verify that VP9 video with 4:4:4 subsampling can be played back. 1928 // Verify that VP9 video with 4:4:4 subsampling can be played back.
1915 TEST_F(PipelineIntegrationTest, P444_VP9_WebM) { 1929 TEST_F(PipelineIntegrationTest, P444_VP9_WebM) {
1916 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-P444.webm")); 1930 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-P444.webm"));
1917 Play(); 1931 Play();
1918 ASSERT_TRUE(WaitUntilOnEnded()); 1932 ASSERT_TRUE(WaitUntilOnEnded());
1919 EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV24); 1933 EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV24);
1920 } 1934 }
1921 1935
1922 // Verify that frames of VP9 video in the BT.709 color space have the YV12HD 1936 // Verify that frames of VP9 video in the BT.709 color space have the YV12HD
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
2004 2018
2005 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { 2019 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) {
2006 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); 2020 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm"));
2007 Play(); 2021 Play();
2008 ASSERT_TRUE(WaitUntilOnEnded()); 2022 ASSERT_TRUE(WaitUntilOnEnded());
2009 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), 2023 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000),
2010 demuxer_->GetStartTime()); 2024 demuxer_->GetStartTime());
2011 } 2025 }
2012 2026
2013 } // namespace media 2027 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/services/BUILD.gn ('k') | mojo/tools/data/apptests » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698