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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 exploded_time.second = 56; | 177 exploded_time.second = 56; |
178 exploded_time.millisecond = 789; | 178 exploded_time.millisecond = 789; |
179 base::Time timeline_offset; | 179 base::Time timeline_offset; |
180 EXPECT_TRUE(base::Time::FromUTCExploded(exploded_time, &timeline_offset)); | 180 EXPECT_TRUE(base::Time::FromUTCExploded(exploded_time, &timeline_offset)); |
181 | 181 |
182 timeline_offset += base::TimeDelta::FromMicroseconds(123); | 182 timeline_offset += base::TimeDelta::FromMicroseconds(123); |
183 | 183 |
184 return timeline_offset; | 184 return timeline_offset; |
185 } | 185 } |
186 | 186 |
187 // FFmpeg only supports time a resolution of seconds so this | |
188 // helper function truncates a base::Time to seconds resolution. | |
189 static base::Time TruncateToFFmpegTimeResolution(base::Time t) { | |
190 base::Time::Exploded exploded_time; | |
191 t.UTCExplode(&exploded_time); | |
192 exploded_time.millisecond = 0; | |
193 base::Time out_time; | |
194 EXPECT_TRUE(base::Time::FromUTCExploded(exploded_time, &out_time)); | |
195 return out_time; | |
196 } | |
197 | |
198 // Note: Tests using this class only exercise the DecryptingDemuxerStream path. | 187 // Note: Tests using this class only exercise the DecryptingDemuxerStream path. |
199 // They do not exercise the Decrypting{Audio|Video}Decoder path. | 188 // They do not exercise the Decrypting{Audio|Video}Decoder path. |
200 class FakeEncryptedMedia { | 189 class FakeEncryptedMedia { |
201 public: | 190 public: |
202 // Defines the behavior of the "app" that responds to EME events. | 191 // Defines the behavior of the "app" that responds to EME events. |
203 class AppBase { | 192 class AppBase { |
204 public: | 193 public: |
205 virtual ~AppBase() {} | 194 virtual ~AppBase() {} |
206 | 195 |
207 virtual void OnSessionMessage(const std::string& session_id, | 196 virtual void OnSessionMessage(const std::string& session_id, |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1171 // Live stream does not have duration in the initialization segment. | 1160 // Live stream does not have duration in the initialization segment. |
1172 // It will be set after the entire file is available. | 1161 // It will be set after the entire file is available. |
1173 EXPECT_CALL(*this, OnDurationChange()).Times(1); | 1162 EXPECT_CALL(*this, OnDurationChange()).Times(1); |
1174 | 1163 |
1175 Play(); | 1164 Play(); |
1176 | 1165 |
1177 ASSERT_TRUE(WaitUntilOnEnded()); | 1166 ASSERT_TRUE(WaitUntilOnEnded()); |
1178 | 1167 |
1179 EXPECT_HASH_EQ("f0be120a90a811506777c99a2cdf7cc1", GetVideoHash()); | 1168 EXPECT_HASH_EQ("f0be120a90a811506777c99a2cdf7cc1", GetVideoHash()); |
1180 EXPECT_HASH_EQ("-3.59,-2.06,-0.43,2.15,0.77,-0.95,", GetAudioHash()); | 1169 EXPECT_HASH_EQ("-3.59,-2.06,-0.43,2.15,0.77,-0.95,", GetAudioHash()); |
1181 | 1170 EXPECT_EQ(kLiveTimelineOffset(), demuxer_->GetTimelineOffset()); |
1182 // TODO: Fix FFmpeg code to return higher resolution time values so | |
1183 // we don't have to truncate our expectations here. | |
1184 EXPECT_EQ(TruncateToFFmpegTimeResolution(kLiveTimelineOffset()), | |
1185 demuxer_->GetTimelineOffset()); | |
1186 } | 1171 } |
1187 | 1172 |
1188 TEST_F(PipelineIntegrationTest, S32PlaybackHashed) { | 1173 TEST_F(PipelineIntegrationTest, S32PlaybackHashed) { |
1189 ASSERT_EQ(PIPELINE_OK, Start("sfx_s32le.wav", kHashed)); | 1174 ASSERT_EQ(PIPELINE_OK, Start("sfx_s32le.wav", kHashed)); |
1190 Play(); | 1175 Play(); |
1191 ASSERT_TRUE(WaitUntilOnEnded()); | 1176 ASSERT_TRUE(WaitUntilOnEnded()); |
1192 EXPECT_HASH_EQ(std::string(kNullVideoHash), GetVideoHash()); | 1177 EXPECT_HASH_EQ(std::string(kNullVideoHash), GetVideoHash()); |
1193 EXPECT_HASH_EQ("3.03,2.86,2.99,3.31,3.57,4.06,", GetAudioHash()); | 1178 EXPECT_HASH_EQ("3.03,2.86,2.99,3.31,3.57,4.06,", GetAudioHash()); |
1194 } | 1179 } |
1195 | 1180 |
(...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2515 | 2500 |
2516 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { | 2501 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { |
2517 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); | 2502 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); |
2518 Play(); | 2503 Play(); |
2519 ASSERT_TRUE(WaitUntilOnEnded()); | 2504 ASSERT_TRUE(WaitUntilOnEnded()); |
2520 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), | 2505 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), |
2521 demuxer_->GetStartTime()); | 2506 demuxer_->GetStartTime()); |
2522 } | 2507 } |
2523 | 2508 |
2524 } // namespace media | 2509 } // namespace media |
OLD | NEW |