| 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" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 bool GpuVideoDecodeAcceleratorHost::OnMessageReceived(const IPC::Message& msg) { | 40 bool GpuVideoDecodeAcceleratorHost::OnMessageReceived(const IPC::Message& msg) { |
| 41 bool handled = true; | 41 bool handled = true; |
| 42 IPC_BEGIN_MESSAGE_MAP(GpuVideoDecodeAcceleratorHost, msg) | 42 IPC_BEGIN_MESSAGE_MAP(GpuVideoDecodeAcceleratorHost, msg) |
| 43 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed, | 43 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed, |
| 44 OnBitstreamBufferProcessed) | 44 OnBitstreamBufferProcessed) |
| 45 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_ProvidePictureBuffers, | 45 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_ProvidePictureBuffers, |
| 46 OnProvidePictureBuffer) | 46 OnProvidePictureBuffer) |
| 47 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_CreateDone, | 47 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_CreateDone, |
| 48 OnCreateDone) | 48 OnCreateDone) |
| 49 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_InitializeDone, |
| 50 OnInitializeDone) |
| 49 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_PictureReady, | 51 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_PictureReady, |
| 50 OnPictureReady) | 52 OnPictureReady) |
| 51 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_FlushDone, | 53 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_FlushDone, |
| 52 OnFlushDone) | 54 OnFlushDone) |
| 53 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_AbortDone, | 55 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_AbortDone, |
| 54 OnAbortDone) | 56 OnAbortDone) |
| 55 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_EndOfStream, | 57 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_EndOfStream, |
| 56 OnEndOfStream) | 58 OnEndOfStream) |
| 57 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_ErrorNotification, | 59 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_ErrorNotification, |
| 58 OnErrorNotification) | 60 OnErrorNotification) |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 } | 170 } |
| 169 | 171 |
| 170 void GpuVideoDecodeAcceleratorHost::OnCreateDone(int32 decoder_id) { | 172 void GpuVideoDecodeAcceleratorHost::OnCreateDone(int32 decoder_id) { |
| 171 decoder_id_ = decoder_id; | 173 decoder_id_ = decoder_id; |
| 172 if (!ipc_sender_->Send(new AcceleratedVideoDecoderMsg_Initialize( | 174 if (!ipc_sender_->Send(new AcceleratedVideoDecoderMsg_Initialize( |
| 173 decoder_id_, configs_))) { | 175 decoder_id_, configs_))) { |
| 174 LOG(ERROR) << "Send(AcceleratedVideoDecoderMsg_Initialize) failed"; | 176 LOG(ERROR) << "Send(AcceleratedVideoDecoderMsg_Initialize) failed"; |
| 175 } | 177 } |
| 176 } | 178 } |
| 177 | 179 |
| 180 void GpuVideoDecodeAcceleratorHost::OnInitializeDone() { |
| 181 client_->NotifyInitializeDone(); |
| 182 } |
| 183 |
| 178 void GpuVideoDecodeAcceleratorHost::OnPictureReady( | 184 void GpuVideoDecodeAcceleratorHost::OnPictureReady( |
| 179 int32 picture_buffer_id, int32 bitstream_buffer_id, | 185 int32 picture_buffer_id, int32 bitstream_buffer_id, |
| 180 const gfx::Size& visible_size, const gfx::Size& decoded_size) { | 186 const gfx::Size& visible_size, const gfx::Size& decoded_size) { |
| 181 media::Picture picture( | 187 media::Picture picture( |
| 182 picture_buffer_id, bitstream_buffer_id, visible_size, decoded_size); | 188 picture_buffer_id, bitstream_buffer_id, visible_size, decoded_size); |
| 183 client_->PictureReady(picture); | 189 client_->PictureReady(picture); |
| 184 } | 190 } |
| 185 | 191 |
| 186 void GpuVideoDecodeAcceleratorHost::OnFlushDone() { | 192 void GpuVideoDecodeAcceleratorHost::OnFlushDone() { |
| 187 client_->NotifyFlushDone(); | 193 client_->NotifyFlushDone(); |
| 188 } | 194 } |
| 189 | 195 |
| 190 void GpuVideoDecodeAcceleratorHost::OnAbortDone() { | 196 void GpuVideoDecodeAcceleratorHost::OnAbortDone() { |
| 191 client_->NotifyAbortDone(); | 197 client_->NotifyAbortDone(); |
| 192 } | 198 } |
| 193 | 199 |
| 194 void GpuVideoDecodeAcceleratorHost::OnEndOfStream() { | 200 void GpuVideoDecodeAcceleratorHost::OnEndOfStream() { |
| 195 client_->NotifyEndOfStream(); | 201 client_->NotifyEndOfStream(); |
| 196 } | 202 } |
| 197 | 203 |
| 198 void GpuVideoDecodeAcceleratorHost::OnErrorNotification(uint32 error) { | 204 void GpuVideoDecodeAcceleratorHost::OnErrorNotification(uint32 error) { |
| 199 client_->NotifyError( | 205 client_->NotifyError( |
| 200 static_cast<media::VideoDecodeAccelerator::Error>(error)); | 206 static_cast<media::VideoDecodeAccelerator::Error>(error)); |
| 201 } | 207 } |
| OLD | NEW |