OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/android/stream_texture_factory_impl.h" | 5 #include "content/renderer/media/android/stream_texture_factory_impl.h" |
6 | 6 |
7 #include "cc/output/context_provider.h" | 7 #include "cc/output/context_provider.h" |
8 #include "content/common/gpu/client/gpu_channel_host.h" | 8 #include "content/common/gpu/client/gpu_channel_host.h" |
9 #include "content/common/gpu/gpu_messages.h" | 9 #include "content/common/gpu/gpu_messages.h" |
10 #include "content/renderer/gpu/stream_texture_host_android.h" | 10 #include "content/renderer/gpu/stream_texture_host_android.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 if (client_) | 74 if (client_) |
75 client_->DidUpdateMatrix(matrix); | 75 client_->DidUpdateMatrix(matrix); |
76 } | 76 } |
77 | 77 |
78 } // namespace | 78 } // namespace |
79 | 79 |
80 // static | 80 // static |
81 scoped_refptr<StreamTextureFactoryImpl> StreamTextureFactoryImpl::Create( | 81 scoped_refptr<StreamTextureFactoryImpl> StreamTextureFactoryImpl::Create( |
82 const scoped_refptr<cc::ContextProvider>& context_provider, | 82 const scoped_refptr<cc::ContextProvider>& context_provider, |
83 GpuChannelHost* channel, | 83 GpuChannelHost* channel, |
84 int view_id) { | 84 int frame_id) { |
85 return new StreamTextureFactoryImpl(context_provider, channel, view_id); | 85 return new StreamTextureFactoryImpl(context_provider, channel, frame_id); |
86 } | 86 } |
87 | 87 |
88 StreamTextureFactoryImpl::StreamTextureFactoryImpl( | 88 StreamTextureFactoryImpl::StreamTextureFactoryImpl( |
89 const scoped_refptr<cc::ContextProvider>& context_provider, | 89 const scoped_refptr<cc::ContextProvider>& context_provider, |
90 GpuChannelHost* channel, | 90 GpuChannelHost* channel, |
91 int view_id) | 91 int frame_id) |
92 : context_provider_(context_provider), | 92 : context_provider_(context_provider), |
93 channel_(channel), | 93 channel_(channel), |
94 view_id_(view_id) { | 94 frame_id_(frame_id) { |
95 DCHECK(channel); | 95 DCHECK(channel); |
96 } | 96 } |
97 | 97 |
98 StreamTextureFactoryImpl::~StreamTextureFactoryImpl() {} | 98 StreamTextureFactoryImpl::~StreamTextureFactoryImpl() {} |
99 | 99 |
100 StreamTextureProxy* StreamTextureFactoryImpl::CreateProxy() { | 100 StreamTextureProxy* StreamTextureFactoryImpl::CreateProxy() { |
101 DCHECK(channel_.get()); | 101 DCHECK(channel_.get()); |
102 StreamTextureHost* host = new StreamTextureHost(channel_.get()); | 102 StreamTextureHost* host = new StreamTextureHost(channel_.get()); |
103 return new StreamTextureProxyImpl(host); | 103 return new StreamTextureProxyImpl(host); |
104 } | 104 } |
105 | 105 |
106 void StreamTextureFactoryImpl::EstablishPeer(int32 stream_id, int player_id) { | 106 void StreamTextureFactoryImpl::EstablishPeer(int32 stream_id, int player_id) { |
107 DCHECK(channel_.get()); | 107 DCHECK(channel_.get()); |
108 channel_->Send( | 108 channel_->Send( |
109 new GpuStreamTextureMsg_EstablishPeer(stream_id, view_id_, player_id)); | 109 new GpuStreamTextureMsg_EstablishPeer(stream_id, frame_id_, player_id)); |
110 } | 110 } |
111 | 111 |
112 unsigned StreamTextureFactoryImpl::CreateStreamTexture( | 112 unsigned StreamTextureFactoryImpl::CreateStreamTexture( |
113 unsigned texture_target, | 113 unsigned texture_target, |
114 unsigned* texture_id, | 114 unsigned* texture_id, |
115 gpu::Mailbox* texture_mailbox) { | 115 gpu::Mailbox* texture_mailbox) { |
116 GLuint stream_id = 0; | 116 GLuint stream_id = 0; |
117 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); | 117 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); |
118 gl->GenTextures(1, texture_id); | 118 gl->GenTextures(1, texture_id); |
119 | 119 |
120 stream_id = gl->CreateStreamTextureCHROMIUM(*texture_id); | 120 stream_id = gl->CreateStreamTextureCHROMIUM(*texture_id); |
121 | 121 |
122 gl->GenMailboxCHROMIUM(texture_mailbox->name); | 122 gl->GenMailboxCHROMIUM(texture_mailbox->name); |
123 gl->BindTexture(texture_target, *texture_id); | 123 gl->BindTexture(texture_target, *texture_id); |
124 gl->ProduceTextureCHROMIUM(texture_target, texture_mailbox->name); | 124 gl->ProduceTextureCHROMIUM(texture_target, texture_mailbox->name); |
125 return stream_id; | 125 return stream_id; |
126 } | 126 } |
127 | 127 |
128 void StreamTextureFactoryImpl::SetStreamTextureSize(int32 stream_id, | 128 void StreamTextureFactoryImpl::SetStreamTextureSize(int32 stream_id, |
129 const gfx::Size& size) { | 129 const gfx::Size& size) { |
130 channel_->Send(new GpuStreamTextureMsg_SetSize(stream_id, size)); | 130 channel_->Send(new GpuStreamTextureMsg_SetSize(stream_id, size)); |
131 } | 131 } |
132 | 132 |
133 gpu::gles2::GLES2Interface* StreamTextureFactoryImpl::ContextGL() { | 133 gpu::gles2::GLES2Interface* StreamTextureFactoryImpl::ContextGL() { |
134 return context_provider_->ContextGL(); | 134 return context_provider_->ContextGL(); |
135 } | 135 } |
136 | 136 |
137 } // namespace content | 137 } // namespace content |
OLD | NEW |