OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/client/gpu_video_decode_accelerator_host.h" | 5 #include "media/gpu/ipc/client/gpu_video_decode_accelerator_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 } | 123 } |
124 | 124 |
125 void GpuVideoDecodeAcceleratorHost::AssignPictureBuffers( | 125 void GpuVideoDecodeAcceleratorHost::AssignPictureBuffers( |
126 const std::vector<PictureBuffer>& buffers) { | 126 const std::vector<PictureBuffer>& buffers) { |
127 DCHECK(CalledOnValidThread()); | 127 DCHECK(CalledOnValidThread()); |
128 if (!channel_) | 128 if (!channel_) |
129 return; | 129 return; |
130 // Rearrange data for IPC command. | 130 // Rearrange data for IPC command. |
131 std::vector<int32_t> buffer_ids; | 131 std::vector<int32_t> buffer_ids; |
132 std::vector<PictureBuffer::TextureIds> texture_ids; | 132 std::vector<PictureBuffer::TextureIds> texture_ids; |
| 133 std::vector<uint32_t> texture_targets; |
| 134 std::vector<VideoPixelFormat> formats; |
| 135 std::vector<gfx::Size> sizes; |
133 for (uint32_t i = 0; i < buffers.size(); i++) { | 136 for (uint32_t i = 0; i < buffers.size(); i++) { |
134 const PictureBuffer& buffer = buffers[i]; | 137 const PictureBuffer& buffer = buffers[i]; |
135 if (buffer.size() != picture_buffer_dimensions_) { | 138 if (buffer.size() != picture_buffer_dimensions_) { |
136 DLOG(ERROR) << "buffer.size() invalid: expected " | 139 DLOG(ERROR) << "buffer.size() invalid: expected " |
137 << picture_buffer_dimensions_.ToString() << ", got " | 140 << picture_buffer_dimensions_.ToString() << ", got " |
138 << buffer.size().ToString(); | 141 << buffer.size().ToString(); |
139 PostNotifyError(INVALID_ARGUMENT); | 142 PostNotifyError(INVALID_ARGUMENT); |
140 return; | 143 return; |
141 } | 144 } |
142 texture_ids.push_back(buffer.client_texture_ids()); | 145 texture_ids.push_back(buffer.client_texture_ids()); |
143 buffer_ids.push_back(buffer.id()); | 146 buffer_ids.push_back(buffer.id()); |
| 147 texture_targets.push_back(buffer.texture_target()); |
| 148 formats.push_back(buffer.pixel_format()); |
| 149 sizes.push_back(buffer.size()); |
144 } | 150 } |
145 Send(new AcceleratedVideoDecoderMsg_AssignPictureBuffers( | 151 Send(new AcceleratedVideoDecoderMsg_AssignPictureBuffers( |
146 decoder_route_id_, buffer_ids, texture_ids)); | 152 decoder_route_id_, buffer_ids, texture_ids, texture_targets, formats, |
| 153 sizes)); |
147 } | 154 } |
148 | 155 |
149 void GpuVideoDecodeAcceleratorHost::ReusePictureBuffer( | 156 void GpuVideoDecodeAcceleratorHost::ReusePictureBuffer( |
150 int32_t picture_buffer_id) { | 157 int32_t picture_buffer_id) { |
151 DCHECK(CalledOnValidThread()); | 158 DCHECK(CalledOnValidThread()); |
152 if (!channel_) | 159 if (!channel_) |
153 return; | 160 return; |
154 Send(new AcceleratedVideoDecoderMsg_ReusePictureBuffer(decoder_route_id_, | 161 Send(new AcceleratedVideoDecoderMsg_ReusePictureBuffer(decoder_route_id_, |
155 picture_buffer_id)); | 162 picture_buffer_id)); |
156 } | 163 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 weak_this_factory_.InvalidateWeakPtrs(); | 294 weak_this_factory_.InvalidateWeakPtrs(); |
288 | 295 |
289 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the | 296 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the |
290 // last thing done on this stack! | 297 // last thing done on this stack! |
291 VideoDecodeAccelerator::Client* client = nullptr; | 298 VideoDecodeAccelerator::Client* client = nullptr; |
292 std::swap(client, client_); | 299 std::swap(client, client_); |
293 client->NotifyError(static_cast<VideoDecodeAccelerator::Error>(error)); | 300 client->NotifyError(static_cast<VideoDecodeAccelerator::Error>(error)); |
294 } | 301 } |
295 | 302 |
296 } // namespace media | 303 } // namespace media |
OLD | NEW |