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 |
11 #include "base/android/build_info.h" | 11 #include "base/android/build_info.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/callback_helpers.h" | 13 #include "base/callback_helpers.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
16 #include "base/logging.h" | 16 #include "base/logging.h" |
17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
18 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
19 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
20 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
21 #include "cc/blink/web_layer_impl.h" | 21 #include "cc/blink/web_layer_impl.h" |
22 #include "cc/layers/video_layer.h" | 22 #include "cc/layers/video_layer.h" |
23 #include "content/public/common/content_client.h" | 23 #include "content/public/common/content_client.h" |
24 #include "content/public/common/content_switches.h" | 24 #include "content/public/common/content_switches.h" |
25 #include "content/public/common/renderer_preferences.h" | 25 #include "content/public/common/renderer_preferences.h" |
26 #include "content/public/renderer/render_frame.h" | 26 #include "content/public/renderer/render_frame.h" |
27 #include "content/renderer/media/android/renderer_demuxer_android.h" | 27 #include "content/renderer/media/android/renderer_demuxer_android.h" |
28 #include "content/renderer/media/android/renderer_media_player_manager.h" | 28 #include "content/renderer/media/android/renderer_media_player_manager.h" |
| 29 #include "content/renderer/media/android/webmediasession_android.h" |
29 #include "content/renderer/media/cdm/render_cdm_factory.h" | 30 #include "content/renderer/media/cdm/render_cdm_factory.h" |
30 #include "content/renderer/media/cdm/renderer_cdm_manager.h" | 31 #include "content/renderer/media/cdm/renderer_cdm_manager.h" |
31 #include "content/renderer/render_frame_impl.h" | 32 #include "content/renderer/render_frame_impl.h" |
32 #include "content/renderer/render_thread_impl.h" | 33 #include "content/renderer/render_thread_impl.h" |
33 #include "content/renderer/render_view_impl.h" | 34 #include "content/renderer/render_view_impl.h" |
34 #include "gpu/GLES2/gl2extchromium.h" | 35 #include "gpu/GLES2/gl2extchromium.h" |
35 #include "gpu/command_buffer/client/gles2_interface.h" | 36 #include "gpu/command_buffer/client/gles2_interface.h" |
36 #include "gpu/command_buffer/common/mailbox_holder.h" | 37 #include "gpu/command_buffer/common/mailbox_holder.h" |
37 #include "media/base/android/media_codec_util.h" | 38 #include "media/base/android/media_codec_util.h" |
38 #include "media/base/android/media_common_android.h" | 39 #include "media/base/android/media_common_android.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 suppress_deleting_texture_(false), | 221 suppress_deleting_texture_(false), |
221 weak_factory_(this) { | 222 weak_factory_(this) { |
222 DCHECK(player_manager_); | 223 DCHECK(player_manager_); |
223 DCHECK(cdm_factory_); | 224 DCHECK(cdm_factory_); |
224 | 225 |
225 DCHECK(main_thread_checker_.CalledOnValidThread()); | 226 DCHECK(main_thread_checker_.CalledOnValidThread()); |
226 stream_texture_factory_->AddObserver(this); | 227 stream_texture_factory_->AddObserver(this); |
227 | 228 |
228 player_id_ = player_manager_->RegisterMediaPlayer(this); | 229 player_id_ = player_manager_->RegisterMediaPlayer(this); |
229 | 230 |
| 231 session_id_ = 0; |
| 232 if (params.session()) |
| 233 session_id_ = |
| 234 static_cast<WebMediaSessionAndroid*>(params.session())->session_id(); |
| 235 |
230 #if defined(VIDEO_HOLE) | 236 #if defined(VIDEO_HOLE) |
231 const RendererPreferences& prefs = | 237 const RendererPreferences& prefs = |
232 static_cast<RenderFrameImpl*>(render_frame()) | 238 static_cast<RenderFrameImpl*>(render_frame()) |
233 ->render_view() | 239 ->render_view() |
234 ->renderer_preferences(); | 240 ->renderer_preferences(); |
235 force_use_overlay_embedded_video_ = prefs.use_view_overlay_for_all_video; | 241 force_use_overlay_embedded_video_ = prefs.use_view_overlay_for_all_video; |
236 if (force_use_overlay_embedded_video_ || | 242 if (force_use_overlay_embedded_video_ || |
237 player_manager_->ShouldUseVideoOverlayForEmbeddedEncryptedVideo()) { | 243 player_manager_->ShouldUseVideoOverlayForEmbeddedEncryptedVideo()) { |
238 // Defer stream texture creation until we are sure it's necessary. | 244 // Defer stream texture creation until we are sure it's necessary. |
239 needs_establish_peer_ = false; | 245 needs_establish_peer_ = false; |
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1117 void WebMediaPlayerAndroid::InitializePlayer( | 1123 void WebMediaPlayerAndroid::InitializePlayer( |
1118 const GURL& url, | 1124 const GURL& url, |
1119 const GURL& first_party_for_cookies, | 1125 const GURL& first_party_for_cookies, |
1120 bool allow_stored_credentials, | 1126 bool allow_stored_credentials, |
1121 int demuxer_client_id) { | 1127 int demuxer_client_id) { |
1122 ReportHLSMetrics(); | 1128 ReportHLSMetrics(); |
1123 | 1129 |
1124 allow_stored_credentials_ = allow_stored_credentials; | 1130 allow_stored_credentials_ = allow_stored_credentials; |
1125 player_manager_->Initialize( | 1131 player_manager_->Initialize( |
1126 player_type_, player_id_, url, first_party_for_cookies, demuxer_client_id, | 1132 player_type_, player_id_, url, first_party_for_cookies, demuxer_client_id, |
1127 frame_->document().url(), allow_stored_credentials); | 1133 frame_->document().url(), allow_stored_credentials, session_id_); |
1128 is_player_initialized_ = true; | 1134 is_player_initialized_ = true; |
1129 | 1135 |
1130 if (is_fullscreen_) | 1136 if (is_fullscreen_) |
1131 player_manager_->EnterFullscreen(player_id_); | 1137 player_manager_->EnterFullscreen(player_id_); |
1132 | 1138 |
1133 if (cdm_context_) | 1139 if (cdm_context_) |
1134 SetCdmInternal(base::Bind(&media::IgnoreCdmAttached)); | 1140 SetCdmInternal(base::Bind(&media::IgnoreCdmAttached)); |
1135 } | 1141 } |
1136 | 1142 |
1137 void WebMediaPlayerAndroid::Pause(bool is_media_related_action) { | 1143 void WebMediaPlayerAndroid::Pause(bool is_media_related_action) { |
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1953 result = PREDICTION_RESULT_PATH_BASED_WAS_BETTER; | 1959 result = PREDICTION_RESULT_PATH_BASED_WAS_BETTER; |
1954 } else if (is_hls_url == is_hls) { | 1960 } else if (is_hls_url == is_hls) { |
1955 result = PREDICTION_RESULT_URL_BASED_WAS_BETTER; | 1961 result = PREDICTION_RESULT_URL_BASED_WAS_BETTER; |
1956 } | 1962 } |
1957 UMA_HISTOGRAM_ENUMERATION( | 1963 UMA_HISTOGRAM_ENUMERATION( |
1958 "Media.Android.IsHttpLiveStreamingMediaPredictionResult", | 1964 "Media.Android.IsHttpLiveStreamingMediaPredictionResult", |
1959 result, PREDICTION_RESULT_MAX); | 1965 result, PREDICTION_RESULT_MAX); |
1960 } | 1966 } |
1961 | 1967 |
1962 } // namespace content | 1968 } // namespace content |
OLD | NEW |