c2 vp9, av1: List P010 in color formats only if it is supported
AHardwareBuffer_isSupported() now supports P010 format and thus
can be used to check if P010 is supported before advertising it as
as supported pixel format.
Also this is now instead of an extra allocation that was done earlier
to check if a format was supported.
Bug: 214411172
Test: atest CtsMediaDecoderTestCases:ImageReaderDecoderTest -- \
--module-arg \
CtsMediaDecoderTestCases:instrumentation-arg:codec-prefix:=c2.android.
Test: atest android.mediav2.cts.CodecDecoderSurfaceTest \
android.mediav2.cts.AdaptivePlaybackTest \
android.mediav2.cts.CodecDecoderTest -- --module-arg \
CtsMediaV2TestCases:instrumentation-arg:codec-prefix:=c2.android.
Change-Id: Iee516a1d45ab82308e74fe6941be748a12bab8af
diff --git a/media/codec2/components/vpx/C2SoftVpxDec.cpp b/media/codec2/components/vpx/C2SoftVpxDec.cpp
index c2ccfa0..d969f2e 100644
--- a/media/codec2/components/vpx/C2SoftVpxDec.cpp
+++ b/media/codec2/components/vpx/C2SoftVpxDec.cpp
@@ -25,6 +25,7 @@
#include <C2Debug.h>
#include <C2PlatformSupport.h>
#include <Codec2BufferUtils.h>
+#include <Codec2CommonUtils.h>
#include <SimpleC2Interface.h>
#include "C2SoftVpxDec.h"
@@ -219,7 +220,7 @@
// TODO: support more formats?
std::vector<uint32_t> pixelFormats = {HAL_PIXEL_FORMAT_YCBCR_420_888};
#ifdef VP9
- if (isAtLeastT()) {
+ if (isHalPixelFormatSupported((AHardwareBuffer_Format)HAL_PIXEL_FORMAT_YCBCR_P010)) {
pixelFormats.push_back(HAL_PIXEL_FORMAT_YCBCR_P010);
}
#endif