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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
171 } | 171 } |
172 | 172 |
173 void GpuVideoDecodeAcceleratorHost::Destroy() { | 173 void GpuVideoDecodeAcceleratorHost::Destroy() { |
174 DCHECK(CalledOnValidThread()); | 174 DCHECK(CalledOnValidThread()); |
175 if (channel_) | 175 if (channel_) |
176 Send(new AcceleratedVideoDecoderMsg_Destroy(decoder_route_id_)); | 176 Send(new AcceleratedVideoDecoderMsg_Destroy(decoder_route_id_)); |
177 client_ = NULL; | 177 client_ = NULL; |
178 delete this; | 178 delete this; |
179 } | 179 } |
180 | 180 |
181 VideoPixelFormat GpuVideoDecodeAcceleratorHost::GetOutputFormat() const { | |
182 return picture_buffer_format_; | |
miu
2016/05/12 20:03:02
Order-of-operations consideration: Should we DCHEC
| |
183 } | |
184 | |
181 void GpuVideoDecodeAcceleratorHost::OnWillDeleteImpl() { | 185 void GpuVideoDecodeAcceleratorHost::OnWillDeleteImpl() { |
182 DCHECK(CalledOnValidThread()); | 186 DCHECK(CalledOnValidThread()); |
183 impl_ = NULL; | 187 impl_ = NULL; |
184 | 188 |
185 // The gpu::CommandBufferProxyImpl is going away; error out this VDA. | 189 // The gpu::CommandBufferProxyImpl is going away; error out this VDA. |
186 OnChannelError(); | 190 OnChannelError(); |
187 } | 191 } |
188 | 192 |
189 void GpuVideoDecodeAcceleratorHost::PostNotifyError(Error error) { | 193 void GpuVideoDecodeAcceleratorHost::PostNotifyError(Error error) { |
190 DCHECK(CalledOnValidThread()); | 194 DCHECK(CalledOnValidThread()); |
(...skipping 19 matching lines...) Expand all Loading... | |
210 } | 214 } |
211 | 215 |
212 void GpuVideoDecodeAcceleratorHost::OnBitstreamBufferProcessed( | 216 void GpuVideoDecodeAcceleratorHost::OnBitstreamBufferProcessed( |
213 int32_t bitstream_buffer_id) { | 217 int32_t bitstream_buffer_id) { |
214 DCHECK(CalledOnValidThread()); | 218 DCHECK(CalledOnValidThread()); |
215 if (client_) | 219 if (client_) |
216 client_->NotifyEndOfBitstreamBuffer(bitstream_buffer_id); | 220 client_->NotifyEndOfBitstreamBuffer(bitstream_buffer_id); |
217 } | 221 } |
218 | 222 |
219 void GpuVideoDecodeAcceleratorHost::OnProvidePictureBuffer( | 223 void GpuVideoDecodeAcceleratorHost::OnProvidePictureBuffer( |
224 VideoPixelFormat format, | |
220 uint32_t num_requested_buffers, | 225 uint32_t num_requested_buffers, |
221 uint32_t textures_per_buffer, | 226 uint32_t textures_per_buffer, |
222 const gfx::Size& dimensions, | 227 const gfx::Size& dimensions, |
223 uint32_t texture_target) { | 228 uint32_t texture_target) { |
224 DCHECK(CalledOnValidThread()); | 229 DCHECK(CalledOnValidThread()); |
miu
2016/05/12 20:03:02
Robustness consideration: Should we DCHECK() that
| |
225 picture_buffer_dimensions_ = dimensions; | 230 picture_buffer_dimensions_ = dimensions; |
231 picture_buffer_format_ = format; | |
226 | 232 |
227 const int kMaxVideoPlanes = 4; | 233 const int kMaxVideoPlanes = 4; |
228 if (textures_per_buffer > kMaxVideoPlanes) { | 234 if (textures_per_buffer > kMaxVideoPlanes) { |
229 PostNotifyError(PLATFORM_FAILURE); | 235 PostNotifyError(PLATFORM_FAILURE); |
230 return; | 236 return; |
231 } | 237 } |
232 | 238 |
233 if (client_) { | 239 if (client_) { |
234 client_->ProvidePictureBuffers(num_requested_buffers, textures_per_buffer, | 240 client_->ProvidePictureBuffers(num_requested_buffers, textures_per_buffer, |
235 dimensions, texture_target); | 241 dimensions, texture_target); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
277 weak_this_factory_.InvalidateWeakPtrs(); | 283 weak_this_factory_.InvalidateWeakPtrs(); |
278 | 284 |
279 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the | 285 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the |
280 // last thing done on this stack! | 286 // last thing done on this stack! |
281 VideoDecodeAccelerator::Client* client = NULL; | 287 VideoDecodeAccelerator::Client* client = NULL; |
282 std::swap(client, client_); | 288 std::swap(client, client_); |
283 client->NotifyError(static_cast<VideoDecodeAccelerator::Error>(error)); | 289 client->NotifyError(static_cast<VideoDecodeAccelerator::Error>(error)); |
284 } | 290 } |
285 | 291 |
286 } // namespace media | 292 } // namespace media |
OLD | NEW |