OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/renderer_host/surface_texture_transport_client_android
.h" | 5 #include "content/browser/renderer_host/surface_texture_transport_client_android
.h" |
6 | 6 |
7 #include <android/native_window_jni.h> | 7 #include <android/native_window_jni.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "cc/layers/video_layer.h" | 10 #include "cc/layers/video_layer.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 GetCurrentFrame() { | 98 GetCurrentFrame() { |
99 if (!texture_id_) { | 99 if (!texture_id_) { |
100 WebKit::WebGraphicsContext3D* context = | 100 WebKit::WebGraphicsContext3D* context = |
101 ImageTransportFactoryAndroid::GetInstance()->GetContext3D(); | 101 ImageTransportFactoryAndroid::GetInstance()->GetContext3D(); |
102 context->makeContextCurrent(); | 102 context->makeContextCurrent(); |
103 texture_id_ = context->createTexture(); | 103 texture_id_ = context->createTexture(); |
104 context->bindTexture(GL_TEXTURE_EXTERNAL_OES, texture_id_); | 104 context->bindTexture(GL_TEXTURE_EXTERNAL_OES, texture_id_); |
105 context->flush(); | 105 context->flush(); |
106 surface_texture_->AttachToGLContext(); | 106 surface_texture_->AttachToGLContext(); |
107 } | 107 } |
108 if (!video_frame_) { | 108 if (!video_frame_.get()) { |
109 const gfx::Size size = video_layer_->bounds(); | 109 const gfx::Size size = video_layer_->bounds(); |
110 video_frame_ = media::VideoFrame::WrapNativeTexture( | 110 video_frame_ = media::VideoFrame::WrapNativeTexture( |
111 texture_id_, kGLTextureExternalOES, | 111 texture_id_, kGLTextureExternalOES, |
112 size, | 112 size, |
113 gfx::Rect(gfx::Point(), size), | 113 gfx::Rect(gfx::Point(), size), |
114 size, | 114 size, |
115 base::TimeDelta(), | 115 base::TimeDelta(), |
116 media::VideoFrame::ReadPixelsCB(), | 116 media::VideoFrame::ReadPixelsCB(), |
117 base::Closure()); | 117 base::Closure()); |
118 } | 118 } |
119 surface_texture_->UpdateTexImage(); | 119 surface_texture_->UpdateTexImage(); |
120 | 120 |
121 return video_frame_; | 121 return video_frame_; |
122 } | 122 } |
123 | 123 |
124 void SurfaceTextureTransportClient::PutCurrentFrame( | 124 void SurfaceTextureTransportClient::PutCurrentFrame( |
125 const scoped_refptr<media::VideoFrame>& frame) { | 125 const scoped_refptr<media::VideoFrame>& frame) { |
126 } | 126 } |
127 | 127 |
128 void SurfaceTextureTransportClient::OnSurfaceTextureFrameAvailable() { | 128 void SurfaceTextureTransportClient::OnSurfaceTextureFrameAvailable() { |
129 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 129 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
130 video_layer_->SetNeedsDisplay(); | 130 video_layer_->SetNeedsDisplay(); |
131 } | 131 } |
132 | 132 |
133 } // namespace content | 133 } // namespace content |
OLD | NEW |