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

Side by Side Diff: content/renderer/media/stream_texture_factory_impl_android.cc

Issue 12902002: Remove WebVideoFrame, WebVideoFrameProvider, and WebVideoLayer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Just removing code Created 7 years, 9 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
« no previous file with comments | « no previous file | media/base/video_frame.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/renderer/media/stream_texture_factory_impl_android.h" 5 #include "content/renderer/media/stream_texture_factory_impl_android.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/message_loop_proxy.h" 9 #include "base/message_loop_proxy.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
11 #include "content/common/android/surface_texture_peer.h" 11 #include "content/common/android/surface_texture_peer.h"
12 #include "content/common/gpu/client/gpu_channel_host.h" 12 #include "content/common/gpu/client/gpu_channel_host.h"
13 #include "content/common/gpu/gpu_messages.h" 13 #include "content/common/gpu/gpu_messages.h"
14 #include "content/renderer/render_thread_impl.h" 14 #include "content/renderer/render_thread_impl.h"
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStreamTextureClien t.h"
17 #include "ui/gfx/size.h" 16 #include "ui/gfx/size.h"
18 17
19 namespace { 18 namespace {
20 19
21 static void DeleteStreamTextureHost(content::StreamTextureHost* host) { 20 static void DeleteStreamTextureHost(content::StreamTextureHost* host) {
22 delete host; 21 delete host;
23 } 22 }
24 23
25 // Implementation of the StreamTextureProxy class. This class listens to all 24 // Implementation of the StreamTextureProxy class. This class listens to all
26 // the stream texture updates and forward them to the 25 // the stream texture updates and forward them to the
27 // cc::VideoFrameProvider::Client. 26 // cc::VideoFrameProvider::Client.
28 class StreamTextureProxyImpl : public webkit_media::StreamTextureProxy, 27 class StreamTextureProxyImpl : public webkit_media::StreamTextureProxy,
29 public content::StreamTextureHost::Listener { 28 public content::StreamTextureHost::Listener {
30 public: 29 public:
31 explicit StreamTextureProxyImpl(content::StreamTextureHost* host); 30 explicit StreamTextureProxyImpl(content::StreamTextureHost* host);
32 virtual ~StreamTextureProxyImpl(); 31 virtual ~StreamTextureProxyImpl();
33 32
34 // webkit_media::StreamTextureProxy implementation: 33 // webkit_media::StreamTextureProxy implementation:
35 virtual bool Initialize(int stream_id, int width, int height) OVERRIDE; 34 virtual bool Initialize(int stream_id, int width, int height) OVERRIDE;
36 virtual bool IsInitialized() OVERRIDE { return initialized_; } 35 virtual bool IsInitialized() OVERRIDE { return initialized_; }
37 #ifndef REMOVE_WEBVIDEOFRAME
38 virtual void SetClient(WebKit::WebStreamTextureClient* client) OVERRIDE;
39 #else
40 virtual void SetClient(cc::VideoFrameProvider::Client* client) OVERRIDE; 36 virtual void SetClient(cc::VideoFrameProvider::Client* client) OVERRIDE;
41 #endif
42 37
43 // StreamTextureHost::Listener implementation: 38 // StreamTextureHost::Listener implementation:
44 virtual void OnFrameAvailable() OVERRIDE; 39 virtual void OnFrameAvailable() OVERRIDE;
45 virtual void OnMatrixChanged(const float matrix[16]) OVERRIDE; 40 virtual void OnMatrixChanged(const float matrix[16]) OVERRIDE;
46 41
47 private: 42 private:
48 scoped_ptr<content::StreamTextureHost> host_; 43 scoped_ptr<content::StreamTextureHost> host_;
49 scoped_refptr<base::MessageLoopProxy> loop_; 44 scoped_refptr<base::MessageLoopProxy> loop_;
50 45
51 base::Lock client_lock_; 46 base::Lock client_lock_;
52 #ifndef REMOVE_WEBVIDEOFRAME
53 WebKit::WebStreamTextureClient* client_;
54 #else
55 cc::VideoFrameProvider::Client* client_; 47 cc::VideoFrameProvider::Client* client_;
56 #endif
57 bool initialized_; 48 bool initialized_;
58 49
59 DISALLOW_COPY_AND_ASSIGN(StreamTextureProxyImpl); 50 DISALLOW_COPY_AND_ASSIGN(StreamTextureProxyImpl);
60 }; 51 };
61 52
62 StreamTextureProxyImpl::StreamTextureProxyImpl( 53 StreamTextureProxyImpl::StreamTextureProxyImpl(
63 content::StreamTextureHost* host) 54 content::StreamTextureHost* host)
64 : host_(host), 55 : host_(host),
65 client_(NULL), 56 client_(NULL),
66 initialized_(false) { 57 initialized_(false) {
67 DCHECK(host); 58 DCHECK(host);
68 host->SetListener(this); 59 host->SetListener(this);
69 } 60 }
70 61
71 StreamTextureProxyImpl::~StreamTextureProxyImpl() { 62 StreamTextureProxyImpl::~StreamTextureProxyImpl() {
72 SetClient(NULL); 63 SetClient(NULL);
73 // The StreamTextureHost instance needs to be deleted on the thread 64 // The StreamTextureHost instance needs to be deleted on the thread
74 // it receives messages on (where it uses a WeakPtr). 65 // it receives messages on (where it uses a WeakPtr).
75 if (loop_.get()) { 66 if (loop_.get()) {
76 loop_->PostTask(FROM_HERE, base::Bind(&DeleteStreamTextureHost, 67 loop_->PostTask(FROM_HERE, base::Bind(&DeleteStreamTextureHost,
77 host_.release())); 68 host_.release()));
78 } 69 }
79 } 70 }
80 71
81 #ifndef REMOVE_WEBVIDEOFRAME
82 void StreamTextureProxyImpl::SetClient(WebKit::WebStreamTextureClient* client) {
83 #else
84 void StreamTextureProxyImpl::SetClient(cc::VideoFrameProvider::Client* client) { 72 void StreamTextureProxyImpl::SetClient(cc::VideoFrameProvider::Client* client) {
85 #endif
86 base::AutoLock lock(client_lock_); 73 base::AutoLock lock(client_lock_);
87 client_ = client; 74 client_ = client;
88 } 75 }
89 76
90 bool StreamTextureProxyImpl::Initialize(int stream_id, int width, int height) { 77 bool StreamTextureProxyImpl::Initialize(int stream_id, int width, int height) {
91 loop_ = base::MessageLoopProxy::current(); 78 loop_ = base::MessageLoopProxy::current();
92 initialized_ = true; 79 initialized_ = true;
93 return host_->Initialize(stream_id, gfx::Size(width, height)); 80 return host_->Initialize(stream_id, gfx::Size(width, height));
94 } 81 }
95 82
96 void StreamTextureProxyImpl::OnFrameAvailable() { 83 void StreamTextureProxyImpl::OnFrameAvailable() {
97 base::AutoLock lock(client_lock_); 84 base::AutoLock lock(client_lock_);
98 #ifndef REMOVE_WEBVIDEOFRAME
99 if (client_)
100 client_->didReceiveFrame();
101 #else
102 if (client_) 85 if (client_)
103 client_->DidReceiveFrame(); 86 client_->DidReceiveFrame();
104 #endif
105 } 87 }
106 88
107 void StreamTextureProxyImpl::OnMatrixChanged(const float matrix[16]) { 89 void StreamTextureProxyImpl::OnMatrixChanged(const float matrix[16]) {
108 base::AutoLock lock(client_lock_); 90 base::AutoLock lock(client_lock_);
109 #ifndef REMOVE_WEBVIDEOFRAME
110 if (client_)
111 client_->didUpdateMatrix(matrix);
112 #else
113 if (client_) 91 if (client_)
114 client_->DidUpdateMatrix(matrix); 92 client_->DidUpdateMatrix(matrix);
115 #endif
116 } 93 }
117 94
118 } // anonymous namespace 95 } // anonymous namespace
119 96
120 namespace content { 97 namespace content {
121 98
122 StreamTextureFactoryImpl::StreamTextureFactoryImpl( 99 StreamTextureFactoryImpl::StreamTextureFactoryImpl(
123 WebKit::WebGraphicsContext3D* context, 100 WebKit::WebGraphicsContext3D* context,
124 GpuChannelHost* channel, 101 GpuChannelHost* channel,
125 int view_id) 102 int view_id)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 134
158 void StreamTextureFactoryImpl::DestroyStreamTexture(unsigned texture_id) { 135 void StreamTextureFactoryImpl::DestroyStreamTexture(unsigned texture_id) {
159 if (context_->makeContextCurrent()) { 136 if (context_->makeContextCurrent()) {
160 context_->destroyStreamTextureCHROMIUM(texture_id); 137 context_->destroyStreamTextureCHROMIUM(texture_id);
161 context_->deleteTexture(texture_id); 138 context_->deleteTexture(texture_id);
162 context_->flush(); 139 context_->flush();
163 } 140 }
164 } 141 }
165 142
166 } // namespace content 143 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | media/base/video_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698