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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 bool GpuVideoDecodeAcceleratorHost::OnMessageReceived(const IPC::Message& msg) { | 45 bool GpuVideoDecodeAcceleratorHost::OnMessageReceived(const IPC::Message& msg) { |
46 DCHECK(CalledOnValidThread()); | 46 DCHECK(CalledOnValidThread()); |
47 bool handled = true; | 47 bool handled = true; |
48 IPC_BEGIN_MESSAGE_MAP(GpuVideoDecodeAcceleratorHost, msg) | 48 IPC_BEGIN_MESSAGE_MAP(GpuVideoDecodeAcceleratorHost, msg) |
49 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_InitializationComplete, | 49 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_InitializationComplete, |
50 OnInitializationComplete) | 50 OnInitializationComplete) |
51 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed, | 51 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed, |
52 OnBitstreamBufferProcessed) | 52 OnBitstreamBufferProcessed) |
53 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_ProvidePictureBuffers, | 53 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_ProvidePictureBuffers, |
54 OnProvidePictureBuffer) | 54 OnProvidePictureBuffers) |
55 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_PictureReady, | 55 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_PictureReady, |
56 OnPictureReady) | 56 OnPictureReady) |
57 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_FlushDone, OnFlushDone) | 57 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_FlushDone, OnFlushDone) |
58 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_ResetDone, OnResetDone) | 58 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_ResetDone, OnResetDone) |
59 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_ErrorNotification, | 59 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_ErrorNotification, |
60 OnNotifyError) | 60 OnNotifyError) |
61 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_DismissPictureBuffer, | 61 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_DismissPictureBuffer, |
62 OnDismissPictureBuffer) | 62 OnDismissPictureBuffer) |
63 IPC_MESSAGE_UNHANDLED(handled = false) | 63 IPC_MESSAGE_UNHANDLED(handled = false) |
64 IPC_END_MESSAGE_MAP() | 64 IPC_END_MESSAGE_MAP() |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 client_->NotifyInitializationComplete(success); | 220 client_->NotifyInitializationComplete(success); |
221 } | 221 } |
222 | 222 |
223 void GpuVideoDecodeAcceleratorHost::OnBitstreamBufferProcessed( | 223 void GpuVideoDecodeAcceleratorHost::OnBitstreamBufferProcessed( |
224 int32_t bitstream_buffer_id) { | 224 int32_t bitstream_buffer_id) { |
225 DCHECK(CalledOnValidThread()); | 225 DCHECK(CalledOnValidThread()); |
226 if (client_) | 226 if (client_) |
227 client_->NotifyEndOfBitstreamBuffer(bitstream_buffer_id); | 227 client_->NotifyEndOfBitstreamBuffer(bitstream_buffer_id); |
228 } | 228 } |
229 | 229 |
230 void GpuVideoDecodeAcceleratorHost::OnProvidePictureBuffer( | 230 void GpuVideoDecodeAcceleratorHost::OnProvidePictureBuffers( |
231 uint32_t num_requested_buffers, | 231 uint32_t num_requested_buffers, |
232 VideoPixelFormat format, | 232 VideoPixelFormat format, |
233 uint32_t textures_per_buffer, | 233 uint32_t textures_per_buffer, |
234 const gfx::Size& dimensions, | 234 const gfx::Size& dimensions, |
235 uint32_t texture_target) { | 235 uint32_t texture_target) { |
236 DCHECK(CalledOnValidThread()); | 236 DCHECK(CalledOnValidThread()); |
237 picture_buffer_dimensions_ = dimensions; | 237 picture_buffer_dimensions_ = dimensions; |
238 | 238 |
239 const int kMaxVideoPlanes = 4; | 239 const int kMaxVideoPlanes = 4; |
240 if (textures_per_buffer > kMaxVideoPlanes) { | 240 if (textures_per_buffer > kMaxVideoPlanes) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 weak_this_factory_.InvalidateWeakPtrs(); | 289 weak_this_factory_.InvalidateWeakPtrs(); |
290 | 290 |
291 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the | 291 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the |
292 // last thing done on this stack! | 292 // last thing done on this stack! |
293 VideoDecodeAccelerator::Client* client = nullptr; | 293 VideoDecodeAccelerator::Client* client = nullptr; |
294 std::swap(client, client_); | 294 std::swap(client, client_); |
295 client->NotifyError(static_cast<VideoDecodeAccelerator::Error>(error)); | 295 client->NotifyError(static_cast<VideoDecodeAccelerator::Error>(error)); |
296 } | 296 } |
297 | 297 |
298 } // namespace media | 298 } // namespace media |
OLD | NEW |