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/video_layer.h" | 10 #include "cc/video_layer.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 video_layer_->setBounds(size); | 64 video_layer_->setBounds(size); |
65 video_frame_.reset(); | 65 video_frame_.reset(); |
66 } | 66 } |
67 | 67 |
68 WebKit::WebVideoFrame* SurfaceTextureTransportClient::getCurrentFrame() { | 68 WebKit::WebVideoFrame* SurfaceTextureTransportClient::getCurrentFrame() { |
69 if (!texture_id_) { | 69 if (!texture_id_) { |
70 WebKit::WebGraphicsContext3D* context = | 70 WebKit::WebGraphicsContext3D* context = |
71 ImageTransportFactoryAndroid::GetInstance()->GetContext3D(); | 71 ImageTransportFactoryAndroid::GetInstance()->GetContext3D(); |
72 context->makeContextCurrent(); | 72 context->makeContextCurrent(); |
73 texture_id_ = context->createTexture(); | 73 texture_id_ = context->createTexture(); |
| 74 surface_texture_->AttachToGLContext(texture_id_); |
74 } | 75 } |
75 if (!video_frame_.get()) { | 76 if (!video_frame_.get()) { |
76 surface_texture_->AttachToGLContext(texture_id_); | |
77 const gfx::Size size = video_layer_->bounds(); | 77 const gfx::Size size = video_layer_->bounds(); |
78 video_frame_.reset( | 78 video_frame_.reset( |
79 new webkit_media::WebVideoFrameImpl( | 79 new webkit_media::WebVideoFrameImpl( |
80 media::VideoFrame::WrapNativeTexture( | 80 media::VideoFrame::WrapNativeTexture( |
81 texture_id_, kGLTextureExternalOES, | 81 texture_id_, kGLTextureExternalOES, |
82 size, | 82 size, |
83 gfx::Rect(gfx::Point(), size), | 83 gfx::Rect(gfx::Point(), size), |
84 size, | 84 size, |
85 base::TimeDelta(), | 85 base::TimeDelta(), |
86 media::VideoFrame::ReadPixelsCB(), | 86 media::VideoFrame::ReadPixelsCB(), |
87 base::Closure()))); | 87 base::Closure()))); |
88 } | 88 } |
89 surface_texture_->UpdateTexImage(); | 89 surface_texture_->UpdateTexImage(); |
90 | 90 |
91 return video_frame_.get(); | 91 return video_frame_.get(); |
92 } | 92 } |
93 | 93 |
94 void SurfaceTextureTransportClient::putCurrentFrame( | 94 void SurfaceTextureTransportClient::putCurrentFrame( |
95 WebKit::WebVideoFrame* frame) { | 95 WebKit::WebVideoFrame* frame) { |
96 } | 96 } |
97 | 97 |
98 void SurfaceTextureTransportClient::OnSurfaceTextureFrameAvailable() { | 98 void SurfaceTextureTransportClient::OnSurfaceTextureFrameAvailable() { |
99 video_layer_->setNeedsDisplay(); | 99 video_layer_->setNeedsDisplay(); |
100 } | 100 } |
101 | 101 |
102 } // namespace content | 102 } // namespace content |
OLD | NEW |