Commit 3827aaa5 authored by Sean DuBois's avatar Sean DuBois Committed by Commit Bot

Reland "Android: Query encoder for supported pixel formats"

This is a reland of 0bd5cafd
The original implementation would incorrectly try to use other
pixel formats besides COLOR_FORMAT_YUV420_SEMIPLANAR and
COLOR_FORMAT_YUV420_PLANAR

Original change's description:
> Test H264VideoEncodeAndValidate would fail on devices that don't
> support COLOR_FORMAT_YUV420_SEMIPLANAR. This make it so the test
> queries the encoder, and then take the color format from the
> returned set.
>
> R=braveyao@chromium.org
>
> Bug: 860559
> Change-Id: I524a7e803e9781960a99308834bac4d361e0c442
> Reviewed-on: https://chromium-review.googlesource.com/1127469
> Reviewed-by: Weiyong Yao <braveyao@chromium.org>
> Reviewed-by: John Rummell <jrummell@chromium.org>
> Commit-Queue: Weiyong Yao <braveyao@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#573361}

R=braveyao@chromium.org

Bug: 860559
Change-Id: If2926cb692910fcd8672ddefcf0c4e45e5998e10
Reviewed-on: https://chromium-review.googlesource.com/1132342
Commit-Queue: Weiyong Yao <braveyao@chromium.org>
Reviewed-by: default avatarWeiyong Yao <braveyao@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#574730}
parent 550a880d
...@@ -444,7 +444,19 @@ TEST(MediaCodecBridgeTest, H264VideoEncodeAndValidate) { ...@@ -444,7 +444,19 @@ TEST(MediaCodecBridgeTest, H264VideoEncodeAndValidate) {
const int bit_rate = 300000; const int bit_rate = 300000;
const int frame_rate = 30; const int frame_rate = 30;
const int i_frame_interval = 20; const int i_frame_interval = 20;
const int color_format = COLOR_FORMAT_YUV420_SEMIPLANAR; const std::set<int> supported_color_formats =
MediaCodecUtil::GetEncoderColorFormats("video/avc");
int color_format;
if (supported_color_formats.count(COLOR_FORMAT_YUV420_SEMIPLANAR) > 0) {
color_format = COLOR_FORMAT_YUV420_SEMIPLANAR;
} else if (supported_color_formats.count(COLOR_FORMAT_YUV420_PLANAR) > 0) {
color_format = COLOR_FORMAT_YUV420_PLANAR;
} else {
VLOG(0) << "Could not run test - YUV420_PLANAR and YUV420_SEMIPLANAR "
"unavailable for h264 encode.";
return;
}
std::unique_ptr<MediaCodecBridge> media_codec( std::unique_ptr<MediaCodecBridge> media_codec(
MediaCodecBridgeImpl::CreateVideoEncoder( MediaCodecBridgeImpl::CreateVideoEncoder(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment