CCodec: pre-S bytebuffer mode encoders to use YV12 format
CCodec used to convert YUV formats into YV12 pre-S, and in older
vendor partition the codecs may be operating under this assumption.
Bug: 216688552
Test: atest android.media.codec.cts.VideoCodecTest
Change-Id: I16994514708ad5fb280e745afb73a282b57f3bb5
diff --git a/media/codec2/sfplugin/CCodec.cpp b/media/codec2/sfplugin/CCodec.cpp
index fffd60a..8783c2c 100644
--- a/media/codec2/sfplugin/CCodec.cpp
+++ b/media/codec2/sfplugin/CCodec.cpp
@@ -1074,6 +1074,17 @@
}
} else {
if ((config->mDomain & Config::IS_ENCODER) || !surface) {
+ if (vendorSdkVersion < __ANDROID_API_S__ &&
+ (format == COLOR_FormatYUV420Flexible ||
+ format == COLOR_FormatYUV420Planar ||
+ format == COLOR_FormatYUV420PackedPlanar ||
+ format == COLOR_FormatYUV420SemiPlanar ||
+ format == COLOR_FormatYUV420PackedSemiPlanar)) {
+ // pre-S framework used to map these color formats into YV12.
+ // Codecs from older vendor partition may be relying on
+ // this assumption.
+ format = HAL_PIXEL_FORMAT_YV12;
+ }
switch (format) {
case COLOR_FormatYUV420Flexible:
format = COLOR_FormatYUV420Planar;