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/media/vaapi_jpeg_decode_accelerator.h" | 5 #include "content/common/gpu/media/vaapi_jpeg_decode_accelerator.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <string.h> | 8 #include <string.h> |
| 9 #include <utility> |
9 | 10 |
10 #include "base/bind.h" | 11 #include "base/bind.h" |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
13 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
14 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
15 #include "content/common/gpu/gpu_channel.h" | 16 #include "content/common/gpu/gpu_channel.h" |
16 #include "content/common/gpu/media/vaapi_picture.h" | 17 #include "content/common/gpu/media/vaapi_picture.h" |
17 #include "media/base/video_frame.h" | 18 #include "media/base/video_frame.h" |
18 #include "media/filters/jpeg_parser.h" | 19 #include "media/filters/jpeg_parser.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 return 0; | 73 return 0; |
73 } | 74 } |
74 | 75 |
75 } // namespace | 76 } // namespace |
76 | 77 |
77 VaapiJpegDecodeAccelerator::DecodeRequest::DecodeRequest( | 78 VaapiJpegDecodeAccelerator::DecodeRequest::DecodeRequest( |
78 const media::BitstreamBuffer& bitstream_buffer, | 79 const media::BitstreamBuffer& bitstream_buffer, |
79 scoped_ptr<base::SharedMemory> shm, | 80 scoped_ptr<base::SharedMemory> shm, |
80 const scoped_refptr<media::VideoFrame>& video_frame) | 81 const scoped_refptr<media::VideoFrame>& video_frame) |
81 : bitstream_buffer(bitstream_buffer), | 82 : bitstream_buffer(bitstream_buffer), |
82 shm(shm.Pass()), | 83 shm(std::move(shm)), |
83 video_frame(video_frame) { | 84 video_frame(video_frame) {} |
84 } | |
85 | 85 |
86 VaapiJpegDecodeAccelerator::DecodeRequest::~DecodeRequest() { | 86 VaapiJpegDecodeAccelerator::DecodeRequest::~DecodeRequest() { |
87 } | 87 } |
88 | 88 |
89 void VaapiJpegDecodeAccelerator::NotifyError(int32_t bitstream_buffer_id, | 89 void VaapiJpegDecodeAccelerator::NotifyError(int32_t bitstream_buffer_id, |
90 Error error) { | 90 Error error) { |
91 DCHECK(task_runner_->BelongsToCurrentThread()); | 91 DCHECK(task_runner_->BelongsToCurrentThread()); |
92 DLOG(ERROR) << "Notifying of error " << error; | 92 DLOG(ERROR) << "Notifying of error " << error; |
93 DCHECK(client_); | 93 DCHECK(client_); |
94 client_->NotifyError(bitstream_buffer_id, error); | 94 client_->NotifyError(bitstream_buffer_id, error); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 scoped_ptr<base::SharedMemory> shm( | 292 scoped_ptr<base::SharedMemory> shm( |
293 new base::SharedMemory(bitstream_buffer.handle(), true)); | 293 new base::SharedMemory(bitstream_buffer.handle(), true)); |
294 | 294 |
295 if (!shm->Map(bitstream_buffer.size())) { | 295 if (!shm->Map(bitstream_buffer.size())) { |
296 LOG(ERROR) << "Failed to map input buffer"; | 296 LOG(ERROR) << "Failed to map input buffer"; |
297 NotifyErrorFromDecoderThread(bitstream_buffer.id(), UNREADABLE_INPUT); | 297 NotifyErrorFromDecoderThread(bitstream_buffer.id(), UNREADABLE_INPUT); |
298 return; | 298 return; |
299 } | 299 } |
300 | 300 |
301 scoped_ptr<DecodeRequest> request( | 301 scoped_ptr<DecodeRequest> request( |
302 new DecodeRequest(bitstream_buffer, shm.Pass(), video_frame)); | 302 new DecodeRequest(bitstream_buffer, std::move(shm), video_frame)); |
303 | 303 |
304 decoder_task_runner_->PostTask( | 304 decoder_task_runner_->PostTask( |
305 FROM_HERE, base::Bind(&VaapiJpegDecodeAccelerator::DecodeTask, | 305 FROM_HERE, base::Bind(&VaapiJpegDecodeAccelerator::DecodeTask, |
306 base::Unretained(this), base::Passed(&request))); | 306 base::Unretained(this), base::Passed(&request))); |
307 } | 307 } |
308 | 308 |
309 bool VaapiJpegDecodeAccelerator::IsSupported() { | 309 bool VaapiJpegDecodeAccelerator::IsSupported() { |
310 return VaapiWrapper::IsJpegDecodeSupported(); | 310 return VaapiWrapper::IsJpegDecodeSupported(); |
311 } | 311 } |
312 | 312 |
313 } // namespace content | 313 } // namespace content |
OLD | NEW |