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 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "media/base/bind_to_current_loop.h" | 13 #include "media/base/bind_to_current_loop.h" |
14 #include "media/base/media_client.h" | 14 #include "media/base/media_client.h" |
15 #include "media/base/media_keys.h" | |
16 #include "third_party/WebKit/public/platform/WebMediaPlayerEncryptedMediaClient.
h" | 15 #include "third_party/WebKit/public/platform/WebMediaPlayerEncryptedMediaClient.
h" |
17 | 16 |
18 namespace media { | 17 namespace media { |
19 | 18 |
20 // Compile asserts shared by all platforms. | |
21 | |
22 #define STATIC_ASSERT_MATCHING_ENUM(name) \ | |
23 static_assert(static_cast<int>(blink::WebMediaPlayerEncryptedMediaClient:: \ | |
24 MediaKeyErrorCode##name) == \ | |
25 static_cast<int>(MediaKeys::k##name##Error), \ | |
26 "mismatching enum values: " #name) | |
27 STATIC_ASSERT_MATCHING_ENUM(Unknown); | |
28 STATIC_ASSERT_MATCHING_ENUM(Client); | |
29 #undef STATIC_ASSERT_MATCHING_ENUM | |
30 | |
31 blink::WebTimeRanges ConvertToWebTimeRanges( | 19 blink::WebTimeRanges ConvertToWebTimeRanges( |
32 const Ranges<base::TimeDelta>& ranges) { | 20 const Ranges<base::TimeDelta>& ranges) { |
33 blink::WebTimeRanges result(ranges.size()); | 21 blink::WebTimeRanges result(ranges.size()); |
34 for (size_t i = 0; i < ranges.size(); ++i) { | 22 for (size_t i = 0; i < ranges.size(); ++i) { |
35 result[i].start = ranges.start(i).InSecondsF(); | 23 result[i].start = ranges.start(i).InSecondsF(); |
36 result[i].end = ranges.end(i).InSecondsF(); | 24 result[i].end = ranges.end(i).InSecondsF(); |
37 } | 25 } |
38 return result; | 26 return result; |
39 } | 27 } |
40 | 28 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 224 |
237 } // namespace | 225 } // namespace |
238 | 226 |
239 SwitchOutputDeviceCB ConvertToSwitchOutputDeviceCB( | 227 SwitchOutputDeviceCB ConvertToSwitchOutputDeviceCB( |
240 blink::WebSetSinkIdCallbacks* web_callbacks) { | 228 blink::WebSetSinkIdCallbacks* web_callbacks) { |
241 return media::BindToCurrentLoop( | 229 return media::BindToCurrentLoop( |
242 base::Bind(RunSetSinkIdCallback, SetSinkIdCallback(web_callbacks))); | 230 base::Bind(RunSetSinkIdCallback, SetSinkIdCallback(web_callbacks))); |
243 } | 231 } |
244 | 232 |
245 } // namespace media | 233 } // namespace media |
OLD | NEW |