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