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

Side by Side Diff: content/browser/renderer_host/surface_texture_transport_client_android.cc

Issue 11754003: Move VideoFrameProvider to, and remove all usage of WebVideoFrame from cc/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed crashes Created 7 years, 11 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 (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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 if (!window_) 55 if (!window_)
56 window_ = surface_texture_->CreateSurface(); 56 window_ = surface_texture_->CreateSurface();
57 57
58 GpuSurfaceTracker::Get()->SetNativeWidget(surface_id, window_); 58 GpuSurfaceTracker::Get()->SetNativeWidget(surface_id, window_);
59 return gfx::GLSurfaceHandle(gfx::kDummyPluginWindow, false); 59 return gfx::GLSurfaceHandle(gfx::kDummyPluginWindow, false);
60 } 60 }
61 61
62 void SurfaceTextureTransportClient::SetSize(const gfx::Size& size) { 62 void SurfaceTextureTransportClient::SetSize(const gfx::Size& size) {
63 surface_texture_->SetDefaultBufferSize(size.width(), size.height()); 63 surface_texture_->SetDefaultBufferSize(size.width(), size.height());
64 video_layer_->setBounds(size); 64 video_layer_->setBounds(size);
65 video_frame_.reset(); 65 video_frame_ = NULL;
66 } 66 }
67 67
68 WebKit::WebVideoFrame* SurfaceTextureTransportClient::getCurrentFrame() { 68 media::VideoFrame* 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 surface_texture_->AttachToGLContext(texture_id_);
75 } 75 }
76 if (!video_frame_.get()) { 76 if (!video_frame_.get()) {
77 const gfx::Size size = video_layer_->bounds(); 77 const gfx::Size size = video_layer_->bounds();
78 video_frame_.reset( 78 video_frame_ = media::VideoFrame::WrapNativeTexture(
79 new webkit_media::WebVideoFrameImpl( 79 texture_id_, kGLTextureExternalOES,
80 media::VideoFrame::WrapNativeTexture( 80 size,
81 texture_id_, kGLTextureExternalOES, 81 gfx::Rect(gfx::Point(), size),
82 size, 82 size,
83 gfx::Rect(gfx::Point(), size), 83 base::TimeDelta(),
84 size, 84 media::VideoFrame::ReadPixelsCB(),
85 base::TimeDelta(), 85 base::Closure());
86 media::VideoFrame::ReadPixelsCB(),
87 base::Closure())));
88 } 86 }
89 surface_texture_->UpdateTexImage(); 87 surface_texture_->UpdateTexImage();
90 88
91 return video_frame_.get(); 89 return video_frame_.get();
92 } 90 }
93 91
94 void SurfaceTextureTransportClient::putCurrentFrame( 92 void SurfaceTextureTransportClient::PutCurrentFrame(
95 WebKit::WebVideoFrame* frame) { 93 media::VideoFrame* frame) {
96 } 94 }
97 95
98 void SurfaceTextureTransportClient::OnSurfaceTextureFrameAvailable() { 96 void SurfaceTextureTransportClient::OnSurfaceTextureFrameAvailable() {
99 video_layer_->setNeedsDisplay(); 97 video_layer_->setNeedsDisplay();
100 } 98 }
101 99
102 } // namespace content 100 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698