| 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 <errno.h> | 5 #include <errno.h> |
| 6 #include <fcntl.h> | 6 #include <fcntl.h> |
| 7 #include <linux/videodev2.h> | 7 #include <linux/videodev2.h> |
| 8 #include <poll.h> | 8 #include <poll.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <sys/eventfd.h> | 10 #include <sys/eventfd.h> |
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 return false; | 734 return false; |
| 735 } | 735 } |
| 736 | 736 |
| 737 DVLOGF(3) << "buffer_count=" << num_pictures | 737 DVLOGF(3) << "buffer_count=" << num_pictures |
| 738 << ", visible size=" << visible_size_.ToString() | 738 << ", visible size=" << visible_size_.ToString() |
| 739 << ", coded size=" << coded_size_.ToString(); | 739 << ", coded size=" << coded_size_.ToString(); |
| 740 | 740 |
| 741 child_task_runner_->PostTask( | 741 child_task_runner_->PostTask( |
| 742 FROM_HERE, | 742 FROM_HERE, |
| 743 base::Bind(&VideoDecodeAccelerator::Client::ProvidePictureBuffers, | 743 base::Bind(&VideoDecodeAccelerator::Client::ProvidePictureBuffers, |
| 744 client_, num_pictures, coded_size_, | 744 client_, num_pictures, 1, coded_size_, |
| 745 device_->GetTextureTarget())); | 745 device_->GetTextureTarget())); |
| 746 | 746 |
| 747 return true; | 747 return true; |
| 748 } | 748 } |
| 749 | 749 |
| 750 void V4L2SliceVideoDecodeAccelerator::DestroyInputBuffers() { | 750 void V4L2SliceVideoDecodeAccelerator::DestroyInputBuffers() { |
| 751 DVLOGF(3); | 751 DVLOGF(3); |
| 752 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread() || | 752 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread() || |
| 753 !decoder_thread_.IsRunning()); | 753 !decoder_thread_.IsRunning()); |
| 754 DCHECK(!input_streamon_); | 754 DCHECK(!input_streamon_); |
| (...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1491 if (!make_context_current_.Run()) { | 1491 if (!make_context_current_.Run()) { |
| 1492 DLOG(ERROR) << "could not make context current"; | 1492 DLOG(ERROR) << "could not make context current"; |
| 1493 NOTIFY_ERROR(PLATFORM_FAILURE); | 1493 NOTIFY_ERROR(PLATFORM_FAILURE); |
| 1494 return; | 1494 return; |
| 1495 } | 1495 } |
| 1496 | 1496 |
| 1497 gfx::ScopedTextureBinder bind_restore(GL_TEXTURE_EXTERNAL_OES, 0); | 1497 gfx::ScopedTextureBinder bind_restore(GL_TEXTURE_EXTERNAL_OES, 0); |
| 1498 | 1498 |
| 1499 std::vector<EGLImageKHR> egl_images; | 1499 std::vector<EGLImageKHR> egl_images; |
| 1500 for (size_t i = 0; i < buffers.size(); ++i) { | 1500 for (size_t i = 0; i < buffers.size(); ++i) { |
| 1501 EGLImageKHR egl_image = device_->CreateEGLImage(egl_display_, | 1501 DCHECK_LE(1u, buffers[i].texture_ids().size()); |
| 1502 egl_context_, | 1502 EGLImageKHR egl_image = device_->CreateEGLImage( |
| 1503 buffers[i].texture_id(), | 1503 egl_display_, egl_context_, buffers[i].texture_ids()[0], |
| 1504 buffers[i].size(), | 1504 buffers[i].size(), i, output_format_fourcc, output_planes_count); |
| 1505 i, | |
| 1506 output_format_fourcc, | |
| 1507 output_planes_count); | |
| 1508 if (egl_image == EGL_NO_IMAGE_KHR) { | 1505 if (egl_image == EGL_NO_IMAGE_KHR) { |
| 1509 LOGF(ERROR) << "Could not create EGLImageKHR"; | 1506 LOGF(ERROR) << "Could not create EGLImageKHR"; |
| 1510 for (const auto& image_to_destroy : egl_images) | 1507 for (const auto& image_to_destroy : egl_images) |
| 1511 device_->DestroyEGLImage(egl_display_, image_to_destroy); | 1508 device_->DestroyEGLImage(egl_display_, image_to_destroy); |
| 1512 | 1509 |
| 1513 NOTIFY_ERROR(PLATFORM_FAILURE); | 1510 NOTIFY_ERROR(PLATFORM_FAILURE); |
| 1514 return; | 1511 return; |
| 1515 } | 1512 } |
| 1516 | 1513 |
| 1517 egl_images.push_back(egl_image); | 1514 egl_images.push_back(egl_image); |
| (...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2604 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { | 2601 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { |
| 2605 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); | 2602 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); |
| 2606 if (!device) | 2603 if (!device) |
| 2607 return SupportedProfiles(); | 2604 return SupportedProfiles(); |
| 2608 | 2605 |
| 2609 return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_), | 2606 return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_), |
| 2610 supported_input_fourccs_); | 2607 supported_input_fourccs_); |
| 2611 } | 2608 } |
| 2612 | 2609 |
| 2613 } // namespace content | 2610 } // namespace content |
| OLD | NEW |