| 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 <errno.h> | 5 #include <errno.h> |
| 6 #include <linux/videodev2.h> | 6 #include <linux/videodev2.h> |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 #include <sys/mman.h> | 8 #include <sys/mman.h> |
| 9 | 9 |
| 10 #include "base/big_endian.h" | 10 #include "base/big_endian.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 return true; | 226 return true; |
| 227 } | 227 } |
| 228 | 228 |
| 229 void V4L2JpegDecodeAccelerator::Decode( | 229 void V4L2JpegDecodeAccelerator::Decode( |
| 230 const media::BitstreamBuffer& bitstream_buffer, | 230 const media::BitstreamBuffer& bitstream_buffer, |
| 231 const scoped_refptr<media::VideoFrame>& video_frame) { | 231 const scoped_refptr<media::VideoFrame>& video_frame) { |
| 232 DVLOG(1) << "Decode(): input_id=" << bitstream_buffer.id() | 232 DVLOG(1) << "Decode(): input_id=" << bitstream_buffer.id() |
| 233 << ", size=" << bitstream_buffer.size(); | 233 << ", size=" << bitstream_buffer.size(); |
| 234 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 234 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
| 235 | 235 |
| 236 if (bitstream_buffer.id() < 0) { |
| 237 LOG(ERROR) << "Invalid bitstream_buffer, id: " << bitstream_buffer.id(); |
| 238 if (base::SharedMemory::IsHandleValid(bitstream_buffer.handle())) |
| 239 base::SharedMemory::CloseHandle(bitstream_buffer.handle()); |
| 240 PostNotifyError(bitstream_buffer.id(), INVALID_ARGUMENT); |
| 241 return; |
| 242 } |
| 243 |
| 236 if (video_frame->format() != media::PIXEL_FORMAT_I420) { | 244 if (video_frame->format() != media::PIXEL_FORMAT_I420) { |
| 237 PostNotifyError(bitstream_buffer.id(), UNSUPPORTED_JPEG); | 245 PostNotifyError(bitstream_buffer.id(), UNSUPPORTED_JPEG); |
| 238 return; | 246 return; |
| 239 } | 247 } |
| 240 | 248 |
| 241 scoped_ptr<JobRecord> job_record( | 249 scoped_ptr<JobRecord> job_record( |
| 242 new JobRecord(bitstream_buffer, video_frame)); | 250 new JobRecord(bitstream_buffer, video_frame)); |
| 243 | 251 |
| 244 decoder_task_runner_->PostTask( | 252 decoder_task_runner_->PostTask( |
| 245 FROM_HERE, base::Bind(&V4L2JpegDecodeAccelerator::DecodeTask, | 253 FROM_HERE, base::Bind(&V4L2JpegDecodeAccelerator::DecodeTask, |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 device_poll_thread_.Stop(); | 892 device_poll_thread_.Stop(); |
| 885 | 893 |
| 886 // Clear the interrupt now, to be sure. | 894 // Clear the interrupt now, to be sure. |
| 887 if (!device_->ClearDevicePollInterrupt()) | 895 if (!device_->ClearDevicePollInterrupt()) |
| 888 return false; | 896 return false; |
| 889 | 897 |
| 890 return true; | 898 return true; |
| 891 } | 899 } |
| 892 | 900 |
| 893 } // namespace content | 901 } // namespace content |
| OLD | NEW |