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/renderer/pepper/ppb_video_decoder_impl.h" | 5 #include "content/renderer/pepper/ppb_video_decoder_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.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/renderer/pepper/host_globals.h" | 13 #include "content/renderer/pepper/host_globals.h" |
15 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 14 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
16 #include "content/renderer/pepper/plugin_module.h" | 15 #include "content/renderer/pepper/plugin_module.h" |
17 #include "content/renderer/pepper/ppb_buffer_impl.h" | 16 #include "content/renderer/pepper/ppb_buffer_impl.h" |
18 #include "content/renderer/pepper/ppb_graphics_3d_impl.h" | 17 #include "content/renderer/pepper/ppb_graphics_3d_impl.h" |
19 #include "content/renderer/render_thread_impl.h" | 18 #include "content/renderer/render_thread_impl.h" |
| 19 #include "gpu/ipc/client/command_buffer_proxy_impl.h" |
20 #include "media/video/picture.h" | 20 #include "media/video/picture.h" |
21 #include "media/video/video_decode_accelerator.h" | 21 #include "media/video/video_decode_accelerator.h" |
22 #include "ppapi/c/dev/pp_video_dev.h" | 22 #include "ppapi/c/dev/pp_video_dev.h" |
23 #include "ppapi/c/dev/ppb_video_decoder_dev.h" | 23 #include "ppapi/c/dev/ppb_video_decoder_dev.h" |
24 #include "ppapi/c/dev/ppp_video_decoder_dev.h" | 24 #include "ppapi/c/dev/ppp_video_decoder_dev.h" |
25 #include "ppapi/c/pp_completion_callback.h" | 25 #include "ppapi/c/pp_completion_callback.h" |
26 #include "ppapi/c/pp_errors.h" | 26 #include "ppapi/c/pp_errors.h" |
27 #include "ppapi/shared_impl/resource_tracker.h" | 27 #include "ppapi/shared_impl/resource_tracker.h" |
28 #include "ppapi/thunk/enter.h" | 28 #include "ppapi/thunk/enter.h" |
29 | 29 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 bool PPB_VideoDecoder_Impl::Init(PP_Resource graphics_context, | 113 bool PPB_VideoDecoder_Impl::Init(PP_Resource graphics_context, |
114 PP_VideoDecoder_Profile profile) { | 114 PP_VideoDecoder_Profile profile) { |
115 EnterResourceNoLock<PPB_Graphics3D_API> enter_context(graphics_context, true); | 115 EnterResourceNoLock<PPB_Graphics3D_API> enter_context(graphics_context, true); |
116 if (enter_context.failed()) | 116 if (enter_context.failed()) |
117 return false; | 117 return false; |
118 | 118 |
119 PPB_Graphics3D_Impl* graphics_3d = | 119 PPB_Graphics3D_Impl* graphics_3d = |
120 static_cast<PPB_Graphics3D_Impl*>(enter_context.object()); | 120 static_cast<PPB_Graphics3D_Impl*>(enter_context.object()); |
121 | 121 |
122 CommandBufferProxyImpl* command_buffer = graphics_3d->GetCommandBufferProxy(); | 122 gpu::CommandBufferProxyImpl* command_buffer = |
| 123 graphics_3d->GetCommandBufferProxy(); |
123 if (!command_buffer) | 124 if (!command_buffer) |
124 return false; | 125 return false; |
125 | 126 |
126 InitCommon(graphics_context, graphics_3d->gles2_impl()); | 127 InitCommon(graphics_context, graphics_3d->gles2_impl()); |
127 FlushCommandBuffer(); | 128 FlushCommandBuffer(); |
128 | 129 |
129 // This is not synchronous, but subsequent IPC messages will be buffered, so | 130 // This is not synchronous, but subsequent IPC messages will be buffered, so |
130 // it is okay to immediately send IPC messages. | 131 // it is okay to immediately send IPC messages. |
131 GpuChannelHost* channel = command_buffer->channel(); | 132 gpu::GpuChannelHost* channel = command_buffer->channel(); |
132 if (channel) { | 133 if (channel) { |
133 decoder_.reset(new GpuVideoDecodeAcceleratorHost(channel, command_buffer)); | 134 decoder_.reset(new GpuVideoDecodeAcceleratorHost(channel, command_buffer)); |
134 return decoder_->Initialize(PPToMediaProfile(profile), this); | 135 return decoder_->Initialize(PPToMediaProfile(profile), this); |
135 } | 136 } |
136 return false; | 137 return false; |
137 } | 138 } |
138 | 139 |
139 const PPP_VideoDecoder_Dev* PPB_VideoDecoder_Impl::GetPPP() { | 140 const PPP_VideoDecoder_Dev* PPB_VideoDecoder_Impl::GetPPP() { |
140 if (!ppp_videodecoder_) { | 141 if (!ppp_videodecoder_) { |
141 PluginModule* plugin_module = | 142 PluginModule* plugin_module = |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 DCHECK(RenderThreadImpl::current()); | 295 DCHECK(RenderThreadImpl::current()); |
295 RunBitstreamBufferCallback(bitstream_buffer_id, PP_OK); | 296 RunBitstreamBufferCallback(bitstream_buffer_id, PP_OK); |
296 } | 297 } |
297 | 298 |
298 void PPB_VideoDecoder_Impl::NotifyFlushDone() { | 299 void PPB_VideoDecoder_Impl::NotifyFlushDone() { |
299 DCHECK(RenderThreadImpl::current()); | 300 DCHECK(RenderThreadImpl::current()); |
300 RunFlushCallback(PP_OK); | 301 RunFlushCallback(PP_OK); |
301 } | 302 } |
302 | 303 |
303 } // namespace content | 304 } // namespace content |
OLD | NEW |