Chromium Code Reviews| Index: media/gpu/v4l2_video_decode_accelerator.cc |
| diff --git a/media/gpu/v4l2_video_decode_accelerator.cc b/media/gpu/v4l2_video_decode_accelerator.cc |
| index 01e650a2f3cf35fdb5581f672b957672d9a2ae06..3122e5f12cab0bf35847f9b189b017b257a2af79 100644 |
| --- a/media/gpu/v4l2_video_decode_accelerator.cc |
| +++ b/media/gpu/v4l2_video_decode_accelerator.cc |
| @@ -2038,9 +2038,27 @@ uint32_t V4L2VideoDecodeAccelerator::FindImageProcessorInputFormat() { |
| } |
| uint32_t V4L2VideoDecodeAccelerator::FindImageProcessorOutputFormat() { |
| + // Prefer YVU420 and NV12 because ArcGpuVideoDecodeAccelerator only support |
|
Pawel Osciak
2016/08/23 05:22:00
s/support/supports/
wuchengli
2016/08/23 08:52:32
Done.
|
| + // single physical plane. Prefer YVU420 over NV12 because chrome rendering |
| + // supports YV12 only. |
| + static const uint32_t kPreferredFormats[] = {V4L2_PIX_FMT_YVU420, |
| + V4L2_PIX_FMT_NV12}; |
| + auto preferred_formats_first = [](uint32_t a, uint32_t b) -> bool { |
| + auto iter_a = std::find(std::begin(kPreferredFormats), |
| + std::end(kPreferredFormats), a); |
| + auto iter_b = std::find(std::begin(kPreferredFormats), |
| + std::end(kPreferredFormats), b); |
| + return iter_a < iter_b; |
| + }; |
| + |
| V4L2ImageProcessor image_processor(image_processor_device_); |
| std::vector<uint32_t> processor_output_formats = |
| image_processor.GetSupportedOutputFormats(); |
| + |
| + // Move the preferred format to the front. |
|
Pawel Osciak
2016/08/23 05:22:00
s/format/formats/
/./in the same order as in kPref
wuchengli
2016/08/23 08:52:33
Done.
|
| + std::sort(processor_output_formats.begin(), processor_output_formats.end(), |
| + preferred_formats_first); |
| + |
| for (uint32_t processor_output_format : processor_output_formats) { |
| if (device_->CanCreateEGLImageFrom(processor_output_format)) { |
| DVLOGF(1) << "Image processor output format=" << processor_output_format; |