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 1612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1623 DLOGF(ERROR) << "Could not allocate enough output buffers"; | 1623 DLOGF(ERROR) << "Could not allocate enough output buffers"; |
1624 NOTIFY_ERROR(PLATFORM_FAILURE); | 1624 NOTIFY_ERROR(PLATFORM_FAILURE); |
1625 return; | 1625 return; |
1626 } | 1626 } |
1627 | 1627 |
1628 DCHECK(free_output_buffers_.empty()); | 1628 DCHECK(free_output_buffers_.empty()); |
1629 DCHECK(output_buffer_map_.empty()); | 1629 DCHECK(output_buffer_map_.empty()); |
1630 output_buffer_map_.resize(buffers.size()); | 1630 output_buffer_map_.resize(buffers.size()); |
1631 for (size_t i = 0; i < output_buffer_map_.size(); ++i) { | 1631 for (size_t i = 0; i < output_buffer_map_.size(); ++i) { |
1632 DCHECK(buffers[i].size() == coded_size_); | 1632 DCHECK(buffers[i].size() == coded_size_); |
1633 DCHECK_EQ(1u, buffers[i].texture_ids().size()); | 1633 DCHECK_EQ(1u, buffers[i].service_texture_ids().size()); |
1634 | 1634 |
1635 OutputRecord& output_record = output_buffer_map_[i]; | 1635 OutputRecord& output_record = output_buffer_map_[i]; |
1636 DCHECK(!output_record.at_device); | 1636 DCHECK(!output_record.at_device); |
1637 DCHECK(!output_record.at_client); | 1637 DCHECK(!output_record.at_client); |
1638 DCHECK_EQ(output_record.egl_image, EGL_NO_IMAGE_KHR); | 1638 DCHECK_EQ(output_record.egl_image, EGL_NO_IMAGE_KHR); |
1639 DCHECK_EQ(output_record.egl_sync, EGL_NO_SYNC_KHR); | 1639 DCHECK_EQ(output_record.egl_sync, EGL_NO_SYNC_KHR); |
1640 DCHECK_EQ(output_record.picture_id, -1); | 1640 DCHECK_EQ(output_record.picture_id, -1); |
1641 DCHECK(output_record.dmabuf_fds.empty()); | 1641 DCHECK(output_record.dmabuf_fds.empty()); |
1642 DCHECK_EQ(output_record.cleared, false); | 1642 DCHECK_EQ(output_record.cleared, false); |
1643 | 1643 |
1644 output_record.picture_id = buffers[i].id(); | 1644 output_record.picture_id = buffers[i].id(); |
1645 output_record.texture_id = buffers[i].texture_ids()[0]; | 1645 output_record.texture_id = buffers[i].service_texture_ids()[0]; |
1646 // This will remain true until ImportBufferForPicture is called, either by | 1646 // This will remain true until ImportBufferForPicture is called, either by |
1647 // the client, or by ourselves, if we are allocating. | 1647 // the client, or by ourselves, if we are allocating. |
1648 output_record.at_client = true; | 1648 output_record.at_client = true; |
1649 if (output_mode_ == Config::OutputMode::ALLOCATE) { | 1649 if (output_mode_ == Config::OutputMode::ALLOCATE) { |
1650 std::vector<base::ScopedFD> dmabuf_fds = device_->GetDmabufsForV4L2Buffer( | 1650 std::vector<base::ScopedFD> dmabuf_fds = device_->GetDmabufsForV4L2Buffer( |
1651 i, output_planes_count_, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); | 1651 i, output_planes_count_, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); |
1652 if (dmabuf_fds.empty()) { | 1652 if (dmabuf_fds.empty()) { |
1653 NOTIFY_ERROR(PLATFORM_FAILURE); | 1653 NOTIFY_ERROR(PLATFORM_FAILURE); |
1654 return; | 1654 return; |
1655 } | 1655 } |
(...skipping 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3272 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { | 3272 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { |
3273 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); | 3273 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); |
3274 if (!device) | 3274 if (!device) |
3275 return SupportedProfiles(); | 3275 return SupportedProfiles(); |
3276 | 3276 |
3277 return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_), | 3277 return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_), |
3278 supported_input_fourccs_); | 3278 supported_input_fourccs_); |
3279 } | 3279 } |
3280 | 3280 |
3281 } // namespace media | 3281 } // namespace media |
OLD | NEW |