OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_jpeg_decode_accelerator_host.h" | 5 #include "content/common/gpu/client/gpu_jpeg_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/memory/shared_memory_handle.h" | 9 #include "base/memory/shared_memory_handle.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 return; | 168 return; |
169 } | 169 } |
170 | 170 |
171 size_t output_buffer_size = media::VideoFrame::AllocationSize( | 171 size_t output_buffer_size = media::VideoFrame::AllocationSize( |
172 video_frame->format(), video_frame->coded_size()); | 172 video_frame->format(), video_frame->coded_size()); |
173 | 173 |
174 AcceleratedJpegDecoderMsg_Decode_Params decode_params; | 174 AcceleratedJpegDecoderMsg_Decode_Params decode_params; |
175 decode_params.coded_size = video_frame->coded_size(); | 175 decode_params.coded_size = video_frame->coded_size(); |
176 decode_params.input_buffer_id = bitstream_buffer.id(); | 176 decode_params.input_buffer_id = bitstream_buffer.id(); |
177 decode_params.input_buffer_handle = input_handle; | 177 decode_params.input_buffer_handle = input_handle; |
178 decode_params.input_buffer_size = bitstream_buffer.size(); | 178 decode_params.input_buffer_size = |
| 179 base::checked_cast<uint32>(bitstream_buffer.size()); |
| 180 decode_params.input_buffer_offset = |
| 181 base::checked_cast<uint32>(bitstream_buffer.offset()); |
179 decode_params.output_video_frame_handle = output_handle; | 182 decode_params.output_video_frame_handle = output_handle; |
180 decode_params.output_buffer_size = output_buffer_size; | 183 decode_params.output_buffer_size = |
| 184 base::checked_cast<uint32>(output_buffer_size); |
181 Send(new AcceleratedJpegDecoderMsg_Decode(decoder_route_id_, decode_params)); | 185 Send(new AcceleratedJpegDecoderMsg_Decode(decoder_route_id_, decode_params)); |
182 } | 186 } |
183 | 187 |
184 bool GpuJpegDecodeAcceleratorHost::IsSupported() { | 188 bool GpuJpegDecodeAcceleratorHost::IsSupported() { |
185 return channel_->gpu_info().jpeg_decode_accelerator_supported; | 189 return channel_->gpu_info().jpeg_decode_accelerator_supported; |
186 } | 190 } |
187 | 191 |
188 void GpuJpegDecodeAcceleratorHost::Send(IPC::Message* message) { | 192 void GpuJpegDecodeAcceleratorHost::Send(IPC::Message* message) { |
189 DCHECK(CalledOnValidThread()); | 193 DCHECK(CalledOnValidThread()); |
190 | 194 |
191 if (!channel_->Send(message)) { | 195 if (!channel_->Send(message)) { |
192 DLOG(ERROR) << "Send(" << message->type() << ") failed"; | 196 DLOG(ERROR) << "Send(" << message->type() << ") failed"; |
193 } | 197 } |
194 } | 198 } |
195 | 199 |
196 base::WeakPtr<IPC::Listener> GpuJpegDecodeAcceleratorHost::GetReceiver() { | 200 base::WeakPtr<IPC::Listener> GpuJpegDecodeAcceleratorHost::GetReceiver() { |
197 return receiver_->AsWeakPtrForIO(); | 201 return receiver_->AsWeakPtrForIO(); |
198 } | 202 } |
199 | 203 |
200 } // namespace content | 204 } // namespace content |
OLD | NEW |