OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "media/blink/webmediaplayer_util.h" | 5 #include "media/blink/webmediaplayer_util.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "media/base/media_keys.h" | 10 #include "media/base/media_keys.h" |
11 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" | 11 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" |
| 12 #include "third_party/WebKit/public/platform/WebMediaPlayerEncryptedMediaClient.
h" |
12 | 13 |
13 namespace media { | 14 namespace media { |
14 | 15 |
15 // Compile asserts shared by all platforms. | 16 // Compile asserts shared by all platforms. |
16 | 17 |
17 #define STATIC_ASSERT_MATCHING_ENUM(name) \ | 18 #define STATIC_ASSERT_MATCHING_ENUM(name) \ |
18 static_assert( \ | 19 static_assert(static_cast<int>(blink::WebMediaPlayerEncryptedMediaClient:: \ |
19 static_cast<int>(blink::WebMediaPlayerClient::MediaKeyErrorCode ## name) == \ | 20 MediaKeyErrorCode##name) == \ |
20 static_cast<int>(MediaKeys::k ## name ## Error), \ | 21 static_cast<int>(MediaKeys::k##name##Error), \ |
21 "mismatching enum values: " #name) | 22 "mismatching enum values: " #name) |
22 STATIC_ASSERT_MATCHING_ENUM(Unknown); | 23 STATIC_ASSERT_MATCHING_ENUM(Unknown); |
23 STATIC_ASSERT_MATCHING_ENUM(Client); | 24 STATIC_ASSERT_MATCHING_ENUM(Client); |
24 #undef STATIC_ASSERT_MATCHING_ENUM | 25 #undef STATIC_ASSERT_MATCHING_ENUM |
25 | 26 |
26 base::TimeDelta ConvertSecondsToTimestamp(double seconds) { | 27 base::TimeDelta ConvertSecondsToTimestamp(double seconds) { |
27 double microseconds = seconds * base::Time::kMicrosecondsPerSecond; | 28 double microseconds = seconds * base::Time::kMicrosecondsPerSecond; |
28 return base::TimeDelta::FromMicroseconds( | 29 return base::TimeDelta::FromMicroseconds( |
29 microseconds > 0 ? microseconds + 0.5 : ceil(microseconds - 0.5)); | 30 microseconds > 0 ? microseconds + 0.5 : ceil(microseconds - 0.5)); |
30 } | 31 } |
31 | 32 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 return blink::WebEncryptedMediaInitDataType::Keyids; | 146 return blink::WebEncryptedMediaInitDataType::Keyids; |
146 case EmeInitDataType::UNKNOWN: | 147 case EmeInitDataType::UNKNOWN: |
147 return blink::WebEncryptedMediaInitDataType::Unknown; | 148 return blink::WebEncryptedMediaInitDataType::Unknown; |
148 } | 149 } |
149 | 150 |
150 NOTREACHED(); | 151 NOTREACHED(); |
151 return blink::WebEncryptedMediaInitDataType::Unknown; | 152 return blink::WebEncryptedMediaInitDataType::Unknown; |
152 } | 153 } |
153 | 154 |
154 } // namespace media | 155 } // namespace media |
OLD | NEW |