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(); |
392 output_record.texture_id = buffers[i].service_texture_ids()[0]; | 391 output_record.texture_id = buffers[i].service_texture_ids().empty() |
| 392 ? 0 |
| 393 : buffers[i].service_texture_ids()[0]; |
| 394 |
393 // This will remain kAtClient until ImportBufferForPicture is called, either | 395 // This will remain kAtClient until ImportBufferForPicture is called, either |
394 // by the client, or by ourselves, if we are allocating. | 396 // by the client, or by ourselves, if we are allocating. |
395 output_record.state = kAtClient; | 397 output_record.state = kAtClient; |
396 | 398 |
397 if (image_processor_device_) { | 399 if (image_processor_device_) { |
398 std::vector<base::ScopedFD> dmabuf_fds = device_->GetDmabufsForV4L2Buffer( | 400 std::vector<base::ScopedFD> dmabuf_fds = device_->GetDmabufsForV4L2Buffer( |
399 i, output_planes_count_, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); | 401 i, output_planes_count_, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); |
400 if (dmabuf_fds.empty()) { | 402 if (dmabuf_fds.empty()) { |
401 LOGF(ERROR) << "Failed to get DMABUFs of decoder."; | 403 LOGF(ERROR) << "Failed to get DMABUFs of decoder."; |
402 NOTIFY_ERROR(PLATFORM_FAILURE); | 404 NOTIFY_ERROR(PLATFORM_FAILURE); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 | 441 |
440 void V4L2VideoDecodeAccelerator::CreateEGLImageFor( | 442 void V4L2VideoDecodeAccelerator::CreateEGLImageFor( |
441 size_t buffer_index, | 443 size_t buffer_index, |
442 int32_t picture_buffer_id, | 444 int32_t picture_buffer_id, |
443 std::vector<base::ScopedFD> dmabuf_fds, | 445 std::vector<base::ScopedFD> dmabuf_fds, |
444 GLuint texture_id, | 446 GLuint texture_id, |
445 const gfx::Size& size, | 447 const gfx::Size& size, |
446 uint32_t fourcc) { | 448 uint32_t fourcc) { |
447 DVLOGF(3) << "index=" << buffer_index; | 449 DVLOGF(3) << "index=" << buffer_index; |
448 DCHECK(child_task_runner_->BelongsToCurrentThread()); | 450 DCHECK(child_task_runner_->BelongsToCurrentThread()); |
| 451 DCHECK_NE(texture_id, 0u); |
449 | 452 |
450 if (get_gl_context_cb_.is_null() || make_context_current_cb_.is_null()) { | 453 if (get_gl_context_cb_.is_null() || make_context_current_cb_.is_null()) { |
451 DLOGF(ERROR) << "GL callbacks required for binding to EGLImages"; | 454 DLOGF(ERROR) << "GL callbacks required for binding to EGLImages"; |
452 NOTIFY_ERROR(INVALID_ARGUMENT); | 455 NOTIFY_ERROR(INVALID_ARGUMENT); |
453 return; | 456 return; |
454 } | 457 } |
455 | 458 |
456 gl::GLContext* gl_context = get_gl_context_cb_.Run(); | 459 gl::GLContext* gl_context = get_gl_context_cb_.Run(); |
457 if (!gl_context || !make_context_current_cb_.Run()) { | 460 if (!gl_context || !make_context_current_cb_.Run()) { |
458 DLOGF(ERROR) << "No GL context"; | 461 DLOGF(ERROR) << "No GL context"; |
(...skipping 2160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2619 StartResolutionChange(); | 2622 StartResolutionChange(); |
2620 } | 2623 } |
2621 } | 2624 } |
2622 | 2625 |
2623 void V4L2VideoDecodeAccelerator::ImageProcessorError() { | 2626 void V4L2VideoDecodeAccelerator::ImageProcessorError() { |
2624 LOGF(ERROR) << "Image processor error"; | 2627 LOGF(ERROR) << "Image processor error"; |
2625 NOTIFY_ERROR(PLATFORM_FAILURE); | 2628 NOTIFY_ERROR(PLATFORM_FAILURE); |
2626 } | 2629 } |
2627 | 2630 |
2628 } // namespace media | 2631 } // namespace media |
OLD | NEW |