| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // Since base::Time only has a resolution of microseconds, | 171 // Since base::Time only has a resolution of microseconds, |
| 172 // construct a base::Time for 2012-11-10 12:34:56.789123. | 172 // construct a base::Time for 2012-11-10 12:34:56.789123. |
| 173 base::Time::Exploded exploded_time; | 173 base::Time::Exploded exploded_time; |
| 174 exploded_time.year = 2012; | 174 exploded_time.year = 2012; |
| 175 exploded_time.month = 11; | 175 exploded_time.month = 11; |
| 176 exploded_time.day_of_month = 10; | 176 exploded_time.day_of_month = 10; |
| 177 exploded_time.hour = 12; | 177 exploded_time.hour = 12; |
| 178 exploded_time.minute = 34; | 178 exploded_time.minute = 34; |
| 179 exploded_time.second = 56; | 179 exploded_time.second = 56; |
| 180 exploded_time.millisecond = 789; | 180 exploded_time.millisecond = 789; |
| 181 base::Time timeline_offset = base::Time::FromUTCExploded(exploded_time); | 181 base::Time timeline_offset; |
| 182 EXPECT_TRUE(base::Time::FromUTCExploded(exploded_time, &timeline_offset)); |
| 182 | 183 |
| 183 timeline_offset += base::TimeDelta::FromMicroseconds(123); | 184 timeline_offset += base::TimeDelta::FromMicroseconds(123); |
| 184 | 185 |
| 185 return timeline_offset; | 186 return timeline_offset; |
| 186 } | 187 } |
| 187 | 188 |
| 188 // FFmpeg only supports time a resolution of seconds so this | 189 // FFmpeg only supports time a resolution of seconds so this |
| 189 // helper function truncates a base::Time to seconds resolution. | 190 // helper function truncates a base::Time to seconds resolution. |
| 190 static base::Time TruncateToFFmpegTimeResolution(base::Time t) { | 191 static base::Time TruncateToFFmpegTimeResolution(base::Time t) { |
| 191 base::Time::Exploded exploded_time; | 192 base::Time::Exploded exploded_time; |
| 192 t.UTCExplode(&exploded_time); | 193 t.UTCExplode(&exploded_time); |
| 193 exploded_time.millisecond = 0; | 194 exploded_time.millisecond = 0; |
| 194 | 195 base::Time out_time; |
| 195 return base::Time::FromUTCExploded(exploded_time); | 196 EXPECT_TRUE(base::Time::FromUTCExploded(exploded_time, &out_time)); |
| 197 return out_time; |
| 196 } | 198 } |
| 197 | 199 |
| 198 // Note: Tests using this class only exercise the DecryptingDemuxerStream path. | 200 // Note: Tests using this class only exercise the DecryptingDemuxerStream path. |
| 199 // They do not exercise the Decrypting{Audio|Video}Decoder path. | 201 // They do not exercise the Decrypting{Audio|Video}Decoder path. |
| 200 class FakeEncryptedMedia { | 202 class FakeEncryptedMedia { |
| 201 public: | 203 public: |
| 202 // Defines the behavior of the "app" that responds to EME events. | 204 // Defines the behavior of the "app" that responds to EME events. |
| 203 class AppBase { | 205 class AppBase { |
| 204 public: | 206 public: |
| 205 virtual ~AppBase() {} | 207 virtual ~AppBase() {} |
| (...skipping 2097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2303 | 2305 |
| 2304 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { | 2306 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { |
| 2305 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); | 2307 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); |
| 2306 Play(); | 2308 Play(); |
| 2307 ASSERT_TRUE(WaitUntilOnEnded()); | 2309 ASSERT_TRUE(WaitUntilOnEnded()); |
| 2308 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), | 2310 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), |
| 2309 demuxer_->GetStartTime()); | 2311 demuxer_->GetStartTime()); |
| 2310 } | 2312 } |
| 2311 | 2313 |
| 2312 } // namespace media | 2314 } // namespace media |
| OLD | NEW |