| 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 "content/common/gpu/client/gpu_video_decode_accelerator_host.h" | 5 #include "content/common/gpu/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.h" | 9 #include "base/message_loop.h" |
| 10 #include "content/common/gpu/client/gpu_channel_host.h" | 10 #include "content/common/gpu/client/gpu_channel_host.h" |
| 11 #include "content/common/gpu/gpu_messages.h" | 11 #include "content/common/gpu/gpu_messages.h" |
| 12 #include "content/common/view_messages.h" | 12 #include "content/common/view_messages.h" |
| 13 #include "ipc/ipc_message_macros.h" | 13 #include "ipc/ipc_message_macros.h" |
| 14 #include "ipc/ipc_message_utils.h" | 14 #include "ipc/ipc_message_utils.h" |
| 15 | 15 |
| 16 #if defined(OS_WIN) | 16 #if defined(OS_WIN) |
| 17 #include "content/public/common/sandbox_init.h" | 17 #include "content/public/common/sandbox_init.h" |
| 18 #endif // OS_WIN | 18 #endif // OS_WIN |
| 19 | 19 |
| 20 using media::VideoDecodeAccelerator; | 20 using media::VideoDecodeAccelerator; |
| 21 namespace content { |
| 21 | 22 |
| 22 GpuVideoDecodeAcceleratorHost::GpuVideoDecodeAcceleratorHost( | 23 GpuVideoDecodeAcceleratorHost::GpuVideoDecodeAcceleratorHost( |
| 23 GpuChannelHost* channel, | 24 GpuChannelHost* channel, |
| 24 int32 decoder_route_id, | 25 int32 decoder_route_id, |
| 25 VideoDecodeAccelerator::Client* client) | 26 VideoDecodeAccelerator::Client* client) |
| 26 : channel_(channel), | 27 : channel_(channel), |
| 27 decoder_route_id_(decoder_route_id), | 28 decoder_route_id_(decoder_route_id), |
| 28 client_(client) { | 29 client_(client) { |
| 29 DCHECK(channel_); | 30 DCHECK(channel_); |
| 30 DCHECK(client_); | 31 DCHECK(client_); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 media::VideoCodecProfile profile) { | 63 media::VideoCodecProfile profile) { |
| 63 NOTREACHED(); | 64 NOTREACHED(); |
| 64 return true; | 65 return true; |
| 65 } | 66 } |
| 66 | 67 |
| 67 void GpuVideoDecodeAcceleratorHost::Decode( | 68 void GpuVideoDecodeAcceleratorHost::Decode( |
| 68 const media::BitstreamBuffer& bitstream_buffer) { | 69 const media::BitstreamBuffer& bitstream_buffer) { |
| 69 DCHECK(CalledOnValidThread()); | 70 DCHECK(CalledOnValidThread()); |
| 70 base::SharedMemoryHandle buffer_handle = bitstream_buffer.handle(); | 71 base::SharedMemoryHandle buffer_handle = bitstream_buffer.handle(); |
| 71 #if defined(OS_WIN) | 72 #if defined(OS_WIN) |
| 72 if (!content::BrokerDuplicateHandle(bitstream_buffer.handle(), | 73 if (!BrokerDuplicateHandle(bitstream_buffer.handle(), |
| 73 channel_->gpu_pid(), | 74 channel_->gpu_pid(), |
| 74 &buffer_handle, 0, | 75 &buffer_handle, 0, |
| 75 DUPLICATE_SAME_ACCESS)) { | 76 DUPLICATE_SAME_ACCESS)) { |
| 76 NOTREACHED() << "Failed to duplicate buffer handler"; | 77 NOTREACHED() << "Failed to duplicate buffer handler"; |
| 77 return; | 78 return; |
| 78 } | 79 } |
| 79 #endif // OS_WIN | 80 #endif // OS_WIN |
| 80 | 81 |
| 81 Send(new AcceleratedVideoDecoderMsg_Decode( | 82 Send(new AcceleratedVideoDecoderMsg_Decode( |
| 82 decoder_route_id_, buffer_handle, bitstream_buffer.id(), | 83 decoder_route_id_, buffer_handle, bitstream_buffer.id(), |
| 83 bitstream_buffer.size())); | 84 bitstream_buffer.size())); |
| 84 } | 85 } |
| 85 | 86 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 } | 197 } |
| 197 | 198 |
| 198 void GpuVideoDecodeAcceleratorHost::OnErrorNotification(uint32 error) { | 199 void GpuVideoDecodeAcceleratorHost::OnErrorNotification(uint32 error) { |
| 199 DCHECK(CalledOnValidThread()); | 200 DCHECK(CalledOnValidThread()); |
| 200 if (!client_) | 201 if (!client_) |
| 201 return; | 202 return; |
| 202 client_->NotifyError( | 203 client_->NotifyError( |
| 203 static_cast<media::VideoDecodeAccelerator::Error>(error)); | 204 static_cast<media::VideoDecodeAccelerator::Error>(error)); |
| 204 client_ = NULL; | 205 client_ = NULL; |
| 205 } | 206 } |
| 207 |
| 208 } // namespace content |
| OLD | NEW |