Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: content/renderer/media/android/webmediaplayer_android.cc

Issue 23618031: [Android WebView] Clean up global GL resource pt.1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 } 120 }
121 } 121 }
122 122
123 // Defer stream texture creation until we are sure it's necessary. 123 // Defer stream texture creation until we are sure it's necessary.
124 stream_id_ = 0; 124 stream_id_ = 0;
125 needs_establish_peer_ = false; 125 needs_establish_peer_ = false;
126 current_frame_ = VideoFrame::CreateBlackFrame(gfx::Size(1, 1)); 126 current_frame_ = VideoFrame::CreateBlackFrame(gfx::Size(1, 1));
127 #endif 127 #endif
128 if (stream_texture_factory_) { 128 if (stream_texture_factory_) {
129 stream_texture_proxy_.reset(stream_texture_factory_->CreateProxy()); 129 stream_texture_proxy_.reset(stream_texture_factory_->CreateProxy());
130 if (needs_establish_peer_) { 130 if (needs_establish_peer_ && stream_texture_proxy_) {
131 stream_id_ = stream_texture_factory_->CreateStreamTexture( 131 stream_id_ = stream_texture_factory_->CreateStreamTexture(
132 kGLTextureExternalOES, 132 kGLTextureExternalOES,
133 &texture_id_, 133 &texture_id_,
134 &texture_mailbox_, 134 &texture_mailbox_,
135 &texture_mailbox_sync_point_); 135 &texture_mailbox_sync_point_);
136 ReallocateVideoFrame(); 136 ReallocateVideoFrame();
137 } 137 }
138 } 138 }
139 139
140 if (WebKit::WebRuntimeFeatures::isLegacyEncryptedMediaEnabled()) { 140 if (WebKit::WebRuntimeFeatures::isLegacyEncryptedMediaEnabled()) {
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 cached_stream_texture_size_ = natural_size; 853 cached_stream_texture_size_ = natural_size;
854 } 854 }
855 return current_frame_; 855 return current_frame_;
856 } 856 }
857 857
858 void WebMediaPlayerAndroid::PutCurrentFrame( 858 void WebMediaPlayerAndroid::PutCurrentFrame(
859 const scoped_refptr<media::VideoFrame>& frame) { 859 const scoped_refptr<media::VideoFrame>& frame) {
860 } 860 }
861 861
862 void WebMediaPlayerAndroid::EstablishSurfaceTexturePeer() { 862 void WebMediaPlayerAndroid::EstablishSurfaceTexturePeer() {
863 if (!stream_texture_proxy_)
864 return;
865
863 if (media_source_delegate_ && stream_texture_factory_) { 866 if (media_source_delegate_ && stream_texture_factory_) {
864 // MediaCodec will release the old surface when it goes away, we need to 867 // MediaCodec will release the old surface when it goes away, we need to
865 // recreate a new one each time this is called. 868 // recreate a new one each time this is called.
866 stream_texture_factory_->DestroyStreamTexture(texture_id_); 869 stream_texture_factory_->DestroyStreamTexture(texture_id_);
867 stream_id_ = 0; 870 stream_id_ = 0;
868 texture_id_ = 0; 871 texture_id_ = 0;
869 texture_mailbox_ = gpu::Mailbox(); 872 texture_mailbox_ = gpu::Mailbox();
870 texture_mailbox_sync_point_ = 0; 873 texture_mailbox_sync_point_ = 0;
871 stream_id_ = stream_texture_factory_->CreateStreamTexture( 874 stream_id_ = stream_texture_factory_->CreateStreamTexture(
872 kGLTextureExternalOES, 875 kGLTextureExternalOES,
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 1185
1183 void WebMediaPlayerAndroid::exitFullscreen() { 1186 void WebMediaPlayerAndroid::exitFullscreen() {
1184 proxy_->ExitFullscreen(player_id_); 1187 proxy_->ExitFullscreen(player_id_);
1185 } 1188 }
1186 1189
1187 bool WebMediaPlayerAndroid::canEnterFullscreen() const { 1190 bool WebMediaPlayerAndroid::canEnterFullscreen() const {
1188 return manager_->CanEnterFullscreen(frame_); 1191 return manager_->CanEnterFullscreen(frame_);
1189 } 1192 }
1190 1193
1191 } // namespace content 1194 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698