| 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 "media/gpu/v4l2_video_decode_accelerator.h" | 5 #include "media/gpu/v4l2_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <fcntl.h> | 9 #include <fcntl.h> |
| 10 #include <linux/videodev2.h> | 10 #include <linux/videodev2.h> |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 | 378 |
| 379 for (size_t i = 0; i < output_buffer_map_.size(); ++i) { | 379 for (size_t i = 0; i < output_buffer_map_.size(); ++i) { |
| 380 DCHECK(buffers[i].size() == egl_image_size_); | 380 DCHECK(buffers[i].size() == egl_image_size_); |
| 381 | 381 |
| 382 OutputRecord& output_record = output_buffer_map_[i]; | 382 OutputRecord& output_record = output_buffer_map_[i]; |
| 383 DCHECK_EQ(output_record.state, kFree); | 383 DCHECK_EQ(output_record.state, kFree); |
| 384 DCHECK_EQ(output_record.egl_image, EGL_NO_IMAGE_KHR); | 384 DCHECK_EQ(output_record.egl_image, EGL_NO_IMAGE_KHR); |
| 385 DCHECK_EQ(output_record.egl_sync, EGL_NO_SYNC_KHR); | 385 DCHECK_EQ(output_record.egl_sync, EGL_NO_SYNC_KHR); |
| 386 DCHECK_EQ(output_record.picture_id, -1); | 386 DCHECK_EQ(output_record.picture_id, -1); |
| 387 DCHECK_EQ(output_record.cleared, false); | 387 DCHECK_EQ(output_record.cleared, false); |
| 388 DCHECK_EQ(1u, buffers[i].service_texture_ids().size()); | |
| 389 DCHECK(output_record.processor_input_fds.empty()); | 388 DCHECK(output_record.processor_input_fds.empty()); |
| 390 | 389 |
| 391 output_record.picture_id = buffers[i].id(); | 390 output_record.picture_id = buffers[i].id(); |
| 391 |
| 392 if (buffers[i].service_texture_ids().empty()) { |
| 393 LOGF(ERROR) << "No texture ids provided"; |
| 394 NOTIFY_ERROR(INVALID_ARGUMENT); |
| 395 return; |
| 396 } |
| 397 // We only support one texture per buffer currently. |
| 398 DCHECK_EQ(1u, buffers[i].service_texture_ids().size()); |
| 392 output_record.texture_id = buffers[i].service_texture_ids()[0]; | 399 output_record.texture_id = buffers[i].service_texture_ids()[0]; |
| 400 |
| 393 // This will remain kAtClient until ImportBufferForPicture is called, either | 401 // This will remain kAtClient until ImportBufferForPicture is called, either |
| 394 // by the client, or by ourselves, if we are allocating. | 402 // by the client, or by ourselves, if we are allocating. |
| 395 output_record.state = kAtClient; | 403 output_record.state = kAtClient; |
| 396 | 404 |
| 397 if (image_processor_device_) { | 405 if (image_processor_device_) { |
| 398 std::vector<base::ScopedFD> dmabuf_fds = device_->GetDmabufsForV4L2Buffer( | 406 std::vector<base::ScopedFD> dmabuf_fds = device_->GetDmabufsForV4L2Buffer( |
| 399 i, output_planes_count_, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); | 407 i, output_planes_count_, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); |
| 400 if (dmabuf_fds.empty()) { | 408 if (dmabuf_fds.empty()) { |
| 401 LOGF(ERROR) << "Failed to get DMABUFs of decoder."; | 409 LOGF(ERROR) << "Failed to get DMABUFs of decoder."; |
| 402 NOTIFY_ERROR(PLATFORM_FAILURE); | 410 NOTIFY_ERROR(PLATFORM_FAILURE); |
| (...skipping 2216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2619 StartResolutionChange(); | 2627 StartResolutionChange(); |
| 2620 } | 2628 } |
| 2621 } | 2629 } |
| 2622 | 2630 |
| 2623 void V4L2VideoDecodeAccelerator::ImageProcessorError() { | 2631 void V4L2VideoDecodeAccelerator::ImageProcessorError() { |
| 2624 LOGF(ERROR) << "Image processor error"; | 2632 LOGF(ERROR) << "Image processor error"; |
| 2625 NOTIFY_ERROR(PLATFORM_FAILURE); | 2633 NOTIFY_ERROR(PLATFORM_FAILURE); |
| 2626 } | 2634 } |
| 2627 | 2635 |
| 2628 } // namespace media | 2636 } // namespace media |
| OLD | NEW |