| 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 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 | 748 |
| 749 if (!gfx::Rect(coded_size_).Contains(gfx::Rect(visible_size_))) { | 749 if (!gfx::Rect(coded_size_).Contains(gfx::Rect(visible_size_))) { |
| 750 LOG(ERROR) << "Got invalid adjusted coded size: " << coded_size_.ToString(); | 750 LOG(ERROR) << "Got invalid adjusted coded size: " << coded_size_.ToString(); |
| 751 return false; | 751 return false; |
| 752 } | 752 } |
| 753 | 753 |
| 754 DVLOGF(3) << "buffer_count=" << num_pictures | 754 DVLOGF(3) << "buffer_count=" << num_pictures |
| 755 << ", visible size=" << visible_size_.ToString() | 755 << ", visible size=" << visible_size_.ToString() |
| 756 << ", coded size=" << coded_size_.ToString(); | 756 << ", coded size=" << coded_size_.ToString(); |
| 757 | 757 |
| 758 VideoPixelFormat pixel_format = | |
| 759 V4L2Device::V4L2PixFmtToVideoPixelFormat(output_format_fourcc_); | |
| 760 | |
| 761 child_task_runner_->PostTask( | 758 child_task_runner_->PostTask( |
| 762 FROM_HERE, | 759 FROM_HERE, |
| 763 base::Bind(&VideoDecodeAccelerator::Client::ProvidePictureBuffers, | 760 base::Bind(&VideoDecodeAccelerator::Client::ProvidePictureBuffers, |
| 764 client_, num_pictures, pixel_format, 1, coded_size_, | 761 client_, num_pictures, 1, coded_size_, |
| 765 device_->GetTextureTarget())); | 762 device_->GetTextureTarget())); |
| 766 | 763 |
| 767 // Go into kAwaitingPictureBuffers to prevent us from doing any more decoding | 764 // Go into kAwaitingPictureBuffers to prevent us from doing any more decoding |
| 768 // or event handling while we are waiting for AssignPictureBuffers(). Not | 765 // or event handling while we are waiting for AssignPictureBuffers(). Not |
| 769 // having Pictures available would not have prevented us from making decoding | 766 // having Pictures available would not have prevented us from making decoding |
| 770 // progress entirely e.g. in the case of H.264 where we could further decode | 767 // progress entirely e.g. in the case of H.264 where we could further decode |
| 771 // non-slice NALUs and could even get another resolution change before we were | 768 // non-slice NALUs and could even get another resolution change before we were |
| 772 // done with this one. After we get the buffers, we'll go back into kIdle and | 769 // done with this one. After we get the buffers, we'll go back into kIdle and |
| 773 // kick off further event processing, and eventually go back into kDecoding | 770 // kick off further event processing, and eventually go back into kDecoding |
| 774 // once no more events are pending (if any). | 771 // once no more events are pending (if any). |
| (...skipping 2012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2787 } | 2784 } |
| 2788 | 2785 |
| 2789 bool V4L2SliceVideoDecodeAccelerator::TryToSetupDecodeOnSeparateThread( | 2786 bool V4L2SliceVideoDecodeAccelerator::TryToSetupDecodeOnSeparateThread( |
| 2790 const base::WeakPtr<Client>& decode_client, | 2787 const base::WeakPtr<Client>& decode_client, |
| 2791 const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) { | 2788 const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) { |
| 2792 decode_client_ = decode_client_; | 2789 decode_client_ = decode_client_; |
| 2793 decode_task_runner_ = decode_task_runner; | 2790 decode_task_runner_ = decode_task_runner; |
| 2794 return true; | 2791 return true; |
| 2795 } | 2792 } |
| 2796 | 2793 |
| 2794 media::VideoPixelFormat V4L2SliceVideoDecodeAccelerator::GetOutputFormat() |
| 2795 const { |
| 2796 return V4L2Device::V4L2PixFmtToVideoPixelFormat(output_format_fourcc_); |
| 2797 } |
| 2798 |
| 2797 // static | 2799 // static |
| 2798 media::VideoDecodeAccelerator::SupportedProfiles | 2800 media::VideoDecodeAccelerator::SupportedProfiles |
| 2799 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { | 2801 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { |
| 2800 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); | 2802 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); |
| 2801 if (!device) | 2803 if (!device) |
| 2802 return SupportedProfiles(); | 2804 return SupportedProfiles(); |
| 2803 | 2805 |
| 2804 return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_), | 2806 return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_), |
| 2805 supported_input_fourccs_); | 2807 supported_input_fourccs_); |
| 2806 } | 2808 } |
| 2807 | 2809 |
| 2808 } // namespace media | 2810 } // namespace media |
| OLD | NEW |