| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/gpu_video_decode_accelerator_host.h" | 5 #include "content/renderer/gpu_video_decode_accelerator_host.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/shared_memory.h" | 8 #include "base/shared_memory.h" |
| 9 #include "base/task.h" | 9 #include "base/task.h" |
| 10 #include "content/common/gpu/gpu_messages.h" | 10 #include "content/common/gpu/gpu_messages.h" |
| 11 #include "content/common/view_messages.h" | 11 #include "content/common/view_messages.h" |
| 12 #include "content/renderer/render_thread.h" | 12 #include "content/renderer/render_thread.h" |
| 13 #include "ipc/ipc_message_macros.h" | 13 #include "ipc/ipc_message_macros.h" |
| 14 #include "ipc/ipc_message_utils.h" | 14 #include "ipc/ipc_message_utils.h" |
| 15 | 15 |
| 16 using media::VideoDecodeAccelerator; | 16 using media::VideoDecodeAccelerator; |
| 17 using media::VideoDecodeAcceleratorCallback; |
| 17 | 18 |
| 18 GpuVideoDecodeAcceleratorHost::GpuVideoDecodeAcceleratorHost( | 19 GpuVideoDecodeAcceleratorHost::GpuVideoDecodeAcceleratorHost( |
| 19 MessageRouter* router, | 20 MessageRouter* router, |
| 20 IPC::Message::Sender* ipc_sender, | 21 IPC::Message::Sender* ipc_sender, |
| 21 int32 decoder_host_id, | 22 int32 decoder_host_id, |
| 22 VideoDecodeAccelerator::Client* client) | 23 VideoDecodeAccelerator::Client* client) |
| 23 : router_(router), | 24 : router_(router), |
| 24 ipc_sender_(ipc_sender), | 25 ipc_sender_(ipc_sender), |
| 25 decoder_host_id_(decoder_host_id), | 26 decoder_host_id_(decoder_host_id), |
| 26 decoder_id_(0), | 27 decoder_id_(0), |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 } | 98 } |
| 98 | 99 |
| 99 void GpuVideoDecodeAcceleratorHost::AssignGLESBuffers( | 100 void GpuVideoDecodeAcceleratorHost::AssignGLESBuffers( |
| 100 const std::vector<media::GLESBuffer>& buffers) { | 101 const std::vector<media::GLESBuffer>& buffers) { |
| 101 // Rearrange data for IPC command. | 102 // Rearrange data for IPC command. |
| 102 std::vector<int32> buffer_ids; | 103 std::vector<int32> buffer_ids; |
| 103 std::vector<uint32> texture_ids; | 104 std::vector<uint32> texture_ids; |
| 104 std::vector<uint32> context_ids; | 105 std::vector<uint32> context_ids; |
| 105 std::vector<gfx::Size> sizes; | 106 std::vector<gfx::Size> sizes; |
| 106 for (uint32 i = 0; i < buffers.size(); i++) { | 107 for (uint32 i = 0; i < buffers.size(); i++) { |
| 107 const media::GLESBuffer& buffer = buffers[i]; | 108 const media::BufferInfo& info = buffers[i].buffer_info(); |
| 108 texture_ids.push_back(buffer.texture_id()); | 109 texture_ids.push_back(buffers[i].texture_id()); |
| 109 context_ids.push_back(buffer.context_id()); | 110 context_ids.push_back(buffers[i].context_id()); |
| 110 buffer_ids.push_back(buffer.id()); | 111 buffer_ids.push_back(info.id()); |
| 111 sizes.push_back(buffer.size()); | 112 sizes.push_back(info.size()); |
| 112 } | 113 } |
| 113 if (!ipc_sender_->Send(new AcceleratedVideoDecoderMsg_AssignGLESBuffers( | 114 if (!ipc_sender_->Send(new AcceleratedVideoDecoderMsg_AssignGLESBuffers( |
| 114 decoder_id_, buffer_ids, texture_ids, context_ids, sizes))) { | 115 decoder_id_, buffer_ids, texture_ids, context_ids, sizes))) { |
| 115 LOG(ERROR) << "Send(AcceleratedVideoDecoderMsg_AssignGLESBuffers) failed"; | 116 LOG(ERROR) << "Send(AcceleratedVideoDecoderMsg_AssignGLESBuffers) failed"; |
| 116 } | 117 } |
| 117 } | 118 } |
| 118 | 119 |
| 119 void GpuVideoDecodeAcceleratorHost::AssignSysmemBuffers( | 120 void GpuVideoDecodeAcceleratorHost::AssignSysmemBuffers( |
| 120 const std::vector<media::SysmemBuffer>& buffers) { | 121 const std::vector<media::SysmemBuffer>& buffers) { |
| 121 // TODO(vrk): Implement. | 122 // TODO(vrk): Implement. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 } | 192 } |
| 192 | 193 |
| 193 void GpuVideoDecodeAcceleratorHost::OnEndOfStream() { | 194 void GpuVideoDecodeAcceleratorHost::OnEndOfStream() { |
| 194 client_->NotifyEndOfStream(); | 195 client_->NotifyEndOfStream(); |
| 195 } | 196 } |
| 196 | 197 |
| 197 void GpuVideoDecodeAcceleratorHost::OnErrorNotification(uint32 error) { | 198 void GpuVideoDecodeAcceleratorHost::OnErrorNotification(uint32 error) { |
| 198 client_->NotifyError( | 199 client_->NotifyError( |
| 199 static_cast<media::VideoDecodeAccelerator::Error>(error)); | 200 static_cast<media::VideoDecodeAccelerator::Error>(error)); |
| 200 } | 201 } |
| OLD | NEW |