| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } | 165 } |
| 164 | 166 |
| 165 void GpuVideoDecodeAcceleratorHost::OnCreateDone(int32 decoder_id) { | 167 void GpuVideoDecodeAcceleratorHost::OnCreateDone(int32 decoder_id) { |
| 166 decoder_id_ = decoder_id; | 168 decoder_id_ = decoder_id; |
| 167 if (!ipc_sender_->Send(new AcceleratedVideoDecoderMsg_Initialize( | 169 if (!ipc_sender_->Send(new AcceleratedVideoDecoderMsg_Initialize( |
| 168 decoder_id_, configs_))) { | 170 decoder_id_, configs_))) { |
| 169 LOG(ERROR) << "Send(AcceleratedVideoDecoderMsg_Initialize) failed"; | 171 LOG(ERROR) << "Send(AcceleratedVideoDecoderMsg_Initialize) failed"; |
| 170 } | 172 } |
| 171 } | 173 } |
| 172 | 174 |
| 175 void GpuVideoDecodeAcceleratorHost::OnInitializeDone() { |
| 176 client_->NotifyInitializeDone(); |
| 177 } |
| 178 |
| 173 void GpuVideoDecodeAcceleratorHost::OnPictureReady( | 179 void GpuVideoDecodeAcceleratorHost::OnPictureReady( |
| 174 int32 picture_buffer_id, int32 bitstream_buffer_id) { | 180 int32 picture_buffer_id, int32 bitstream_buffer_id) { |
| 175 media::Picture picture(picture_buffer_id, bitstream_buffer_id); | 181 media::Picture picture(picture_buffer_id, bitstream_buffer_id); |
| 176 client_->PictureReady(picture); | 182 client_->PictureReady(picture); |
| 177 } | 183 } |
| 178 | 184 |
| 179 void GpuVideoDecodeAcceleratorHost::OnFlushDone() { | 185 void GpuVideoDecodeAcceleratorHost::OnFlushDone() { |
| 180 client_->NotifyFlushDone(); | 186 client_->NotifyFlushDone(); |
| 181 } | 187 } |
| 182 | 188 |
| 183 void GpuVideoDecodeAcceleratorHost::OnAbortDone() { | 189 void GpuVideoDecodeAcceleratorHost::OnAbortDone() { |
| 184 client_->NotifyAbortDone(); | 190 client_->NotifyAbortDone(); |
| 185 } | 191 } |
| 186 | 192 |
| 187 void GpuVideoDecodeAcceleratorHost::OnEndOfStream() { | 193 void GpuVideoDecodeAcceleratorHost::OnEndOfStream() { |
| 188 client_->NotifyEndOfStream(); | 194 client_->NotifyEndOfStream(); |
| 189 } | 195 } |
| 190 | 196 |
| 191 void GpuVideoDecodeAcceleratorHost::OnErrorNotification(uint32 error) { | 197 void GpuVideoDecodeAcceleratorHost::OnErrorNotification(uint32 error) { |
| 192 client_->NotifyError( | 198 client_->NotifyError( |
| 193 static_cast<media::VideoDecodeAccelerator::Error>(error)); | 199 static_cast<media::VideoDecodeAccelerator::Error>(error)); |
| 194 } | 200 } |
| OLD | NEW |