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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 return; | 172 return; |
173 } | 173 } |
174 | 174 |
175 size_t output_buffer_size = media::VideoFrame::AllocationSize( | 175 size_t output_buffer_size = media::VideoFrame::AllocationSize( |
176 video_frame->format(), video_frame->coded_size()); | 176 video_frame->format(), video_frame->coded_size()); |
177 | 177 |
178 AcceleratedJpegDecoderMsg_Decode_Params decode_params; | 178 AcceleratedJpegDecoderMsg_Decode_Params decode_params; |
179 decode_params.coded_size = video_frame->coded_size(); | 179 decode_params.coded_size = video_frame->coded_size(); |
180 decode_params.input_buffer_id = bitstream_buffer.id(); | 180 decode_params.input_buffer_id = bitstream_buffer.id(); |
181 decode_params.input_buffer_handle = input_handle; | 181 decode_params.input_buffer_handle = input_handle; |
182 decode_params.input_buffer_size = bitstream_buffer.size(); | 182 decode_params.input_buffer_size = |
| 183 base::checked_cast<uint32_t>(bitstream_buffer.size()); |
| 184 decode_params.input_buffer_offset = |
| 185 base::checked_cast<uint32_t>(bitstream_buffer.offset()); |
183 decode_params.output_video_frame_handle = output_handle; | 186 decode_params.output_video_frame_handle = output_handle; |
184 decode_params.output_buffer_size = output_buffer_size; | 187 decode_params.output_buffer_size = |
| 188 base::checked_cast<uint32_t>(output_buffer_size); |
185 Send(new AcceleratedJpegDecoderMsg_Decode(decoder_route_id_, decode_params)); | 189 Send(new AcceleratedJpegDecoderMsg_Decode(decoder_route_id_, decode_params)); |
186 } | 190 } |
187 | 191 |
188 bool GpuJpegDecodeAcceleratorHost::IsSupported() { | 192 bool GpuJpegDecodeAcceleratorHost::IsSupported() { |
189 return channel_->gpu_info().jpeg_decode_accelerator_supported; | 193 return channel_->gpu_info().jpeg_decode_accelerator_supported; |
190 } | 194 } |
191 | 195 |
192 void GpuJpegDecodeAcceleratorHost::Send(IPC::Message* message) { | 196 void GpuJpegDecodeAcceleratorHost::Send(IPC::Message* message) { |
193 DCHECK(CalledOnValidThread()); | 197 DCHECK(CalledOnValidThread()); |
194 | 198 |
195 if (!channel_->Send(message)) { | 199 if (!channel_->Send(message)) { |
196 DLOG(ERROR) << "Send(" << message->type() << ") failed"; | 200 DLOG(ERROR) << "Send(" << message->type() << ") failed"; |
197 } | 201 } |
198 } | 202 } |
199 | 203 |
200 base::WeakPtr<IPC::Listener> GpuJpegDecodeAcceleratorHost::GetReceiver() { | 204 base::WeakPtr<IPC::Listener> GpuJpegDecodeAcceleratorHost::GetReceiver() { |
201 return receiver_->AsWeakPtrForIO(); | 205 return receiver_->AsWeakPtrForIO(); |
202 } | 206 } |
203 | 207 |
204 } // namespace content | 208 } // namespace content |
OLD | NEW |