| 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/bind_to_current_loop.h" | 10 #include "media/base/bind_to_current_loop.h" |
| 11 #include "media/base/media_client.h" | 11 #include "media/base/media_client.h" |
| 12 #include "media/base/media_keys.h" | 12 #include "media/base/media_keys.h" |
| 13 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" | 13 #include "third_party/WebKit/public/platform/WebMediaPlayerEncryptedMediaClient.
h" |
| 14 | 14 |
| 15 namespace media { | 15 namespace media { |
| 16 | 16 |
| 17 // Compile asserts shared by all platforms. | 17 // Compile asserts shared by all platforms. |
| 18 | 18 |
| 19 #define STATIC_ASSERT_MATCHING_ENUM(name) \ | 19 #define STATIC_ASSERT_MATCHING_ENUM(name) \ |
| 20 static_assert( \ | 20 static_assert(static_cast<int>(blink::WebMediaPlayerEncryptedMediaClient:: \ |
| 21 static_cast<int>(blink::WebMediaPlayerClient::MediaKeyErrorCode ## name) == \ | 21 MediaKeyErrorCode##name) == \ |
| 22 static_cast<int>(MediaKeys::k ## name ## Error), \ | 22 static_cast<int>(MediaKeys::k##name##Error), \ |
| 23 "mismatching enum values: " #name) | 23 "mismatching enum values: " #name) |
| 24 STATIC_ASSERT_MATCHING_ENUM(Unknown); | 24 STATIC_ASSERT_MATCHING_ENUM(Unknown); |
| 25 STATIC_ASSERT_MATCHING_ENUM(Client); | 25 STATIC_ASSERT_MATCHING_ENUM(Client); |
| 26 #undef STATIC_ASSERT_MATCHING_ENUM | 26 #undef STATIC_ASSERT_MATCHING_ENUM |
| 27 | 27 |
| 28 base::TimeDelta ConvertSecondsToTimestamp(double seconds) { | 28 base::TimeDelta ConvertSecondsToTimestamp(double seconds) { |
| 29 double microseconds = seconds * base::Time::kMicrosecondsPerSecond; | 29 double microseconds = seconds * base::Time::kMicrosecondsPerSecond; |
| 30 return base::TimeDelta::FromMicroseconds( | 30 return base::TimeDelta::FromMicroseconds( |
| 31 microseconds > 0 ? microseconds + 0.5 : ceil(microseconds - 0.5)); | 31 microseconds > 0 ? microseconds + 0.5 : ceil(microseconds - 0.5)); |
| 32 } | 32 } |
| 33 | 33 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 | 248 |
| 249 } // namespace | 249 } // namespace |
| 250 | 250 |
| 251 SwitchOutputDeviceCB ConvertToSwitchOutputDeviceCB( | 251 SwitchOutputDeviceCB ConvertToSwitchOutputDeviceCB( |
| 252 WebSetSinkIdCB* web_callbacks) { | 252 WebSetSinkIdCB* web_callbacks) { |
| 253 return media::BindToCurrentLoop( | 253 return media::BindToCurrentLoop( |
| 254 base::Bind(RunSetSinkIdCallback, SetSinkIdCallback(web_callbacks))); | 254 base::Bind(RunSetSinkIdCallback, SetSinkIdCallback(web_callbacks))); |
| 255 } | 255 } |
| 256 | 256 |
| 257 } // namespace media | 257 } // namespace media |
| OLD | NEW |