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 "media/gpu/v4l2_slice_video_decode_accelerator.h" | 5 #include "media/gpu/v4l2_slice_video_decode_accelerator.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <linux/videodev2.h> | 9 #include <linux/videodev2.h> |
10 #include <poll.h> | 10 #include <poll.h> |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 | 856 |
857 DCHECK(input_streamon_ || output_streamon_); | 857 DCHECK(input_streamon_ || output_streamon_); |
858 | 858 |
859 if (input_buffer_queued_count_ + output_buffer_queued_count_ == 0) { | 859 if (input_buffer_queued_count_ + output_buffer_queued_count_ == 0) { |
860 DVLOGF(4) << "No buffers queued, will not schedule poll"; | 860 DVLOGF(4) << "No buffers queued, will not schedule poll"; |
861 return; | 861 return; |
862 } | 862 } |
863 | 863 |
864 DVLOGF(4) << "Scheduling device poll task"; | 864 DVLOGF(4) << "Scheduling device poll task"; |
865 | 865 |
866 device_poll_thread_.message_loop()->PostTask( | 866 device_poll_thread_.task_runner()->PostTask( |
867 FROM_HERE, base::Bind(&V4L2SliceVideoDecodeAccelerator::DevicePollTask, | 867 FROM_HERE, base::Bind(&V4L2SliceVideoDecodeAccelerator::DevicePollTask, |
868 base::Unretained(this), true)); | 868 base::Unretained(this), true)); |
869 | 869 |
870 DVLOGF(2) << "buffer counts: " | 870 DVLOGF(2) << "buffer counts: " |
871 << "INPUT[" << decoder_input_queue_.size() << "]" | 871 << "INPUT[" << decoder_input_queue_.size() << "]" |
872 << " => DEVICE[" | 872 << " => DEVICE[" |
873 << free_input_buffers_.size() << "+" | 873 << free_input_buffers_.size() << "+" |
874 << input_buffer_queued_count_ << "/" | 874 << input_buffer_queued_count_ << "/" |
875 << input_buffer_map_.size() << "]->[" | 875 << input_buffer_map_.size() << "]->[" |
876 << free_output_buffers_.size() << "+" | 876 << free_output_buffers_.size() << "+" |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_STREAMON, &type); | 1162 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_STREAMON, &type); |
1163 input_streamon_ = true; | 1163 input_streamon_ = true; |
1164 } | 1164 } |
1165 | 1165 |
1166 if (!output_streamon_) { | 1166 if (!output_streamon_) { |
1167 __u32 type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; | 1167 __u32 type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; |
1168 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_STREAMON, &type); | 1168 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_STREAMON, &type); |
1169 output_streamon_ = true; | 1169 output_streamon_ = true; |
1170 } | 1170 } |
1171 | 1171 |
1172 device_poll_thread_.message_loop()->PostTask( | 1172 device_poll_thread_.task_runner()->PostTask( |
1173 FROM_HERE, base::Bind(&V4L2SliceVideoDecodeAccelerator::DevicePollTask, | 1173 FROM_HERE, base::Bind(&V4L2SliceVideoDecodeAccelerator::DevicePollTask, |
1174 base::Unretained(this), true)); | 1174 base::Unretained(this), true)); |
1175 | 1175 |
1176 return true; | 1176 return true; |
1177 } | 1177 } |
1178 | 1178 |
1179 bool V4L2SliceVideoDecodeAccelerator::StopDevicePoll(bool keep_input_state) { | 1179 bool V4L2SliceVideoDecodeAccelerator::StopDevicePoll(bool keep_input_state) { |
1180 DVLOGF(3) << "Stopping device poll"; | 1180 DVLOGF(3) << "Stopping device poll"; |
1181 if (decoder_thread_.IsRunning()) | 1181 if (decoder_thread_.IsRunning()) |
1182 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); | 1182 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); |
(...skipping 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2803 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { | 2803 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { |
2804 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); | 2804 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); |
2805 if (!device) | 2805 if (!device) |
2806 return SupportedProfiles(); | 2806 return SupportedProfiles(); |
2807 | 2807 |
2808 return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_), | 2808 return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_), |
2809 supported_input_fourccs_); | 2809 supported_input_fourccs_); |
2810 } | 2810 } |
2811 | 2811 |
2812 } // namespace media | 2812 } // namespace media |
OLD | NEW |