| 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 #ifndef MEDIA_BLINK_WEBMEDIAPLAYER_UTIL_H_ | 5 #ifndef MEDIA_BLINK_WEBMEDIAPLAYER_UTIL_H_ |
| 6 #define MEDIA_BLINK_WEBMEDIAPLAYER_UTIL_H_ | 6 #define MEDIA_BLINK_WEBMEDIAPLAYER_UTIL_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" |
| 8 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 9 #include "media/base/audio_renderer_sink.h" | 10 #include "media/base/audio_renderer_sink.h" |
| 10 #include "media/base/eme_constants.h" | 11 #include "media/base/eme_constants.h" |
| 11 #include "media/base/pipeline_status.h" | 12 #include "media/base/pipeline_status.h" |
| 12 #include "media/base/ranges.h" | 13 #include "media/base/ranges.h" |
| 13 #include "media/blink/media_blink_export.h" | 14 #include "media/blink/media_blink_export.h" |
| 14 #include "third_party/WebKit/public/platform/WebEncryptedMediaTypes.h" | 15 #include "third_party/WebKit/public/platform/WebEncryptedMediaTypes.h" |
| 15 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" | 16 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" |
| 16 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 17 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
| 17 #include "third_party/WebKit/public/platform/WebSetSinkIdCallbacks.h" | 18 #include "third_party/WebKit/public/platform/WebSetSinkIdCallbacks.h" |
| 18 #include "third_party/WebKit/public/platform/WebTimeRange.h" | 19 #include "third_party/WebKit/public/platform/WebTimeRange.h" |
| 19 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 20 | 21 |
| 21 namespace media { | 22 namespace media { |
| 22 | 23 |
| 24 class MediaLog; |
| 25 |
| 23 blink::WebTimeRanges MEDIA_BLINK_EXPORT | 26 blink::WebTimeRanges MEDIA_BLINK_EXPORT |
| 24 ConvertToWebTimeRanges(const Ranges<base::TimeDelta>& ranges); | 27 ConvertToWebTimeRanges(const Ranges<base::TimeDelta>& ranges); |
| 25 | 28 |
| 26 blink::WebMediaPlayer::NetworkState MEDIA_BLINK_EXPORT | 29 blink::WebMediaPlayer::NetworkState MEDIA_BLINK_EXPORT |
| 27 PipelineErrorToNetworkState(PipelineStatus error); | 30 PipelineErrorToNetworkState(PipelineStatus error); |
| 28 | 31 |
| 29 // Report various metrics to UMA and RAPPOR. | 32 // Report various metrics to UMA and RAPPOR. |
| 30 void MEDIA_BLINK_EXPORT | 33 void MEDIA_BLINK_EXPORT |
| 31 ReportMetrics(blink::WebMediaPlayer::LoadType load_type, | 34 ReportMetrics(blink::WebMediaPlayer::LoadType load_type, |
| 32 const GURL& url, | 35 const GURL& url, |
| 33 const blink::WebSecurityOrigin& security_origin); | 36 const blink::WebSecurityOrigin& security_origin, |
| 37 scoped_refptr<MediaLog> media_log); |
| 34 | 38 |
| 35 // Report metrics about pipeline errors. | 39 // Report metrics about pipeline errors. |
| 36 void MEDIA_BLINK_EXPORT | 40 void MEDIA_BLINK_EXPORT |
| 37 ReportPipelineError(blink::WebMediaPlayer::LoadType load_type, | 41 ReportPipelineError(blink::WebMediaPlayer::LoadType load_type, |
| 38 const blink::WebSecurityOrigin& security_origin, | 42 const blink::WebSecurityOrigin& security_origin, |
| 39 PipelineStatus error); | 43 PipelineStatus error, |
| 40 | 44 scoped_refptr<MediaLog> media_log); |
| 41 // Record a RAPPOR metric for the origin of an HLS playback. | |
| 42 void MEDIA_BLINK_EXPORT RecordOriginOfHLSPlayback(const GURL& origin_url); | |
| 43 | 45 |
| 44 // TODO(ddorwin): Move this function to an EME-specific file. | 46 // TODO(ddorwin): Move this function to an EME-specific file. |
| 45 // We may also want to move the next one and pass Blink types to WMPI. | 47 // We may also want to move the next one and pass Blink types to WMPI. |
| 46 EmeInitDataType MEDIA_BLINK_EXPORT | 48 EmeInitDataType MEDIA_BLINK_EXPORT |
| 47 ConvertToEmeInitDataType(blink::WebEncryptedMediaInitDataType init_data_type); | 49 ConvertToEmeInitDataType(blink::WebEncryptedMediaInitDataType init_data_type); |
| 48 | 50 |
| 49 blink::WebEncryptedMediaInitDataType MEDIA_BLINK_EXPORT | 51 blink::WebEncryptedMediaInitDataType MEDIA_BLINK_EXPORT |
| 50 ConvertToWebInitDataType(EmeInitDataType init_data_type); | 52 ConvertToWebInitDataType(EmeInitDataType init_data_type); |
| 51 | 53 |
| 52 // Wraps a blink::WebSetSinkIdCallbacks into a media::OutputDeviceStatusCB | 54 // Wraps a blink::WebSetSinkIdCallbacks into a media::OutputDeviceStatusCB |
| 53 // and binds it to the current thread | 55 // and binds it to the current thread |
| 54 OutputDeviceStatusCB MEDIA_BLINK_EXPORT | 56 OutputDeviceStatusCB MEDIA_BLINK_EXPORT |
| 55 ConvertToOutputDeviceStatusCB(blink::WebSetSinkIdCallbacks* web_callbacks); | 57 ConvertToOutputDeviceStatusCB(blink::WebSetSinkIdCallbacks* web_callbacks); |
| 56 | 58 |
| 57 } // namespace media | 59 } // namespace media |
| 58 | 60 |
| 59 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_UTIL_H_ | 61 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_UTIL_H_ |
| OLD | NEW |