| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "media/gpu/ipc/service/media_gpu_channel.h" | 5 #include "media/gpu/ipc/service/media_gpu_channel.h" |
| 6 | 6 |
| 7 #include "base/unguessable_token.h" | 7 #include "base/unguessable_token.h" |
| 8 #include "gpu/ipc/service/gpu_channel.h" | 8 #include "gpu/ipc/service/gpu_channel.h" |
| 9 #include "ipc/message_filter.h" | 9 #include "ipc/message_filter.h" |
| 10 #include "media/gpu/ipc/common/media_messages.h" | 10 #include "media/gpu/ipc/common/media_messages.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 Send(reply_message); | 82 Send(reply_message); |
| 83 } | 83 } |
| 84 | 84 |
| 85 private: | 85 private: |
| 86 ~MediaGpuChannelFilter() override {} | 86 ~MediaGpuChannelFilter() override {} |
| 87 | 87 |
| 88 IPC::Channel* channel_; | 88 IPC::Channel* channel_; |
| 89 base::UnguessableToken channel_token_; | 89 base::UnguessableToken channel_token_; |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 MediaGpuChannel::MediaGpuChannel(gpu::GpuChannel* channel, | 92 MediaGpuChannel::MediaGpuChannel( |
| 93 const base::UnguessableToken& channel_token) | 93 gpu::GpuChannel* channel, |
| 94 : channel_(channel) { | 94 const base::UnguessableToken& channel_token, |
| 95 const AndroidOverlayMojoFactoryCB& overlay_factory_cb) |
| 96 : channel_(channel), overlay_factory_cb_(overlay_factory_cb) { |
| 95 channel_->AddFilter(new MediaGpuChannelFilter(channel_token)); | 97 channel_->AddFilter(new MediaGpuChannelFilter(channel_token)); |
| 96 } | 98 } |
| 97 | 99 |
| 98 MediaGpuChannel::~MediaGpuChannel() {} | 100 MediaGpuChannel::~MediaGpuChannel() {} |
| 99 | 101 |
| 100 bool MediaGpuChannel::Send(IPC::Message* msg) { | 102 bool MediaGpuChannel::Send(IPC::Message* msg) { |
| 101 return channel_->Send(msg); | 103 return channel_->Send(msg); |
| 102 } | 104 } |
| 103 | 105 |
| 104 bool MediaGpuChannel::OnMessageReceived(const IPC::Message& message) { | 106 bool MediaGpuChannel::OnMessageReceived(const IPC::Message& message) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 IPC::Message* reply_message) { | 144 IPC::Message* reply_message) { |
| 143 TRACE_EVENT0("gpu", "MediaGpuChannel::OnCreateVideoDecoder"); | 145 TRACE_EVENT0("gpu", "MediaGpuChannel::OnCreateVideoDecoder"); |
| 144 gpu::GpuCommandBufferStub* stub = | 146 gpu::GpuCommandBufferStub* stub = |
| 145 channel_->LookupCommandBuffer(command_buffer_route_id); | 147 channel_->LookupCommandBuffer(command_buffer_route_id); |
| 146 if (!stub) { | 148 if (!stub) { |
| 147 reply_message->set_reply_error(); | 149 reply_message->set_reply_error(); |
| 148 Send(reply_message); | 150 Send(reply_message); |
| 149 return; | 151 return; |
| 150 } | 152 } |
| 151 GpuVideoDecodeAccelerator* decoder = new GpuVideoDecodeAccelerator( | 153 GpuVideoDecodeAccelerator* decoder = new GpuVideoDecodeAccelerator( |
| 152 decoder_route_id, stub, stub->channel()->io_task_runner()); | 154 decoder_route_id, stub, stub->channel()->io_task_runner(), |
| 155 overlay_factory_cb_); |
| 153 bool succeeded = decoder->Initialize(config); | 156 bool succeeded = decoder->Initialize(config); |
| 154 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(reply_message, | 157 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(reply_message, |
| 155 succeeded); | 158 succeeded); |
| 156 Send(reply_message); | 159 Send(reply_message); |
| 157 | 160 |
| 158 // decoder is registered as a DestructionObserver of this stub and will | 161 // decoder is registered as a DestructionObserver of this stub and will |
| 159 // self-delete during destruction of this stub. | 162 // self-delete during destruction of this stub. |
| 160 } | 163 } |
| 161 | 164 |
| 162 void MediaGpuChannel::OnCreateVideoEncoder( | 165 void MediaGpuChannel::OnCreateVideoEncoder( |
| (...skipping 15 matching lines...) Expand all Loading... |
| 178 params.output_profile, params.initial_bitrate); | 181 params.output_profile, params.initial_bitrate); |
| 179 GpuCommandBufferMsg_CreateVideoEncoder::WriteReplyParams(reply_message, | 182 GpuCommandBufferMsg_CreateVideoEncoder::WriteReplyParams(reply_message, |
| 180 succeeded); | 183 succeeded); |
| 181 Send(reply_message); | 184 Send(reply_message); |
| 182 | 185 |
| 183 // encoder is registered as a DestructionObserver of this stub and will | 186 // encoder is registered as a DestructionObserver of this stub and will |
| 184 // self-delete during destruction of this stub. | 187 // self-delete during destruction of this stub. |
| 185 } | 188 } |
| 186 | 189 |
| 187 } // namespace media | 190 } // namespace media |
| OLD | NEW |