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 <fcntl.h> | 6 #include <fcntl.h> |
7 #include <linux/videodev2.h> | 7 #include <linux/videodev2.h> |
8 #include <poll.h> | 8 #include <poll.h> |
9 #include <string.h> | 9 #include <string.h> |
10 #include <sys/eventfd.h> | 10 #include <sys/eventfd.h> |
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 DVLOGF(3) << "Device poll stopped"; | 1177 DVLOGF(3) << "Device poll stopped"; |
1178 return true; | 1178 return true; |
1179 } | 1179 } |
1180 | 1180 |
1181 void V4L2SliceVideoDecodeAccelerator::Decode( | 1181 void V4L2SliceVideoDecodeAccelerator::Decode( |
1182 const media::BitstreamBuffer& bitstream_buffer) { | 1182 const media::BitstreamBuffer& bitstream_buffer) { |
1183 DVLOGF(3) << "input_id=" << bitstream_buffer.id() | 1183 DVLOGF(3) << "input_id=" << bitstream_buffer.id() |
1184 << ", size=" << bitstream_buffer.size(); | 1184 << ", size=" << bitstream_buffer.size(); |
1185 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 1185 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
1186 | 1186 |
| 1187 if (bitstream_buffer.id() < 0) { |
| 1188 LOG(ERROR) << "Invalid bitstream_buffer, id: " << bitstream_buffer.id(); |
| 1189 if (base::SharedMemory::IsHandleValid(bitstream_buffer.handle())) |
| 1190 base::SharedMemory::CloseHandle(bitstream_buffer.handle()); |
| 1191 NOTIFY_ERROR(INVALID_ARGUMENT); |
| 1192 return; |
| 1193 } |
| 1194 |
1187 decoder_thread_task_runner_->PostTask( | 1195 decoder_thread_task_runner_->PostTask( |
1188 FROM_HERE, base::Bind(&V4L2SliceVideoDecodeAccelerator::DecodeTask, | 1196 FROM_HERE, base::Bind(&V4L2SliceVideoDecodeAccelerator::DecodeTask, |
1189 base::Unretained(this), bitstream_buffer)); | 1197 base::Unretained(this), bitstream_buffer)); |
1190 } | 1198 } |
1191 | 1199 |
1192 void V4L2SliceVideoDecodeAccelerator::DecodeTask( | 1200 void V4L2SliceVideoDecodeAccelerator::DecodeTask( |
1193 const media::BitstreamBuffer& bitstream_buffer) { | 1201 const media::BitstreamBuffer& bitstream_buffer) { |
1194 DVLOGF(3) << "input_id=" << bitstream_buffer.id() | 1202 DVLOGF(3) << "input_id=" << bitstream_buffer.id() |
1195 << " size=" << bitstream_buffer.size(); | 1203 << " size=" << bitstream_buffer.size(); |
1196 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); | 1204 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); |
(...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2553 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { | 2561 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { |
2554 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); | 2562 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); |
2555 if (!device) | 2563 if (!device) |
2556 return SupportedProfiles(); | 2564 return SupportedProfiles(); |
2557 | 2565 |
2558 return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_), | 2566 return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_), |
2559 supported_input_fourccs_); | 2567 supported_input_fourccs_); |
2560 } | 2568 } |
2561 | 2569 |
2562 } // namespace content | 2570 } // namespace content |
OLD | NEW |