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 |
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1096 base::AutoLock auto_lock(current_frame_lock_); | 1096 base::AutoLock auto_lock(current_frame_lock_); |
1097 video_frame = current_frame_; | 1097 video_frame = current_frame_; |
1098 } | 1098 } |
1099 | 1099 |
1100 return video_frame; | 1100 return video_frame; |
1101 } | 1101 } |
1102 | 1102 |
1103 void WebMediaPlayerAndroid::PutCurrentFrame() { | 1103 void WebMediaPlayerAndroid::PutCurrentFrame() { |
1104 } | 1104 } |
1105 | 1105 |
1106 void WebMediaPlayerAndroid::RemoveSurfaceTextureAndProxy() { | |
1107 DCHECK(main_thread_checker_.CalledOnValidThread()); | |
1108 | |
1109 if (texture_id_) { | |
1110 GLES2Interface* gl = stream_texture_factory_->ContextGL(); | |
1111 gl->DeleteTextures(1, &texture_id_); | |
1112 // Flush to ensure that the stream texture gets deleted in a timely fashion. | |
1113 gl->ShallowFlushCHROMIUM(); | |
1114 texture_id_ = 0; | |
1115 texture_mailbox_ = gpu::Mailbox(); | |
1116 } | |
1117 stream_texture_proxy_.reset(); | |
1118 needs_establish_peer_ = | |
1119 !is_remote_ && !is_fullscreen_ && (hasVideo() || IsHLSStream()); | |
1120 } | |
1121 | |
1122 void WebMediaPlayerAndroid::UpdateStreamTextureProxyCallback( | 1106 void WebMediaPlayerAndroid::UpdateStreamTextureProxyCallback( |
1123 cc::VideoFrameProvider::Client* client) { | 1107 cc::VideoFrameProvider::Client* client) { |
1124 base::Closure frame_received_cb; | 1108 base::Closure frame_received_cb; |
1125 | 1109 |
1126 if (client) { | 1110 if (client) { |
1127 // Unretained is safe here because: | 1111 // Unretained is safe here because: |
1128 // - |client| is valid until we receive a call to | 1112 // - |client| is valid until we receive a call to |
1129 // SetVideoFrameProviderClient(nullptr). | 1113 // SetVideoFrameProviderClient(nullptr). |
1130 // - SetVideoFrameProviderClient(nullptr) clears proxy's callback | 1114 // - SetVideoFrameProviderClient(nullptr) clears proxy's callback |
1131 // guaranteeing it will no longer be run. | 1115 // guaranteeing it will no longer be run. |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1306 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
1323 switches::kDisableMediaSuspend)) { | 1307 switches::kDisableMediaSuspend)) { |
1324 return false; | 1308 return false; |
1325 } | 1309 } |
1326 | 1310 |
1327 return base::FeatureList::IsEnabled(media::kResumeBackgroundVideo) && | 1311 return base::FeatureList::IsEnabled(media::kResumeBackgroundVideo) && |
1328 hasAudio() && !isRemote() && delegate_ && delegate_->IsHidden(); | 1312 hasAudio() && !isRemote() && delegate_ && delegate_->IsHidden(); |
1329 } | 1313 } |
1330 | 1314 |
1331 } // namespace content | 1315 } // namespace content |
OLD | NEW |