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/constants.h" | 37 #include "gpu/command_buffer/common/constants.h" |
37 #include "gpu/command_buffer/common/mailbox_holder.h" | 38 #include "gpu/command_buffer/common/mailbox_holder.h" |
38 #include "media/base/android/media_codec_util.h" | 39 #include "media/base/android/media_codec_util.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
235 DCHECK(cdm_factory_); | 236 DCHECK(cdm_factory_); |
236 | 237 |
237 DCHECK(main_thread_checker_.CalledOnValidThread()); | 238 DCHECK(main_thread_checker_.CalledOnValidThread()); |
238 stream_texture_factory_->AddObserver(this); | 239 stream_texture_factory_->AddObserver(this); |
239 | 240 |
240 if (delegate_) | 241 if (delegate_) |
241 delegate_id_ = delegate_->AddObserver(this); | 242 delegate_id_ = delegate_->AddObserver(this); |
242 | 243 |
243 player_id_ = player_manager_->RegisterMediaPlayer(this); | 244 player_id_ = player_manager_->RegisterMediaPlayer(this); |
244 | 245 |
246 media_session_id_ = 0; | |
mlamouri (slow - plz ping)
2016/02/22 16:58:20
ditto
davve
2016/02/23 08:12:10
Done.
| |
247 if (params.media_session()) | |
mlamouri (slow - plz ping)
2016/02/22 16:58:20
style: use { } when there is line wrapping.
davve
2016/02/23 08:12:10
Goes away when moved into the initializer list.
| |
248 media_session_id_ = | |
249 static_cast<const WebMediaSessionAndroid*>( | |
250 params.media_session())->media_session_id(); | |
251 | |
245 #if defined(VIDEO_HOLE) | 252 #if defined(VIDEO_HOLE) |
246 const RendererPreferences& prefs = RenderFrameImpl::FromRoutingID(frame_id) | 253 const RendererPreferences& prefs = RenderFrameImpl::FromRoutingID(frame_id) |
247 ->render_view() | 254 ->render_view() |
248 ->renderer_preferences(); | 255 ->renderer_preferences(); |
249 force_use_overlay_embedded_video_ = prefs.use_view_overlay_for_all_video; | 256 force_use_overlay_embedded_video_ = prefs.use_view_overlay_for_all_video; |
250 if (force_use_overlay_embedded_video_ || | 257 if (force_use_overlay_embedded_video_ || |
251 player_manager_->ShouldUseVideoOverlayForEmbeddedEncryptedVideo()) { | 258 player_manager_->ShouldUseVideoOverlayForEmbeddedEncryptedVideo()) { |
252 // Defer stream texture creation until we are sure it's necessary. | 259 // Defer stream texture creation until we are sure it's necessary. |
253 needs_establish_peer_ = false; | 260 needs_establish_peer_ = false; |
254 current_frame_ = VideoFrame::CreateBlackFrame(gfx::Size(1, 1)); | 261 current_frame_ = VideoFrame::CreateBlackFrame(gfx::Size(1, 1)); |
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1139 void WebMediaPlayerAndroid::InitializePlayer( | 1146 void WebMediaPlayerAndroid::InitializePlayer( |
1140 const GURL& url, | 1147 const GURL& url, |
1141 const GURL& first_party_for_cookies, | 1148 const GURL& first_party_for_cookies, |
1142 bool allow_stored_credentials, | 1149 bool allow_stored_credentials, |
1143 int demuxer_client_id) { | 1150 int demuxer_client_id) { |
1144 ReportHLSMetrics(); | 1151 ReportHLSMetrics(); |
1145 | 1152 |
1146 allow_stored_credentials_ = allow_stored_credentials; | 1153 allow_stored_credentials_ = allow_stored_credentials; |
1147 player_manager_->Initialize( | 1154 player_manager_->Initialize( |
1148 player_type_, player_id_, url, first_party_for_cookies, demuxer_client_id, | 1155 player_type_, player_id_, url, first_party_for_cookies, demuxer_client_id, |
1149 frame_->document().url(), allow_stored_credentials, delegate_id_); | 1156 frame_->document().url(), allow_stored_credentials, delegate_id_, |
1157 media_session_id_); | |
1150 is_player_initialized_ = true; | 1158 is_player_initialized_ = true; |
1151 | 1159 |
1152 if (is_fullscreen_) | 1160 if (is_fullscreen_) |
1153 player_manager_->EnterFullscreen(player_id_); | 1161 player_manager_->EnterFullscreen(player_id_); |
1154 | 1162 |
1155 if (cdm_context_) | 1163 if (cdm_context_) |
1156 SetCdmInternal(base::Bind(&media::IgnoreCdmAttached)); | 1164 SetCdmInternal(base::Bind(&media::IgnoreCdmAttached)); |
1157 } | 1165 } |
1158 | 1166 |
1159 void WebMediaPlayerAndroid::Pause(bool is_media_related_action) { | 1167 void WebMediaPlayerAndroid::Pause(bool is_media_related_action) { |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1940 result = PREDICTION_RESULT_PATH_BASED_WAS_BETTER; | 1948 result = PREDICTION_RESULT_PATH_BASED_WAS_BETTER; |
1941 } else if (is_hls_url == is_hls) { | 1949 } else if (is_hls_url == is_hls) { |
1942 result = PREDICTION_RESULT_URL_BASED_WAS_BETTER; | 1950 result = PREDICTION_RESULT_URL_BASED_WAS_BETTER; |
1943 } | 1951 } |
1944 UMA_HISTOGRAM_ENUMERATION( | 1952 UMA_HISTOGRAM_ENUMERATION( |
1945 "Media.Android.IsHttpLiveStreamingMediaPredictionResult", | 1953 "Media.Android.IsHttpLiveStreamingMediaPredictionResult", |
1946 result, PREDICTION_RESULT_MAX); | 1954 result, PREDICTION_RESULT_MAX); |
1947 } | 1955 } |
1948 | 1956 |
1949 } // namespace content | 1957 } // namespace content |
OLD | NEW |