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; | |
18 | 17 |
19 GpuVideoDecodeAcceleratorHost::GpuVideoDecodeAcceleratorHost( | 18 GpuVideoDecodeAcceleratorHost::GpuVideoDecodeAcceleratorHost( |
20 MessageRouter* router, | 19 MessageRouter* router, |
21 IPC::Message::Sender* ipc_sender, | 20 IPC::Message::Sender* ipc_sender, |
22 int32 decoder_host_id, | 21 int32 decoder_host_id, |
23 VideoDecodeAccelerator::Client* client) | 22 VideoDecodeAccelerator::Client* client) |
24 : router_(router), | 23 : router_(router), |
25 ipc_sender_(ipc_sender), | 24 ipc_sender_(ipc_sender), |
26 decoder_host_id_(decoder_host_id), | 25 decoder_host_id_(decoder_host_id), |
27 decoder_id_(0), | 26 decoder_id_(0), |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 } | 97 } |
99 | 98 |
100 void GpuVideoDecodeAcceleratorHost::AssignGLESBuffers( | 99 void GpuVideoDecodeAcceleratorHost::AssignGLESBuffers( |
101 const std::vector<media::GLESBuffer>& buffers) { | 100 const std::vector<media::GLESBuffer>& buffers) { |
102 // Rearrange data for IPC command. | 101 // Rearrange data for IPC command. |
103 std::vector<int32> buffer_ids; | 102 std::vector<int32> buffer_ids; |
104 std::vector<uint32> texture_ids; | 103 std::vector<uint32> texture_ids; |
105 std::vector<uint32> context_ids; | 104 std::vector<uint32> context_ids; |
106 std::vector<gfx::Size> sizes; | 105 std::vector<gfx::Size> sizes; |
107 for (uint32 i = 0; i < buffers.size(); i++) { | 106 for (uint32 i = 0; i < buffers.size(); i++) { |
108 const media::BufferInfo& info = buffers[i].buffer_info(); | 107 const media::GLESBuffer& buffer = buffers[i]; |
109 texture_ids.push_back(buffers[i].texture_id()); | 108 texture_ids.push_back(buffer.texture_id()); |
110 context_ids.push_back(buffers[i].context_id()); | 109 context_ids.push_back(buffer.context_id()); |
111 buffer_ids.push_back(info.id()); | 110 buffer_ids.push_back(buffer.id()); |
112 sizes.push_back(info.size()); | 111 sizes.push_back(buffer.size()); |
113 } | 112 } |
114 if (!ipc_sender_->Send(new AcceleratedVideoDecoderMsg_AssignGLESBuffers( | 113 if (!ipc_sender_->Send(new AcceleratedVideoDecoderMsg_AssignGLESBuffers( |
115 decoder_id_, buffer_ids, texture_ids, context_ids, sizes))) { | 114 decoder_id_, buffer_ids, texture_ids, context_ids, sizes))) { |
116 LOG(ERROR) << "Send(AcceleratedVideoDecoderMsg_AssignGLESBuffers) failed"; | 115 LOG(ERROR) << "Send(AcceleratedVideoDecoderMsg_AssignGLESBuffers) failed"; |
117 } | 116 } |
118 } | 117 } |
119 | 118 |
120 void GpuVideoDecodeAcceleratorHost::AssignSysmemBuffers( | 119 void GpuVideoDecodeAcceleratorHost::AssignSysmemBuffers( |
121 const std::vector<media::SysmemBuffer>& buffers) { | 120 const std::vector<media::SysmemBuffer>& buffers) { |
122 // TODO(vrk): Implement. | 121 // TODO(vrk): Implement. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 } | 191 } |
193 | 192 |
194 void GpuVideoDecodeAcceleratorHost::OnEndOfStream() { | 193 void GpuVideoDecodeAcceleratorHost::OnEndOfStream() { |
195 client_->NotifyEndOfStream(); | 194 client_->NotifyEndOfStream(); |
196 } | 195 } |
197 | 196 |
198 void GpuVideoDecodeAcceleratorHost::OnErrorNotification(uint32 error) { | 197 void GpuVideoDecodeAcceleratorHost::OnErrorNotification(uint32 error) { |
199 client_->NotifyError( | 198 client_->NotifyError( |
200 static_cast<media::VideoDecodeAccelerator::Error>(error)); | 199 static_cast<media::VideoDecodeAccelerator::Error>(error)); |
201 } | 200 } |
OLD | NEW |