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 "content/renderer/media/android/webmediaplayer_android.h" | 5 #include "content/renderer/media/android/webmediaplayer_android.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "media/base/media_log.h" | 44 #include "media/base/media_log.h" |
45 #include "media/base/media_switches.h" | 45 #include "media/base/media_switches.h" |
46 #include "media/base/timestamp_constants.h" | 46 #include "media/base/timestamp_constants.h" |
47 #include "media/base/video_frame.h" | 47 #include "media/base/video_frame.h" |
48 #include "media/blink/webcontentdecryptionmodule_impl.h" | 48 #include "media/blink/webcontentdecryptionmodule_impl.h" |
49 #include "media/blink/webmediaplayer_cast_android.h" | 49 #include "media/blink/webmediaplayer_cast_android.h" |
50 #include "media/blink/webmediaplayer_delegate.h" | 50 #include "media/blink/webmediaplayer_delegate.h" |
51 #include "media/blink/webmediaplayer_util.h" | 51 #include "media/blink/webmediaplayer_util.h" |
52 #include "net/base/mime_util.h" | 52 #include "net/base/mime_util.h" |
53 #include "third_party/WebKit/public/platform/Platform.h" | 53 #include "third_party/WebKit/public/platform/Platform.h" |
| 54 #include "third_party/WebKit/public/platform/URLConversion.h" |
54 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" | 55 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" |
55 #include "third_party/WebKit/public/platform/WebEncryptedMediaTypes.h" | 56 #include "third_party/WebKit/public/platform/WebEncryptedMediaTypes.h" |
56 #include "third_party/WebKit/public/platform/WebGraphicsContext3DProvider.h" | 57 #include "third_party/WebKit/public/platform/WebGraphicsContext3DProvider.h" |
57 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" | 58 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" |
58 #include "third_party/WebKit/public/platform/WebMediaPlayerEncryptedMediaClient.
h" | 59 #include "third_party/WebKit/public/platform/WebMediaPlayerEncryptedMediaClient.
h" |
59 #include "third_party/WebKit/public/platform/WebString.h" | 60 #include "third_party/WebKit/public/platform/WebString.h" |
60 #include "third_party/WebKit/public/platform/WebURL.h" | 61 #include "third_party/WebKit/public/platform/WebURL.h" |
61 #include "third_party/WebKit/public/web/WebDocument.h" | 62 #include "third_party/WebKit/public/web/WebDocument.h" |
62 #include "third_party/WebKit/public/web/WebFrame.h" | 63 #include "third_party/WebKit/public/web/WebFrame.h" |
63 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 64 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 return; | 306 return; |
306 } | 307 } |
307 DoLoad(load_type, url, cors_mode); | 308 DoLoad(load_type, url, cors_mode); |
308 } | 309 } |
309 | 310 |
310 void WebMediaPlayerAndroid::DoLoad(LoadType load_type, | 311 void WebMediaPlayerAndroid::DoLoad(LoadType load_type, |
311 const blink::WebURL& url, | 312 const blink::WebURL& url, |
312 CORSMode cors_mode) { | 313 CORSMode cors_mode) { |
313 DCHECK(main_thread_checker_.CalledOnValidThread()); | 314 DCHECK(main_thread_checker_.CalledOnValidThread()); |
314 | 315 |
315 media::ReportMetrics(load_type, GURL(url), | 316 media::ReportMetrics( |
316 GURL(frame_->document().securityOrigin().toString())); | 317 load_type, GURL(url), |
| 318 blink::WebStringToGURL(frame_->document().securityOrigin().toString())); |
317 | 319 |
318 switch (load_type) { | 320 switch (load_type) { |
319 case LoadTypeURL: | 321 case LoadTypeURL: |
320 player_type_ = MEDIA_PLAYER_TYPE_URL; | 322 player_type_ = MEDIA_PLAYER_TYPE_URL; |
321 break; | 323 break; |
322 | 324 |
323 case LoadTypeMediaSource: | 325 case LoadTypeMediaSource: |
324 player_type_ = MEDIA_PLAYER_TYPE_MEDIA_SOURCE; | 326 player_type_ = MEDIA_PLAYER_TYPE_MEDIA_SOURCE; |
325 break; | 327 break; |
326 | 328 |
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1519 proxy_decryptor_.reset(new media::ProxyDecryptor( | 1521 proxy_decryptor_.reset(new media::ProxyDecryptor( |
1520 media_permission_, | 1522 media_permission_, |
1521 player_manager_->ShouldUseVideoOverlayForEmbeddedEncryptedVideo(), | 1523 player_manager_->ShouldUseVideoOverlayForEmbeddedEncryptedVideo(), |
1522 base::Bind(&WebMediaPlayerAndroid::OnKeyAdded, | 1524 base::Bind(&WebMediaPlayerAndroid::OnKeyAdded, |
1523 weak_factory_.GetWeakPtr()), | 1525 weak_factory_.GetWeakPtr()), |
1524 base::Bind(&WebMediaPlayerAndroid::OnKeyError, | 1526 base::Bind(&WebMediaPlayerAndroid::OnKeyError, |
1525 weak_factory_.GetWeakPtr()), | 1527 weak_factory_.GetWeakPtr()), |
1526 base::Bind(&WebMediaPlayerAndroid::OnKeyMessage, | 1528 base::Bind(&WebMediaPlayerAndroid::OnKeyMessage, |
1527 weak_factory_.GetWeakPtr()))); | 1529 weak_factory_.GetWeakPtr()))); |
1528 | 1530 |
1529 GURL security_origin(frame_->document().securityOrigin().toString()); | 1531 GURL security_origin( |
| 1532 blink::WebStringToGURL(frame_->document().securityOrigin().toString())); |
1530 proxy_decryptor_->CreateCdm( | 1533 proxy_decryptor_->CreateCdm( |
1531 cdm_factory_, key_system, security_origin, | 1534 cdm_factory_, key_system, security_origin, |
1532 base::Bind(&WebMediaPlayerAndroid::OnCdmContextReady, | 1535 base::Bind(&WebMediaPlayerAndroid::OnCdmContextReady, |
1533 weak_factory_.GetWeakPtr())); | 1536 weak_factory_.GetWeakPtr())); |
1534 current_key_system_ = key_system; | 1537 current_key_system_ = key_system; |
1535 } | 1538 } |
1536 | 1539 |
1537 // We do not support run-time switching between key systems for now. | 1540 // We do not support run-time switching between key systems for now. |
1538 DCHECK(!current_key_system_.empty()); | 1541 DCHECK(!current_key_system_.empty()); |
1539 if (key_system != current_key_system_) | 1542 if (key_system != current_key_system_) |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1847 } | 1850 } |
1848 | 1851 |
1849 void WebMediaPlayerAndroid::ReportHLSMetrics() const { | 1852 void WebMediaPlayerAndroid::ReportHLSMetrics() const { |
1850 if (player_type_ != MEDIA_PLAYER_TYPE_URL) | 1853 if (player_type_ != MEDIA_PLAYER_TYPE_URL) |
1851 return; | 1854 return; |
1852 | 1855 |
1853 bool is_hls = IsHLSStream(); | 1856 bool is_hls = IsHLSStream(); |
1854 UMA_HISTOGRAM_BOOLEAN("Media.Android.IsHttpLiveStreamingMedia", is_hls); | 1857 UMA_HISTOGRAM_BOOLEAN("Media.Android.IsHttpLiveStreamingMedia", is_hls); |
1855 if (is_hls) { | 1858 if (is_hls) { |
1856 media::RecordOriginOfHLSPlayback( | 1859 media::RecordOriginOfHLSPlayback( |
1857 GURL(frame_->document().securityOrigin().toString())); | 1860 blink::WebStringToGURL(frame_->document().securityOrigin().toString())); |
1858 } | 1861 } |
1859 | 1862 |
1860 // Assuming that |is_hls| is the ground truth, test predictions. | 1863 // Assuming that |is_hls| is the ground truth, test predictions. |
1861 bool is_hls_path = media::MediaCodecUtil::IsHLSPath(url_); | 1864 bool is_hls_path = media::MediaCodecUtil::IsHLSPath(url_); |
1862 bool is_hls_url = media::MediaCodecUtil::IsHLSURL(url_); | 1865 bool is_hls_url = media::MediaCodecUtil::IsHLSURL(url_); |
1863 MediaTypePredictionResult result = PREDICTION_RESULT_ALL_INCORRECT; | 1866 MediaTypePredictionResult result = PREDICTION_RESULT_ALL_INCORRECT; |
1864 if (is_hls_path == is_hls && is_hls_url == is_hls) { | 1867 if (is_hls_path == is_hls && is_hls_url == is_hls) { |
1865 result = PREDICTION_RESULT_ALL_CORRECT; | 1868 result = PREDICTION_RESULT_ALL_CORRECT; |
1866 } else if (is_hls_path == is_hls) { | 1869 } else if (is_hls_path == is_hls) { |
1867 result = PREDICTION_RESULT_PATH_BASED_WAS_BETTER; | 1870 result = PREDICTION_RESULT_PATH_BASED_WAS_BETTER; |
1868 } else if (is_hls_url == is_hls) { | 1871 } else if (is_hls_url == is_hls) { |
1869 result = PREDICTION_RESULT_URL_BASED_WAS_BETTER; | 1872 result = PREDICTION_RESULT_URL_BASED_WAS_BETTER; |
1870 } | 1873 } |
1871 UMA_HISTOGRAM_ENUMERATION( | 1874 UMA_HISTOGRAM_ENUMERATION( |
1872 "Media.Android.IsHttpLiveStreamingMediaPredictionResult", | 1875 "Media.Android.IsHttpLiveStreamingMediaPredictionResult", |
1873 result, PREDICTION_RESULT_MAX); | 1876 result, PREDICTION_RESULT_MAX); |
1874 } | 1877 } |
1875 | 1878 |
1876 } // namespace content | 1879 } // namespace content |
OLD | NEW |