| 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 <fcntl.h> | 5 #include <fcntl.h> |
| 6 #include <linux/videodev2.h> | 6 #include <linux/videodev2.h> |
| 7 #include <poll.h> | 7 #include <poll.h> |
| 8 #include <sys/eventfd.h> | 8 #include <sys/eventfd.h> |
| 9 #include <sys/ioctl.h> | 9 #include <sys/ioctl.h> |
| 10 #include <sys/mman.h> | 10 #include <sys/mman.h> |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 // EAGAIN if we're just out of buffers to dequeue. | 503 // EAGAIN if we're just out of buffers to dequeue. |
| 504 break; | 504 break; |
| 505 } | 505 } |
| 506 PLOG(ERROR) << "ioctl() failed: VIDIOC_DQBUF"; | 506 PLOG(ERROR) << "ioctl() failed: VIDIOC_DQBUF"; |
| 507 NOTIFY_ERROR(); | 507 NOTIFY_ERROR(); |
| 508 return; | 508 return; |
| 509 } | 509 } |
| 510 InputRecord& input_record = input_buffer_map_[dqbuf.index]; | 510 InputRecord& input_record = input_buffer_map_[dqbuf.index]; |
| 511 DCHECK(input_record.at_device); | 511 DCHECK(input_record.at_device); |
| 512 input_record.at_device = false; | 512 input_record.at_device = false; |
| 513 input_record.frame = NULL; | 513 input_record.frame = nullptr; |
| 514 free_input_buffers_.push_back(dqbuf.index); | 514 free_input_buffers_.push_back(dqbuf.index); |
| 515 input_buffer_queued_count_--; | 515 input_buffer_queued_count_--; |
| 516 } | 516 } |
| 517 | 517 |
| 518 // Dequeue completed output (VIDEO_CAPTURE) buffers, recycle to the free list. | 518 // Dequeue completed output (VIDEO_CAPTURE) buffers, recycle to the free list. |
| 519 // Return the finished buffer to the client via the job ready callback. | 519 // Return the finished buffer to the client via the job ready callback. |
| 520 while (output_buffer_queued_count_ > 0) { | 520 while (output_buffer_queued_count_ > 0) { |
| 521 DCHECK(output_streamon_); | 521 DCHECK(output_streamon_); |
| 522 memset(&dqbuf, 0, sizeof(dqbuf)); | 522 memset(&dqbuf, 0, sizeof(dqbuf)); |
| 523 memset(&planes, 0, sizeof(planes)); | 523 memset(&planes, 0, sizeof(planes)); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 while (!input_queue_.empty()) | 692 while (!input_queue_.empty()) |
| 693 input_queue_.pop(); | 693 input_queue_.pop(); |
| 694 | 694 |
| 695 while (!running_jobs_.empty()) | 695 while (!running_jobs_.empty()) |
| 696 running_jobs_.pop(); | 696 running_jobs_.pop(); |
| 697 | 697 |
| 698 free_input_buffers_.clear(); | 698 free_input_buffers_.clear(); |
| 699 for (size_t i = 0; i < input_buffer_map_.size(); ++i) { | 699 for (size_t i = 0; i < input_buffer_map_.size(); ++i) { |
| 700 InputRecord& input_record = input_buffer_map_[i]; | 700 InputRecord& input_record = input_buffer_map_[i]; |
| 701 input_record.at_device = false; | 701 input_record.at_device = false; |
| 702 input_record.frame = NULL; | 702 input_record.frame = nullptr; |
| 703 free_input_buffers_.push_back(i); | 703 free_input_buffers_.push_back(i); |
| 704 } | 704 } |
| 705 input_buffer_queued_count_ = 0; | 705 input_buffer_queued_count_ = 0; |
| 706 | 706 |
| 707 free_output_buffers_.clear(); | 707 free_output_buffers_.clear(); |
| 708 for (size_t i = 0; i < output_buffer_map_.size(); ++i) { | 708 for (size_t i = 0; i < output_buffer_map_.size(); ++i) { |
| 709 OutputRecord& output_record = output_buffer_map_[i]; | 709 OutputRecord& output_record = output_buffer_map_[i]; |
| 710 output_record.at_device = false; | 710 output_record.at_device = false; |
| 711 if (!output_record.at_client) | 711 if (!output_record.at_client) |
| 712 free_output_buffers_.push_back(i); | 712 free_output_buffers_.push_back(i); |
| 713 } | 713 } |
| 714 output_buffer_queued_count_ = 0; | 714 output_buffer_queued_count_ = 0; |
| 715 | 715 |
| 716 return true; | 716 return true; |
| 717 } | 717 } |
| 718 | 718 |
| 719 } // namespace content | 719 } // namespace content |
| OLD | NEW |