Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(610)

Side by Side Diff: content/renderer/media/android/webmediaplayer_android.cc

Issue 505233002: Add UMA to study the video types for mobile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix logic when checking HLS Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <limits> 7 #include <limits>
8 8
9 #include "base/android/build_info.h" 9 #include "base/android/build_info.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 new MediaInfoLoader( 250 new MediaInfoLoader(
251 url, 251 url,
252 cors_mode, 252 cors_mode,
253 base::Bind(&WebMediaPlayerAndroid::DidLoadMediaInfo, 253 base::Bind(&WebMediaPlayerAndroid::DidLoadMediaInfo,
254 weak_factory_.GetWeakPtr()))); 254 weak_factory_.GetWeakPtr())));
255 info_loader_->Start(frame_); 255 info_loader_->Start(frame_);
256 } 256 }
257 257
258 UpdateNetworkState(WebMediaPlayer::NetworkStateLoading); 258 UpdateNetworkState(WebMediaPlayer::NetworkStateLoading);
259 UpdateReadyState(WebMediaPlayer::ReadyStateHaveNothing); 259 UpdateReadyState(WebMediaPlayer::ReadyStateHaveNothing);
260 UMA_HISTOGRAM_BOOLEAN(
261 "Media.MSE.Playback", player_type_ == MEDIA_PLAYER_TYPE_MEDIA_SOURCE);
260 } 262 }
261 263
262 void WebMediaPlayerAndroid::DidLoadMediaInfo( 264 void WebMediaPlayerAndroid::DidLoadMediaInfo(
263 MediaInfoLoader::Status status, 265 MediaInfoLoader::Status status,
264 const GURL& redirected_url, 266 const GURL& redirected_url,
265 const GURL& first_party_for_cookies, 267 const GURL& first_party_for_cookies,
266 bool allow_stored_credentials) { 268 bool allow_stored_credentials) {
267 DCHECK(main_thread_checker_.CalledOnValidThread()); 269 DCHECK(main_thread_checker_.CalledOnValidThread());
268 DCHECK(!media_source_delegate_); 270 DCHECK(!media_source_delegate_);
269 if (status == MediaInfoLoader::kFailed) { 271 if (status == MediaInfoLoader::kFailed) {
270 info_loader_.reset(); 272 info_loader_.reset();
271 UpdateNetworkState(WebMediaPlayer::NetworkStateNetworkError); 273 UpdateNetworkState(WebMediaPlayer::NetworkStateNetworkError);
272 return; 274 return;
273 } 275 }
274 276 redirected_url_ = redirected_url;
275 InitializePlayer( 277 InitializePlayer(
276 redirected_url, first_party_for_cookies, allow_stored_credentials, 0); 278 redirected_url, first_party_for_cookies, allow_stored_credentials, 0);
277 279
278 UpdateNetworkState(WebMediaPlayer::NetworkStateIdle); 280 UpdateNetworkState(WebMediaPlayer::NetworkStateIdle);
279 } 281 }
280 282
281 void WebMediaPlayerAndroid::play() { 283 void WebMediaPlayerAndroid::play() {
282 DCHECK(main_thread_checker_.CalledOnValidThread()); 284 DCHECK(main_thread_checker_.CalledOnValidThread());
283 285
284 // For HLS streams, some devices cannot detect the video size unless a surface 286 // For HLS streams, some devices cannot detect the video size unless a surface
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 NOTREACHED() << "WebMediaPlayer should be destroyed before any " 986 NOTREACHED() << "WebMediaPlayer should be destroyed before any "
985 "RenderFrameObserver::OnDestruct() gets called when " 987 "RenderFrameObserver::OnDestruct() gets called when "
986 "the RenderFrame goes away."; 988 "the RenderFrame goes away.";
987 } 989 }
988 990
989 void WebMediaPlayerAndroid::InitializePlayer( 991 void WebMediaPlayerAndroid::InitializePlayer(
990 const GURL& url, 992 const GURL& url,
991 const GURL& first_party_for_cookies, 993 const GURL& first_party_for_cookies,
992 bool allow_stored_credentials, 994 bool allow_stored_credentials,
993 int demuxer_client_id) { 995 int demuxer_client_id) {
996 if (player_type_ == MEDIA_PLAYER_TYPE_URL) {
scherkus (not reviewing) 2014/08/28 22:15:09 sanity checking as I want to make sure we get the
qinmin 2014/08/29 16:46:29 Use media extractor will not work: 1. We don't ext
997 UMA_HISTOGRAM_BOOLEAN("Media.Android.IsHttpLiveStreamingMedia",
998 IsHLSStream());
999 }
994 allow_stored_credentials_ = allow_stored_credentials; 1000 allow_stored_credentials_ = allow_stored_credentials;
995 player_manager_->Initialize( 1001 player_manager_->Initialize(
996 player_type_, player_id_, url, first_party_for_cookies, demuxer_client_id, 1002 player_type_, player_id_, url, first_party_for_cookies, demuxer_client_id,
997 frame_->document().url(), allow_stored_credentials); 1003 frame_->document().url(), allow_stored_credentials);
998 if (player_manager_->ShouldEnterFullscreen(frame_)) 1004 if (player_manager_->ShouldEnterFullscreen(frame_))
999 player_manager_->EnterFullscreen(player_id_, frame_); 1005 player_manager_->EnterFullscreen(player_id_, frame_);
1000 } 1006 }
1001 1007
1002 void WebMediaPlayerAndroid::Pause(bool is_media_related_action) { 1008 void WebMediaPlayerAndroid::Pause(bool is_media_related_action) {
1003 player_manager_->Pause(player_id_, is_media_related_action); 1009 player_manager_->Pause(player_id_, is_media_related_action);
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
1734 SetNeedsEstablishPeer(false); 1740 SetNeedsEstablishPeer(false);
1735 } 1741 }
1736 } 1742 }
1737 1743
1738 bool WebMediaPlayerAndroid::canEnterFullscreen() const { 1744 bool WebMediaPlayerAndroid::canEnterFullscreen() const {
1739 return player_manager_->CanEnterFullscreen(frame_); 1745 return player_manager_->CanEnterFullscreen(frame_);
1740 } 1746 }
1741 1747
1742 bool WebMediaPlayerAndroid::IsHLSStream() const { 1748 bool WebMediaPlayerAndroid::IsHLSStream() const {
1743 std::string mime; 1749 std::string mime;
1744 if (!net::GetMimeTypeFromFile(base::FilePath(url_.path()), &mime)) 1750 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_;
1751 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime))
1745 return false; 1752 return false;
1746 return !mime.compare("application/x-mpegurl"); 1753 return !mime.compare("application/x-mpegurl");
1747 } 1754 }
1748 1755
1749 } // namespace content 1756 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698