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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 } | 313 } |
314 DoLoad(load_type, url, cors_mode); | 314 DoLoad(load_type, url, cors_mode); |
315 } | 315 } |
316 | 316 |
317 void WebMediaPlayerAndroid::DoLoad(LoadType load_type, | 317 void WebMediaPlayerAndroid::DoLoad(LoadType load_type, |
318 const blink::WebURL& url, | 318 const blink::WebURL& url, |
319 CORSMode cors_mode) { | 319 CORSMode cors_mode) { |
320 DCHECK(main_thread_checker_.CalledOnValidThread()); | 320 DCHECK(main_thread_checker_.CalledOnValidThread()); |
321 | 321 |
322 media::ReportMetrics(load_type, GURL(url), | 322 media::ReportMetrics(load_type, GURL(url), |
323 frame_->document().securityOrigin()); | 323 frame_->document().getSecurityOrigin()); |
324 | 324 |
325 switch (load_type) { | 325 switch (load_type) { |
326 case LoadTypeURL: | 326 case LoadTypeURL: |
327 player_type_ = MEDIA_PLAYER_TYPE_URL; | 327 player_type_ = MEDIA_PLAYER_TYPE_URL; |
328 break; | 328 break; |
329 | 329 |
330 case LoadTypeMediaSource: | 330 case LoadTypeMediaSource: |
331 player_type_ = MEDIA_PLAYER_TYPE_MEDIA_SOURCE; | 331 player_type_ = MEDIA_PLAYER_TYPE_MEDIA_SOURCE; |
332 break; | 332 break; |
333 | 333 |
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1640 return media::MediaCodecUtil::IsHLSURL(url); | 1640 return media::MediaCodecUtil::IsHLSURL(url); |
1641 } | 1641 } |
1642 | 1642 |
1643 void WebMediaPlayerAndroid::ReportHLSMetrics() const { | 1643 void WebMediaPlayerAndroid::ReportHLSMetrics() const { |
1644 if (player_type_ != MEDIA_PLAYER_TYPE_URL) | 1644 if (player_type_ != MEDIA_PLAYER_TYPE_URL) |
1645 return; | 1645 return; |
1646 | 1646 |
1647 bool is_hls = IsHLSStream(); | 1647 bool is_hls = IsHLSStream(); |
1648 UMA_HISTOGRAM_BOOLEAN("Media.Android.IsHttpLiveStreamingMedia", is_hls); | 1648 UMA_HISTOGRAM_BOOLEAN("Media.Android.IsHttpLiveStreamingMedia", is_hls); |
1649 if (is_hls) { | 1649 if (is_hls) { |
1650 media::RecordOriginOfHLSPlayback( | 1650 media::RecordOriginOfHLSPlayback(blink::WebStringToGURL( |
1651 blink::WebStringToGURL(frame_->document().securityOrigin().toString())); | 1651 frame_->document().getSecurityOrigin().toString())); |
1652 } | 1652 } |
1653 | 1653 |
1654 // Assuming that |is_hls| is the ground truth, test predictions. | 1654 // Assuming that |is_hls| is the ground truth, test predictions. |
1655 bool is_hls_path = media::MediaCodecUtil::IsHLSPath(url_); | 1655 bool is_hls_path = media::MediaCodecUtil::IsHLSPath(url_); |
1656 bool is_hls_url = media::MediaCodecUtil::IsHLSURL(url_); | 1656 bool is_hls_url = media::MediaCodecUtil::IsHLSURL(url_); |
1657 MediaTypePredictionResult result = PREDICTION_RESULT_ALL_INCORRECT; | 1657 MediaTypePredictionResult result = PREDICTION_RESULT_ALL_INCORRECT; |
1658 if (is_hls_path == is_hls && is_hls_url == is_hls) { | 1658 if (is_hls_path == is_hls && is_hls_url == is_hls) { |
1659 result = PREDICTION_RESULT_ALL_CORRECT; | 1659 result = PREDICTION_RESULT_ALL_CORRECT; |
1660 } else if (is_hls_path == is_hls) { | 1660 } else if (is_hls_path == is_hls) { |
1661 result = PREDICTION_RESULT_PATH_BASED_WAS_BETTER; | 1661 result = PREDICTION_RESULT_PATH_BASED_WAS_BETTER; |
1662 } else if (is_hls_url == is_hls) { | 1662 } else if (is_hls_url == is_hls) { |
1663 result = PREDICTION_RESULT_URL_BASED_WAS_BETTER; | 1663 result = PREDICTION_RESULT_URL_BASED_WAS_BETTER; |
1664 } | 1664 } |
1665 UMA_HISTOGRAM_ENUMERATION( | 1665 UMA_HISTOGRAM_ENUMERATION( |
1666 "Media.Android.IsHttpLiveStreamingMediaPredictionResult", | 1666 "Media.Android.IsHttpLiveStreamingMediaPredictionResult", |
1667 result, PREDICTION_RESULT_MAX); | 1667 result, PREDICTION_RESULT_MAX); |
1668 } | 1668 } |
1669 | 1669 |
1670 } // namespace content | 1670 } // namespace content |
OLD | NEW |