OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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/pepper/pepper_video_decoder_host.h" | 5 #include "content/renderer/pepper/pepper_video_decoder_host.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "content/common/gpu/client/command_buffer_proxy_impl.h" | |
13 #include "content/common/gpu/client/gpu_video_decode_accelerator_host.h" | 12 #include "content/common/gpu/client/gpu_video_decode_accelerator_host.h" |
14 #include "content/common/pepper_file_util.h" | 13 #include "content/common/pepper_file_util.h" |
15 #include "content/public/common/content_client.h" | 14 #include "content/public/common/content_client.h" |
16 #include "content/public/renderer/content_renderer_client.h" | 15 #include "content/public/renderer/content_renderer_client.h" |
17 #include "content/public/renderer/render_thread.h" | 16 #include "content/public/renderer/render_thread.h" |
18 #include "content/public/renderer/renderer_ppapi_host.h" | 17 #include "content/public/renderer/renderer_ppapi_host.h" |
19 #include "content/renderer/pepper/gfx_conversion.h" | 18 #include "content/renderer/pepper/gfx_conversion.h" |
20 #include "content/renderer/pepper/ppb_graphics_3d_impl.h" | 19 #include "content/renderer/pepper/ppb_graphics_3d_impl.h" |
21 #include "content/renderer/pepper/video_decoder_shim.h" | 20 #include "content/renderer/pepper/video_decoder_shim.h" |
| 21 #include "gpu/ipc/client/command_buffer_proxy_impl.h" |
22 #include "media/base/limits.h" | 22 #include "media/base/limits.h" |
23 #include "media/video/video_decode_accelerator.h" | 23 #include "media/video/video_decode_accelerator.h" |
24 #include "ppapi/c/pp_completion_callback.h" | 24 #include "ppapi/c/pp_completion_callback.h" |
25 #include "ppapi/c/pp_errors.h" | 25 #include "ppapi/c/pp_errors.h" |
26 #include "ppapi/host/dispatch_host_message.h" | 26 #include "ppapi/host/dispatch_host_message.h" |
27 #include "ppapi/host/ppapi_host.h" | 27 #include "ppapi/host/ppapi_host.h" |
28 #include "ppapi/proxy/ppapi_messages.h" | 28 #include "ppapi/proxy/ppapi_messages.h" |
29 #include "ppapi/proxy/video_decoder_constants.h" | 29 #include "ppapi/proxy/video_decoder_constants.h" |
30 #include "ppapi/thunk/enter.h" | 30 #include "ppapi/thunk/enter.h" |
31 #include "ppapi/thunk/ppb_graphics_3d_api.h" | 31 #include "ppapi/thunk/ppb_graphics_3d_api.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 if (min_picture_count > ppapi::proxy::kMaximumPictureCount) | 127 if (min_picture_count > ppapi::proxy::kMaximumPictureCount) |
128 return PP_ERROR_BADARGUMENT; | 128 return PP_ERROR_BADARGUMENT; |
129 | 129 |
130 EnterResourceNoLock<PPB_Graphics3D_API> enter_graphics( | 130 EnterResourceNoLock<PPB_Graphics3D_API> enter_graphics( |
131 graphics_context.host_resource(), true); | 131 graphics_context.host_resource(), true); |
132 if (enter_graphics.failed()) | 132 if (enter_graphics.failed()) |
133 return PP_ERROR_FAILED; | 133 return PP_ERROR_FAILED; |
134 PPB_Graphics3D_Impl* graphics3d = | 134 PPB_Graphics3D_Impl* graphics3d = |
135 static_cast<PPB_Graphics3D_Impl*>(enter_graphics.object()); | 135 static_cast<PPB_Graphics3D_Impl*>(enter_graphics.object()); |
136 | 136 |
137 CommandBufferProxyImpl* command_buffer = graphics3d->GetCommandBufferProxy(); | 137 gpu::CommandBufferProxyImpl* command_buffer = |
| 138 graphics3d->GetCommandBufferProxy(); |
138 if (!command_buffer) | 139 if (!command_buffer) |
139 return PP_ERROR_FAILED; | 140 return PP_ERROR_FAILED; |
140 | 141 |
141 profile_ = PepperToMediaVideoProfile(profile); | 142 profile_ = PepperToMediaVideoProfile(profile); |
142 software_fallback_allowed_ = (acceleration != PP_HARDWAREACCELERATION_ONLY); | 143 software_fallback_allowed_ = (acceleration != PP_HARDWAREACCELERATION_ONLY); |
143 | 144 |
144 min_picture_count_ = min_picture_count; | 145 min_picture_count_ = min_picture_count; |
145 | 146 |
146 if (acceleration != PP_HARDWAREACCELERATION_NONE) { | 147 if (acceleration != PP_HARDWAREACCELERATION_NONE) { |
147 // This is not synchronous, but subsequent IPC messages will be buffered, so | 148 // This is not synchronous, but subsequent IPC messages will be buffered, so |
148 // it is okay to immediately send IPC messages. | 149 // it is okay to immediately send IPC messages. |
149 GpuChannelHost* channel = command_buffer->channel(); | 150 gpu::GpuChannelHost* channel = command_buffer->channel(); |
150 if (channel) { | 151 if (channel) { |
151 decoder_.reset( | 152 decoder_.reset( |
152 new GpuVideoDecodeAcceleratorHost(channel, command_buffer)); | 153 new GpuVideoDecodeAcceleratorHost(channel, command_buffer)); |
153 if (decoder_->Initialize(profile_, this)) { | 154 if (decoder_->Initialize(profile_, this)) { |
154 initialized_ = true; | 155 initialized_ = true; |
155 return PP_OK; | 156 return PP_OK; |
156 } | 157 } |
157 } | 158 } |
158 decoder_.reset(); | 159 decoder_.reset(); |
159 if (acceleration == PP_HARDWAREACCELERATION_ONLY) | 160 if (acceleration == PP_HARDWAREACCELERATION_ONLY) |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 | 530 |
530 PepperVideoDecoderHost::PendingDecodeList::iterator | 531 PepperVideoDecoderHost::PendingDecodeList::iterator |
531 PepperVideoDecoderHost::GetPendingDecodeById(int32_t decode_id) { | 532 PepperVideoDecoderHost::GetPendingDecodeById(int32_t decode_id) { |
532 return std::find_if(pending_decodes_.begin(), pending_decodes_.end(), | 533 return std::find_if(pending_decodes_.begin(), pending_decodes_.end(), |
533 [decode_id](const PendingDecode& item) { | 534 [decode_id](const PendingDecode& item) { |
534 return item.decode_id == decode_id; | 535 return item.decode_id == decode_id; |
535 }); | 536 }); |
536 } | 537 } |
537 | 538 |
538 } // namespace content | 539 } // namespace content |
OLD | NEW |