From e267550d95a72ba7261eddad6dea8f8ce379e8e8 Mon Sep 17 00:00:00 2001 From: andrewlewis Date: Thu, 15 Aug 2019 14:17:18 +0100 Subject: [PATCH] Throw for unsupported libvpx output formats Currently we fail silently for high bit depth output when using ANativeWindow output mode. PiperOrigin-RevId: 263549384 --- extensions/vp9/src/main/jni/vpx_jni.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/extensions/vp9/src/main/jni/vpx_jni.cc b/extensions/vp9/src/main/jni/vpx_jni.cc index 9fc8b09a18..d23f07a90b 100644 --- a/extensions/vp9/src/main/jni/vpx_jni.cc +++ b/extensions/vp9/src/main/jni/vpx_jni.cc @@ -594,8 +594,14 @@ DECODER_FUNC(jint, vpxGetFrame, jlong jContext, jobject jOutputBuffer) { memcpy(data + yLength, img->planes[VPX_PLANE_U], uvLength); memcpy(data + yLength + uvLength, img->planes[VPX_PLANE_V], uvLength); } - } else if (outputMode == kOutputModeSurfaceYuv && - img->fmt != VPX_IMG_FMT_I42016) { + } else if (outputMode == kOutputModeSurfaceYuv) { + if (img->fmt & VPX_IMG_FMT_HIGHBITDEPTH) { + LOGE( + "ERROR: High bit depth output format %d not supported in surface " + "YUV output mode", + img->fmt); + return -1; + } int id = *(int*)img->fb_priv; context->buffer_manager->add_ref(id); JniFrameBuffer* jfb = context->buffer_manager->get_buffer(id);