OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_platform_video_decoder_impl.h" | 5 #include "content/renderer/pepper_platform_video_decoder_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "content/common/child_process.h" | 11 #include "content/common/child_process.h" |
12 #include "content/renderer/gpu/gpu_channel_host.h" | 12 #include "content/renderer/gpu/gpu_channel_host.h" |
13 #include "content/renderer/gpu/gpu_video_decode_accelerator_host.h" | 13 #include "content/renderer/gpu/gpu_video_decode_accelerator_host.h" |
14 #include "content/renderer/gpu/gpu_video_service_host.h" | 14 #include "content/renderer/gpu/gpu_video_service_host.h" |
15 #include "content/renderer/render_thread.h" | 15 #include "content/renderer/render_thread.h" |
16 | 16 |
17 using media::BitstreamBuffer; | 17 using media::BitstreamBuffer; |
18 | 18 |
19 PlatformVideoDecoderImpl::PlatformVideoDecoderImpl( | 19 PlatformVideoDecoderImpl::PlatformVideoDecoderImpl( |
20 VideoDecodeAccelerator::Client* client, uint32 command_buffer_route_id) | 20 VideoDecodeAccelerator::Client* client, |
| 21 int32 command_buffer_route_id, |
| 22 gpu::CommandBufferHelper* cmd_buffer_helper) |
21 : client_(client), | 23 : client_(client), |
22 command_buffer_route_id_(command_buffer_route_id), | 24 command_buffer_route_id_(command_buffer_route_id), |
| 25 cmd_buffer_helper_(cmd_buffer_helper), |
23 decoder_(NULL), | 26 decoder_(NULL), |
24 message_loop_(NULL) { | 27 message_loop_(NULL) { |
25 DCHECK(client); | 28 DCHECK(client); |
26 } | 29 } |
27 | 30 |
28 PlatformVideoDecoderImpl::~PlatformVideoDecoderImpl() {} | 31 PlatformVideoDecoderImpl::~PlatformVideoDecoderImpl() {} |
29 | 32 |
30 bool PlatformVideoDecoderImpl::GetConfigs( | 33 bool PlatformVideoDecoderImpl::GetConfigs( |
31 const std::vector<uint32>& requested_configs, | 34 const std::vector<uint32>& requested_configs, |
32 std::vector<uint32>* matched_configs) { | 35 std::vector<uint32>* matched_configs) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 if (ChildProcess::current()->io_message_loop() != MessageLoop::current() ) { | 74 if (ChildProcess::current()->io_message_loop() != MessageLoop::current() ) { |
72 ChildProcess::current()->io_message_loop()-> | 75 ChildProcess::current()->io_message_loop()-> |
73 PostTask(FROM_HERE, base::Bind( | 76 PostTask(FROM_HERE, base::Bind( |
74 &PlatformVideoDecoderImpl::InitializeDecoder, | 77 &PlatformVideoDecoderImpl::InitializeDecoder, |
75 base::Unretained(this), | 78 base::Unretained(this), |
76 configs)); | 79 configs)); |
77 return; | 80 return; |
78 } | 81 } |
79 GpuVideoServiceHost* video_service = channel_->gpu_video_service_host(); | 82 GpuVideoServiceHost* video_service = channel_->gpu_video_service_host(); |
80 decoder_.reset(video_service->CreateVideoAccelerator( | 83 decoder_.reset(video_service->CreateVideoAccelerator( |
81 this, command_buffer_route_id_)); | 84 this, command_buffer_route_id_, cmd_buffer_helper_)); |
82 | 85 |
83 // Send IPC message to initialize decoder in GPU process. | 86 // Send IPC message to initialize decoder in GPU process. |
84 decoder_->Initialize(configs); | 87 decoder_->Initialize(configs); |
85 } | 88 } |
86 | 89 |
87 bool PlatformVideoDecoderImpl::Decode(const BitstreamBuffer& bitstream_buffer) { | 90 void PlatformVideoDecoderImpl::Decode(const BitstreamBuffer& bitstream_buffer) { |
88 DCHECK(decoder_.get()); | 91 DCHECK(decoder_.get()); |
89 return decoder_->Decode(bitstream_buffer); | 92 decoder_->Decode(bitstream_buffer); |
90 } | 93 } |
91 | 94 |
92 void PlatformVideoDecoderImpl::AssignGLESBuffers( | 95 void PlatformVideoDecoderImpl::AssignGLESBuffers( |
93 const std::vector<media::GLESBuffer>& buffers) { | 96 const std::vector<media::GLESBuffer>& buffers) { |
94 DCHECK(decoder_.get()); | 97 DCHECK(decoder_.get()); |
95 decoder_->AssignGLESBuffers(buffers); | 98 decoder_->AssignGLESBuffers(buffers); |
96 } | 99 } |
97 | 100 |
98 void PlatformVideoDecoderImpl::AssignSysmemBuffers( | 101 void PlatformVideoDecoderImpl::AssignSysmemBuffers( |
99 const std::vector<media::SysmemBuffer>& buffers) { | 102 const std::vector<media::SysmemBuffer>& buffers) { |
100 DCHECK(decoder_.get()); | 103 DCHECK(decoder_.get()); |
101 decoder_->AssignSysmemBuffers(buffers); | 104 decoder_->AssignSysmemBuffers(buffers); |
102 } | 105 } |
103 | 106 |
104 void PlatformVideoDecoderImpl::ReusePictureBuffer( | 107 void PlatformVideoDecoderImpl::ReusePictureBuffer( |
105 int32 picture_buffer_id) { | 108 int32 picture_buffer_id) { |
106 DCHECK(decoder_.get()); | 109 DCHECK(decoder_.get()); |
107 decoder_->ReusePictureBuffer(picture_buffer_id); | 110 decoder_->ReusePictureBuffer(picture_buffer_id); |
108 } | 111 } |
109 | 112 |
110 bool PlatformVideoDecoderImpl::Flush() { | 113 void PlatformVideoDecoderImpl::Flush() { |
111 DCHECK(decoder_.get()); | 114 DCHECK(decoder_.get()); |
112 return decoder_->Flush(); | 115 decoder_->Flush(); |
113 } | 116 } |
114 | 117 |
115 bool PlatformVideoDecoderImpl::Abort() { | 118 void PlatformVideoDecoderImpl::Abort() { |
116 DCHECK(decoder_.get()); | 119 DCHECK(decoder_.get()); |
117 return decoder_->Abort(); | 120 decoder_->Abort(); |
118 } | 121 } |
119 | 122 |
120 void PlatformVideoDecoderImpl::NotifyEndOfStream() { | 123 void PlatformVideoDecoderImpl::NotifyEndOfStream() { |
121 DCHECK(message_loop_); | 124 DCHECK(message_loop_); |
122 message_loop_-> | 125 message_loop_-> |
123 PostTask(FROM_HERE, base::Bind( | 126 PostTask(FROM_HERE, base::Bind( |
124 &VideoDecodeAccelerator::Client::NotifyEndOfStream, | 127 &VideoDecodeAccelerator::Client::NotifyEndOfStream, |
125 base::Unretained(client_))); | 128 base::Unretained(client_))); |
126 } | 129 } |
127 | 130 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 base::Unretained(client_))); | 196 base::Unretained(client_))); |
194 } | 197 } |
195 | 198 |
196 void PlatformVideoDecoderImpl::NotifyAbortDone() { | 199 void PlatformVideoDecoderImpl::NotifyAbortDone() { |
197 DCHECK(message_loop_); | 200 DCHECK(message_loop_); |
198 message_loop_-> | 201 message_loop_-> |
199 PostTask(FROM_HERE, base::Bind( | 202 PostTask(FROM_HERE, base::Bind( |
200 &VideoDecodeAccelerator::Client::NotifyAbortDone, | 203 &VideoDecodeAccelerator::Client::NotifyAbortDone, |
201 base::Unretained(client_))); | 204 base::Unretained(client_))); |
202 } | 205 } |
OLD | NEW |