Chromium Code Reviews| 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/browser/media/android/browser_media_player_manager.h" | 5 #include "content/browser/media/android/browser_media_player_manager.h" |
| 6 | 6 |
| 7 #include "base/android/scoped_java_ref.h" | 7 #include "base/android/scoped_java_ref.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/metrics/histogram.h" | |
| 9 #include "content/browser/android/content_view_core_impl.h" | 10 #include "content/browser/android/content_view_core_impl.h" |
| 10 #include "content/browser/media/android/browser_demuxer_android.h" | 11 #include "content/browser/media/android/browser_demuxer_android.h" |
| 11 #include "content/browser/media/android/media_resource_getter_impl.h" | 12 #include "content/browser/media/android/media_resource_getter_impl.h" |
| 12 #include "content/browser/renderer_host/render_view_host_impl.h" | 13 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 13 #include "content/browser/web_contents/web_contents_view_android.h" | 14 #include "content/browser/web_contents/web_contents_view_android.h" |
| 14 #include "content/common/media/media_player_messages_android.h" | 15 #include "content/common/media/media_player_messages_android.h" |
| 15 #include "content/public/browser/android/content_view_core.h" | 16 #include "content/public/browser/android/content_view_core.h" |
| 16 #include "content/public/browser/android/external_video_surface_container.h" | 17 #include "content/public/browser/android/external_video_surface_container.h" |
| 17 #include "content/public/browser/browser_context.h" | 18 #include "content/public/browser/browser_context.h" |
| 18 #include "content/public/browser/content_browser_client.h" | 19 #include "content/public/browser/content_browser_client.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 // May reach here due to prerendering. Don't extract the metadata | 97 // May reach here due to prerendering. Don't extract the metadata |
| 97 // since it is expensive. | 98 // since it is expensive. |
| 98 // TODO(qinmin): extract the metadata once the user decided to load | 99 // TODO(qinmin): extract the metadata once the user decided to load |
| 99 // the page. | 100 // the page. |
| 100 browser_media_player_manager->OnMediaMetadataChanged( | 101 browser_media_player_manager->OnMediaMetadataChanged( |
| 101 media_player_params.player_id, base::TimeDelta(), 0, 0, false); | 102 media_player_params.player_id, base::TimeDelta(), 0, 0, false); |
| 102 } else if (!content_view_core_impl->ShouldBlockMediaRequest( | 103 } else if (!content_view_core_impl->ShouldBlockMediaRequest( |
| 103 media_player_params.url)) { | 104 media_player_params.url)) { |
| 104 media_player_bridge->Initialize(); | 105 media_player_bridge->Initialize(); |
| 105 } | 106 } |
| 107 std::string path = media_player_params.url.path(); | |
| 108 if (EndsWith(path, ".m3u8", true) || EndsWith(path, ".m3u", true)) { | |
| 109 UMA_HISTOGRAM_BOOLEAN("MobileVideo.IsVideoUrlHLSVideo", true); | |
| 110 } else { | |
| 111 UMA_HISTOGRAM_BOOLEAN("MobileVideo.IsVideoUrlHLSVideo", false); | |
|
Ilya Sherman
2014/08/26 19:54:28
nit: Please write this as
bool is_hls_video = End
qinmin
2014/08/27 00:10:00
Done.
| |
| 112 } | |
| 113 UMA_HISTOGRAM_BOOLEAN("MobileVideo.IsRegularVideoUrl", true); | |
| 106 return media_player_bridge; | 114 return media_player_bridge; |
| 107 } | 115 } |
| 108 | 116 |
| 109 case MEDIA_PLAYER_TYPE_MEDIA_SOURCE: { | 117 case MEDIA_PLAYER_TYPE_MEDIA_SOURCE: { |
| 118 UMA_HISTOGRAM_BOOLEAN("MobileVideo.IsRegularVideoUrl", false); | |
|
Ilya Sherman
2014/08/26 19:54:29
nit: It's generally best to avoid repeating UMA_HI
qinmin
2014/08/27 00:10:00
Done.
| |
| 110 return new MediaSourcePlayer( | 119 return new MediaSourcePlayer( |
| 111 media_player_params.player_id, | 120 media_player_params.player_id, |
| 112 manager, | 121 manager, |
| 113 base::Bind(&BrowserMediaPlayerManager::OnMediaResourcesRequested, | 122 base::Bind(&BrowserMediaPlayerManager::OnMediaResourcesRequested, |
| 114 weak_ptr_factory_.GetWeakPtr()), | 123 weak_ptr_factory_.GetWeakPtr()), |
| 115 base::Bind(&BrowserMediaPlayerManager::OnMediaResourcesReleased, | 124 base::Bind(&BrowserMediaPlayerManager::OnMediaResourcesReleased, |
| 116 weak_ptr_factory_.GetWeakPtr()), | 125 weak_ptr_factory_.GetWeakPtr()), |
| 117 demuxer->CreateDemuxer(media_player_params.demuxer_client_id), | 126 demuxer->CreateDemuxer(media_player_params.demuxer_client_id), |
| 118 media_player_params.frame_url); | 127 media_player_params.frame_url); |
| 119 } | 128 } |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 586 #if defined(VIDEO_HOLE) | 595 #if defined(VIDEO_HOLE) |
| 587 MediaPlayerAndroid* player = GetPlayer(player_id); | 596 MediaPlayerAndroid* player = GetPlayer(player_id); |
| 588 if (player && player->IsSurfaceInUse()) | 597 if (player && player->IsSurfaceInUse()) |
| 589 return; | 598 return; |
| 590 if (external_video_surface_container_) | 599 if (external_video_surface_container_) |
| 591 external_video_surface_container_->ReleaseExternalVideoSurface(player_id); | 600 external_video_surface_container_->ReleaseExternalVideoSurface(player_id); |
| 592 #endif // defined(VIDEO_HOLE) | 601 #endif // defined(VIDEO_HOLE) |
| 593 } | 602 } |
| 594 | 603 |
| 595 } // namespace content | 604 } // namespace content |
| OLD | NEW |