OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <dlfcn.h> | 5 #include <dlfcn.h> |
6 #include <errno.h> | 6 #include <errno.h> |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <linux/videodev2.h> | 8 #include <linux/videodev2.h> |
9 #include <poll.h> | 9 #include <poll.h> |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 298 |
299 return true; | 299 return true; |
300 } | 300 } |
301 | 301 |
302 void V4L2VideoDecodeAccelerator::Decode( | 302 void V4L2VideoDecodeAccelerator::Decode( |
303 const media::BitstreamBuffer& bitstream_buffer) { | 303 const media::BitstreamBuffer& bitstream_buffer) { |
304 DVLOG(1) << "Decode(): input_id=" << bitstream_buffer.id() | 304 DVLOG(1) << "Decode(): input_id=" << bitstream_buffer.id() |
305 << ", size=" << bitstream_buffer.size(); | 305 << ", size=" << bitstream_buffer.size(); |
306 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 306 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
307 | 307 |
| 308 if (bitstream_buffer.id() < 0) { |
| 309 LOG(ERROR) << "Invalid bitstream_buffer, id: " << bitstream_buffer.id(); |
| 310 if (base::SharedMemory::IsHandleValid(bitstream_buffer.handle())) |
| 311 base::SharedMemory::CloseHandle(bitstream_buffer.handle()); |
| 312 NOTIFY_ERROR(INVALID_ARGUMENT); |
| 313 return; |
| 314 } |
| 315 |
308 // DecodeTask() will take care of running a DecodeBufferTask(). | 316 // DecodeTask() will take care of running a DecodeBufferTask(). |
309 decoder_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( | 317 decoder_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( |
310 &V4L2VideoDecodeAccelerator::DecodeTask, base::Unretained(this), | 318 &V4L2VideoDecodeAccelerator::DecodeTask, base::Unretained(this), |
311 bitstream_buffer)); | 319 bitstream_buffer)); |
312 } | 320 } |
313 | 321 |
314 void V4L2VideoDecodeAccelerator::AssignPictureBuffers( | 322 void V4L2VideoDecodeAccelerator::AssignPictureBuffers( |
315 const std::vector<media::PictureBuffer>& buffers) { | 323 const std::vector<media::PictureBuffer>& buffers) { |
316 DVLOG(3) << "AssignPictureBuffers(): buffer_count=" << buffers.size(); | 324 DVLOG(3) << "AssignPictureBuffers(): buffer_count=" << buffers.size(); |
317 DCHECK(child_task_runner_->BelongsToCurrentThread()); | 325 DCHECK(child_task_runner_->BelongsToCurrentThread()); |
(...skipping 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2039 | 2047 |
2040 void V4L2VideoDecodeAccelerator::PictureCleared() { | 2048 void V4L2VideoDecodeAccelerator::PictureCleared() { |
2041 DVLOG(3) << "PictureCleared(). clearing count=" << picture_clearing_count_; | 2049 DVLOG(3) << "PictureCleared(). clearing count=" << picture_clearing_count_; |
2042 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); | 2050 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); |
2043 DCHECK_GT(picture_clearing_count_, 0); | 2051 DCHECK_GT(picture_clearing_count_, 0); |
2044 picture_clearing_count_--; | 2052 picture_clearing_count_--; |
2045 SendPictureReady(); | 2053 SendPictureReady(); |
2046 } | 2054 } |
2047 | 2055 |
2048 } // namespace content | 2056 } // namespace content |
OLD | NEW |