OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/gpu/gpu_video_decoder.h" | 5 #include "chrome/gpu/gpu_video_decoder.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/common/child_thread.h" | 8 #include "chrome/common/child_thread.h" |
9 #include "chrome/common/gpu_messages.h" | 9 #include "chrome/common/gpu_messages.h" |
10 #include "chrome/gpu/gpu_channel.h" | 10 #include "chrome/gpu/gpu_channel.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 std::vector<scoped_refptr<media::VideoFrame> >* frames; | 28 std::vector<scoped_refptr<media::VideoFrame> >* frames; |
29 Task* task; | 29 Task* task; |
30 }; | 30 }; |
31 | 31 |
32 void GpuVideoDecoder::OnChannelConnected(int32 peer_pid) { | 32 void GpuVideoDecoder::OnChannelConnected(int32 peer_pid) { |
33 } | 33 } |
34 | 34 |
35 void GpuVideoDecoder::OnChannelError() { | 35 void GpuVideoDecoder::OnChannelError() { |
36 } | 36 } |
37 | 37 |
38 void GpuVideoDecoder::OnMessageReceived(const IPC::Message& msg) { | 38 bool GpuVideoDecoder::OnMessageReceived(const IPC::Message& msg) { |
| 39 bool handled = true; |
39 IPC_BEGIN_MESSAGE_MAP(GpuVideoDecoder, msg) | 40 IPC_BEGIN_MESSAGE_MAP(GpuVideoDecoder, msg) |
40 IPC_MESSAGE_HANDLER(GpuVideoDecoderMsg_Initialize, | 41 IPC_MESSAGE_HANDLER(GpuVideoDecoderMsg_Initialize, |
41 OnInitialize) | 42 OnInitialize) |
42 IPC_MESSAGE_HANDLER(GpuVideoDecoderMsg_Destroy, | 43 IPC_MESSAGE_HANDLER(GpuVideoDecoderMsg_Destroy, |
43 OnUninitialize) | 44 OnUninitialize) |
44 IPC_MESSAGE_HANDLER(GpuVideoDecoderMsg_Flush, | 45 IPC_MESSAGE_HANDLER(GpuVideoDecoderMsg_Flush, |
45 OnFlush) | 46 OnFlush) |
46 IPC_MESSAGE_HANDLER(GpuVideoDecoderMsg_Preroll, | 47 IPC_MESSAGE_HANDLER(GpuVideoDecoderMsg_Preroll, |
47 OnPreroll) | 48 OnPreroll) |
48 IPC_MESSAGE_HANDLER(GpuVideoDecoderMsg_EmptyThisBuffer, | 49 IPC_MESSAGE_HANDLER(GpuVideoDecoderMsg_EmptyThisBuffer, |
49 OnEmptyThisBuffer) | 50 OnEmptyThisBuffer) |
50 IPC_MESSAGE_HANDLER(GpuVideoDecoderMsg_ProduceVideoFrame, | 51 IPC_MESSAGE_HANDLER(GpuVideoDecoderMsg_ProduceVideoFrame, |
51 OnProduceVideoFrame) | 52 OnProduceVideoFrame) |
52 IPC_MESSAGE_HANDLER(GpuVideoDecoderMsg_VideoFrameAllocated, | 53 IPC_MESSAGE_HANDLER(GpuVideoDecoderMsg_VideoFrameAllocated, |
53 OnVideoFrameAllocated) | 54 OnVideoFrameAllocated) |
54 IPC_MESSAGE_UNHANDLED_ERROR() | 55 IPC_MESSAGE_UNHANDLED(handled = false) |
55 IPC_END_MESSAGE_MAP() | 56 IPC_END_MESSAGE_MAP() |
| 57 DCHECK(handled); |
| 58 return handled; |
56 } | 59 } |
57 | 60 |
58 bool GpuVideoDecoder::CreateInputTransferBuffer( | 61 bool GpuVideoDecoder::CreateInputTransferBuffer( |
59 uint32 size, | 62 uint32 size, |
60 base::SharedMemoryHandle* handle) { | 63 base::SharedMemoryHandle* handle) { |
61 input_transfer_buffer_.reset(new base::SharedMemory); | 64 input_transfer_buffer_.reset(new base::SharedMemory); |
62 if (!input_transfer_buffer_.get()) | 65 if (!input_transfer_buffer_.get()) |
63 return false; | 66 return false; |
64 | 67 |
65 if (!input_transfer_buffer_->CreateAndMapAnonymous(size)) | 68 if (!input_transfer_buffer_->CreateAndMapAnonymous(size)) |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 } | 408 } |
406 } | 409 } |
407 | 410 |
408 void GpuVideoDecoder::SendReleaseAllVideoFrames() { | 411 void GpuVideoDecoder::SendReleaseAllVideoFrames() { |
409 if (!sender_->Send( | 412 if (!sender_->Send( |
410 new GpuVideoDecoderHostMsg_ReleaseAllVideoFrames( | 413 new GpuVideoDecoderHostMsg_ReleaseAllVideoFrames( |
411 decoder_host_id()))) { | 414 decoder_host_id()))) { |
412 LOG(ERROR) << "GpuVideoDecoderMsg_ReleaseAllVideoFrames failed"; | 415 LOG(ERROR) << "GpuVideoDecoderMsg_ReleaseAllVideoFrames failed"; |
413 } | 416 } |
414 } | 417 } |
OLD | NEW |