Chromium Code Reviews| Index: content/renderer/gpu/stream_texture_host_android.cc |
| diff --git a/content/renderer/gpu/stream_texture_host_android.cc b/content/renderer/gpu/stream_texture_host_android.cc |
| index 208385d4e6f65fcbc3c031691c5658fbc2302510..e03a16dee84a20222268155158f35d56ae766ac0 100644 |
| --- a/content/renderer/gpu/stream_texture_host_android.cc |
| +++ b/content/renderer/gpu/stream_texture_host_android.cc |
| @@ -4,6 +4,7 @@ |
| #include "content/renderer/gpu/stream_texture_host_android.h" |
| +#include "base/unguessable_token.h" |
| #include "content/renderer/render_thread_impl.h" |
| #include "gpu/ipc/client/gpu_channel_host.h" |
| #include "gpu/ipc/common/gpu_messages.h" |
| @@ -11,8 +12,9 @@ |
| namespace content { |
| -StreamTextureHost::StreamTextureHost(scoped_refptr<gpu::GpuChannelHost> channel) |
| - : stream_id_(0), |
| +StreamTextureHost::StreamTextureHost(scoped_refptr<gpu::GpuChannelHost> channel, |
| + int32_t route_id) |
| + : route_id_(route_id), |
| listener_(NULL), |
| channel_(std::move(channel)), |
| weak_ptr_factory_(this) { |
| @@ -20,17 +22,15 @@ StreamTextureHost::StreamTextureHost(scoped_refptr<gpu::GpuChannelHost> channel) |
| } |
| StreamTextureHost::~StreamTextureHost() { |
| - if (channel_.get() && stream_id_) |
| - channel_->RemoveRoute(stream_id_); |
| + if (channel_.get() && route_id_) |
| + channel_->RemoveRoute(route_id_); |
| } |
| -bool StreamTextureHost::BindToCurrentThread(int32_t stream_id, |
| - Listener* listener) { |
| +bool StreamTextureHost::BindToCurrentThread(Listener* listener) { |
| listener_ = listener; |
| - if (channel_.get() && stream_id && !stream_id_) { |
| - stream_id_ = stream_id; |
| - channel_->AddRoute(stream_id, weak_ptr_factory_.GetWeakPtr()); |
| - channel_->Send(new GpuStreamTextureMsg_StartListening(stream_id)); |
| + if (channel_.get() && route_id_) { |
| + channel_->AddRoute(route_id_, weak_ptr_factory_.GetWeakPtr()); |
| + channel_->Send(new GpuStreamTextureMsg_StartListening(route_id_)); |
| return true; |
| } |
| @@ -56,4 +56,24 @@ void StreamTextureHost::OnFrameAvailable() { |
| listener_->OnFrameAvailable(); |
| } |
| +void StreamTextureHost::EstablishPeer(int player_id, int frame_id) { |
| + if (route_id_) { |
| + channel_->Send( |
| + new GpuStreamTextureMsg_EstablishPeer(route_id_, frame_id, player_id)); |
|
Ken Russell (switch to Gerrit)
2016/10/10 23:34:24
Not knowing this API, it seems strange that the fr
sivag
2016/10/12 11:25:33
its used to get the MediaPlayer from the manager
a
|
| + } |
| +} |
| + |
| +void StreamTextureHost::SetStreamTextureSize(const gfx::Size& size) { |
| + if (route_id_) |
| + channel_->Send(new GpuStreamTextureMsg_SetSize(route_id_, size)); |
| +} |
| + |
| +void StreamTextureHost::ForwardStreamTextureForSurfaceRequest( |
| + const base::UnguessableToken& request_token) { |
| + if (route_id_) { |
| + channel_->Send(new GpuStreamTextureMsg_ForwardForSurfaceRequest( |
| + route_id_, request_token)); |
| + } |
| +} |
| + |
| } // namespace content |