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