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/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/message_loop_proxy.h" | 9 #include "base/message_loop/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/public/platform/WebGraphicsContext3D.h" | 15 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
16 #include "ui/gfx/size.h" | 16 #include "ui/gfx/size.h" |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 // Implementation of the StreamTextureProxy class. This class listens to all | 20 // Implementation of the StreamTextureProxy class. This class listens to all |
21 // the stream texture updates and forward them to the | 21 // the stream texture updates and forward them to the |
22 // cc::VideoFrameProvider::Client. | 22 // cc::VideoFrameProvider::Client. |
23 class StreamTextureProxyImpl : public webkit_media::StreamTextureProxy, | 23 class StreamTextureProxyImpl : public content::StreamTextureProxy, |
qinmin
2013/06/21 04:37:05
see my earlier comments, we can just rename this t
scherkus (not reviewing)
2013/06/21 21:37:59
I was going to defer that to another CL but I real
| |
24 public content::StreamTextureHost::Listener { | 24 public content::StreamTextureHost::Listener { |
25 public: | 25 public: |
26 explicit StreamTextureProxyImpl(content::StreamTextureHost* host); | 26 explicit StreamTextureProxyImpl(content::StreamTextureHost* host); |
27 virtual ~StreamTextureProxyImpl() {} | 27 virtual ~StreamTextureProxyImpl() {} |
28 | 28 |
29 // webkit_media::StreamTextureProxy implementation: | 29 // webkit_media::StreamTextureProxy implementation: |
30 virtual void BindToCurrentThread( | 30 virtual void BindToCurrentThread( |
31 int stream_id, int width, int height) OVERRIDE; | 31 int stream_id, int width, int height) OVERRIDE; |
32 virtual bool IsBoundToThread() OVERRIDE { return !!loop_.get(); } | 32 virtual bool IsBoundToThread() OVERRIDE { return !!loop_.get(); } |
33 virtual void SetClient(cc::VideoFrameProvider::Client* client) OVERRIDE; | 33 virtual void SetClient(cc::VideoFrameProvider::Client* client) OVERRIDE; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 : context_(context), | 97 : context_(context), |
98 channel_(channel), | 98 channel_(channel), |
99 view_id_(view_id) { | 99 view_id_(view_id) { |
100 DCHECK(context_); | 100 DCHECK(context_); |
101 DCHECK(channel); | 101 DCHECK(channel); |
102 } | 102 } |
103 | 103 |
104 StreamTextureFactoryImpl::~StreamTextureFactoryImpl() { | 104 StreamTextureFactoryImpl::~StreamTextureFactoryImpl() { |
105 } | 105 } |
106 | 106 |
107 webkit_media::StreamTextureProxy* StreamTextureFactoryImpl::CreateProxy() { | 107 StreamTextureProxy* StreamTextureFactoryImpl::CreateProxy() { |
108 DCHECK(channel_.get()); | 108 DCHECK(channel_.get()); |
109 StreamTextureHost* host = new StreamTextureHost(channel_.get()); | 109 StreamTextureHost* host = new StreamTextureHost(channel_.get()); |
110 return new StreamTextureProxyImpl(host); | 110 return new StreamTextureProxyImpl(host); |
111 } | 111 } |
112 | 112 |
113 void StreamTextureFactoryImpl::EstablishPeer(int stream_id, int player_id) { | 113 void StreamTextureFactoryImpl::EstablishPeer(int stream_id, int player_id) { |
114 DCHECK(channel_.get()); | 114 DCHECK(channel_.get()); |
115 channel_->Send(new GpuChannelMsg_EstablishStreamTexture( | 115 channel_->Send(new GpuChannelMsg_EstablishStreamTexture( |
116 stream_id, view_id_, player_id)); | 116 stream_id, view_id_, player_id)); |
117 } | 117 } |
(...skipping 10 matching lines...) Expand all Loading... | |
128 | 128 |
129 void StreamTextureFactoryImpl::DestroyStreamTexture(unsigned texture_id) { | 129 void StreamTextureFactoryImpl::DestroyStreamTexture(unsigned texture_id) { |
130 if (context_->makeContextCurrent()) { | 130 if (context_->makeContextCurrent()) { |
131 context_->destroyStreamTextureCHROMIUM(texture_id); | 131 context_->destroyStreamTextureCHROMIUM(texture_id); |
132 context_->deleteTexture(texture_id); | 132 context_->deleteTexture(texture_id); |
133 context_->flush(); | 133 context_->flush(); |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 } // namespace content | 137 } // namespace content |
OLD | NEW |