| 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/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 if (!succeeded) { | 93 if (!succeeded) { |
| 94 DLOG(ERROR) << "Send(GpuCommandBufferMsg_CreateVideoDecoder()) failed"; | 94 DLOG(ERROR) << "Send(GpuCommandBufferMsg_CreateVideoDecoder()) failed"; |
| 95 PostNotifyError(PLATFORM_FAILURE); | 95 PostNotifyError(PLATFORM_FAILURE); |
| 96 channel_->RemoveRoute(route_id); | 96 channel_->RemoveRoute(route_id); |
| 97 return false; | 97 return false; |
| 98 } | 98 } |
| 99 decoder_route_id_ = route_id; | 99 decoder_route_id_ = route_id; |
| 100 return true; | 100 return true; |
| 101 } | 101 } |
| 102 | 102 |
| 103 void GpuVideoDecodeAcceleratorHost::SetCdm(int cdm_id) { | |
| 104 DCHECK(CalledOnValidThread()); | |
| 105 if (!channel_) | |
| 106 return; | |
| 107 Send(new AcceleratedVideoDecoderMsg_SetCdm(decoder_route_id_, cdm_id)); | |
| 108 } | |
| 109 | |
| 110 void GpuVideoDecodeAcceleratorHost::Decode( | 103 void GpuVideoDecodeAcceleratorHost::Decode( |
| 111 const BitstreamBuffer& bitstream_buffer) { | 104 const BitstreamBuffer& bitstream_buffer) { |
| 112 DCHECK(CalledOnValidThread()); | 105 DCHECK(CalledOnValidThread()); |
| 113 if (!channel_) | 106 if (!channel_) |
| 114 return; | 107 return; |
| 115 BitstreamBuffer buffer_to_send = bitstream_buffer; | 108 BitstreamBuffer buffer_to_send = bitstream_buffer; |
| 116 base::SharedMemoryHandle handle = | 109 base::SharedMemoryHandle handle = |
| 117 channel_->ShareToGpuProcess(bitstream_buffer.handle()); | 110 channel_->ShareToGpuProcess(bitstream_buffer.handle()); |
| 118 if (!base::SharedMemory::IsHandleValid(handle)) { | 111 if (!base::SharedMemory::IsHandleValid(handle)) { |
| 119 NOTREACHED() << "Failed to duplicate buffer handler"; | 112 NOTREACHED() << "Failed to duplicate buffer handler"; |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 weak_this_factory_.InvalidateWeakPtrs(); | 271 weak_this_factory_.InvalidateWeakPtrs(); |
| 279 | 272 |
| 280 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the | 273 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the |
| 281 // last thing done on this stack! | 274 // last thing done on this stack! |
| 282 VideoDecodeAccelerator::Client* client = NULL; | 275 VideoDecodeAccelerator::Client* client = NULL; |
| 283 std::swap(client, client_); | 276 std::swap(client, client_); |
| 284 client->NotifyError(static_cast<VideoDecodeAccelerator::Error>(error)); | 277 client->NotifyError(static_cast<VideoDecodeAccelerator::Error>(error)); |
| 285 } | 278 } |
| 286 | 279 |
| 287 } // namespace media | 280 } // namespace media |
| OLD | NEW |