| 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 <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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 namespace content { | 154 namespace content { |
| 155 | 155 |
| 156 WebMediaPlayerAndroid::WebMediaPlayerAndroid( | 156 WebMediaPlayerAndroid::WebMediaPlayerAndroid( |
| 157 blink::WebFrame* frame, | 157 blink::WebFrame* frame, |
| 158 blink::WebMediaPlayerClient* client, | 158 blink::WebMediaPlayerClient* client, |
| 159 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client, | 159 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client, |
| 160 base::WeakPtr<media::WebMediaPlayerDelegate> delegate, | 160 base::WeakPtr<media::WebMediaPlayerDelegate> delegate, |
| 161 RendererMediaPlayerManager* player_manager, | 161 RendererMediaPlayerManager* player_manager, |
| 162 media::CdmFactory* cdm_factory, | 162 media::CdmFactory* cdm_factory, |
| 163 scoped_refptr<StreamTextureFactory> factory, | 163 scoped_refptr<StreamTextureFactory> factory, |
| 164 int frame_id, |
| 164 const media::WebMediaPlayerParams& params) | 165 const media::WebMediaPlayerParams& params) |
| 165 : RenderFrameObserver(RenderFrame::FromWebFrame(frame)), | 166 : RenderFrameObserver(RenderFrame::FromWebFrame(frame)), |
| 166 frame_(frame), | 167 frame_(frame), |
| 167 client_(client), | 168 client_(client), |
| 168 encrypted_client_(encrypted_client), | 169 encrypted_client_(encrypted_client), |
| 169 delegate_(delegate), | 170 delegate_(delegate), |
| 170 defer_load_cb_(params.defer_load_cb()), | 171 defer_load_cb_(params.defer_load_cb()), |
| 171 buffered_(static_cast<size_t>(1)), | 172 buffered_(static_cast<size_t>(1)), |
| 172 media_task_runner_(params.media_task_runner()), | 173 media_task_runner_(params.media_task_runner()), |
| 173 ignore_metadata_duration_change_(false), | 174 ignore_metadata_duration_change_(false), |
| (...skipping 20 matching lines...) Expand all Loading... |
| 194 is_fullscreen_(false), | 195 is_fullscreen_(false), |
| 195 video_frame_provider_client_(nullptr), | 196 video_frame_provider_client_(nullptr), |
| 196 player_type_(MEDIA_PLAYER_TYPE_URL), | 197 player_type_(MEDIA_PLAYER_TYPE_URL), |
| 197 is_remote_(false), | 198 is_remote_(false), |
| 198 media_log_(params.media_log()), | 199 media_log_(params.media_log()), |
| 199 init_data_type_(media::EmeInitDataType::UNKNOWN), | 200 init_data_type_(media::EmeInitDataType::UNKNOWN), |
| 200 cdm_context_(nullptr), | 201 cdm_context_(nullptr), |
| 201 allow_stored_credentials_(false), | 202 allow_stored_credentials_(false), |
| 202 is_local_resource_(false), | 203 is_local_resource_(false), |
| 203 interpolator_(&default_tick_clock_), | 204 interpolator_(&default_tick_clock_), |
| 205 frame_id_(frame_id), |
| 204 weak_factory_(this) { | 206 weak_factory_(this) { |
| 205 DCHECK(player_manager_); | 207 DCHECK(player_manager_); |
| 206 DCHECK(cdm_factory_); | 208 DCHECK(cdm_factory_); |
| 207 | 209 |
| 208 DCHECK(main_thread_checker_.CalledOnValidThread()); | 210 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 209 stream_texture_factory_->AddObserver(this); | 211 stream_texture_factory_->AddObserver(this); |
| 210 | 212 |
| 211 player_id_ = player_manager_->RegisterMediaPlayer(this); | 213 player_id_ = player_manager_->RegisterMediaPlayer(this); |
| 212 | 214 |
| 213 #if defined(VIDEO_HOLE) | 215 #if defined(VIDEO_HOLE) |
| (...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1381 } | 1383 } |
| 1382 } | 1384 } |
| 1383 } | 1385 } |
| 1384 | 1386 |
| 1385 void WebMediaPlayerAndroid::EstablishSurfaceTexturePeer() { | 1387 void WebMediaPlayerAndroid::EstablishSurfaceTexturePeer() { |
| 1386 DCHECK(main_thread_checker_.CalledOnValidThread()); | 1388 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 1387 if (!stream_texture_proxy_) | 1389 if (!stream_texture_proxy_) |
| 1388 return; | 1390 return; |
| 1389 | 1391 |
| 1390 if (stream_texture_factory_.get() && stream_id_) | 1392 if (stream_texture_factory_.get() && stream_id_) |
| 1391 stream_texture_factory_->EstablishPeer(stream_id_, player_id_); | 1393 stream_texture_factory_->EstablishPeer(stream_id_, player_id_, frame_id_); |
| 1392 | 1394 |
| 1393 // Set the deferred size because the size was changed in remote mode. | 1395 // Set the deferred size because the size was changed in remote mode. |
| 1394 if (!is_remote_ && cached_stream_texture_size_ != natural_size_) { | 1396 if (!is_remote_ && cached_stream_texture_size_ != natural_size_) { |
| 1395 stream_texture_factory_->SetStreamTextureSize( | 1397 stream_texture_factory_->SetStreamTextureSize( |
| 1396 stream_id_, gfx::Size(natural_size_.width, natural_size_.height)); | 1398 stream_id_, gfx::Size(natural_size_.width, natural_size_.height)); |
| 1397 cached_stream_texture_size_ = natural_size_; | 1399 cached_stream_texture_size_ = natural_size_; |
| 1398 } | 1400 } |
| 1399 | 1401 |
| 1400 needs_establish_peer_ = false; | 1402 needs_establish_peer_ = false; |
| 1401 } | 1403 } |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1919 | 1921 |
| 1920 bool is_hls = IsHLSStream(); | 1922 bool is_hls = IsHLSStream(); |
| 1921 UMA_HISTOGRAM_BOOLEAN("Media.Android.IsHttpLiveStreamingMedia", is_hls); | 1923 UMA_HISTOGRAM_BOOLEAN("Media.Android.IsHttpLiveStreamingMedia", is_hls); |
| 1922 if (is_hls) { | 1924 if (is_hls) { |
| 1923 media::RecordOriginOfHLSPlayback( | 1925 media::RecordOriginOfHLSPlayback( |
| 1924 GURL(frame_->document().securityOrigin().toString())); | 1926 GURL(frame_->document().securityOrigin().toString())); |
| 1925 } | 1927 } |
| 1926 } | 1928 } |
| 1927 | 1929 |
| 1928 } // namespace content | 1930 } // namespace content |
| OLD | NEW |