Commit 0bd5cafd authored by Sean DuBois's avatar Sean DuBois Committed by Commit Bot

Android: Query encoder for supported pixel formats

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/1127469Reviewed-by: default avatarWeiyong Yao <braveyao@chromium.org>
Reviewed-by: default avatarJohn Rummell <jrummell@chromium.org>
Commit-Queue: Weiyong Yao <braveyao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#573361}
parent b56a1c30
...@@ -444,12 +444,14 @@ TEST(MediaCodecBridgeTest, H264VideoEncodeAndValidate) { ...@@ -444,12 +444,14 @@ 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");
ASSERT_TRUE(supported_color_formats.size() != 0);
std::unique_ptr<MediaCodecBridge> media_codec( std::unique_ptr<MediaCodecBridge> media_codec(
MediaCodecBridgeImpl::CreateVideoEncoder( MediaCodecBridgeImpl::CreateVideoEncoder(
kCodecH264, gfx::Size(width, height), bit_rate, frame_rate, kCodecH264, gfx::Size(width, height), bit_rate, frame_rate,
i_frame_interval, color_format)); i_frame_interval, *supported_color_formats.begin()));
ASSERT_THAT(media_codec, NotNull()); ASSERT_THAT(media_codec, NotNull());
const char* src_filename = "bear_320x192_40frames.yuv"; const char* src_filename = "bear_320x192_40frames.yuv";
......
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