SoftHevcDec: notify error for fatal errors in decoder
Bug: 129796771
Bug: 130578045
Test: adb shell stagefright -s -S /sdcard/crowd422_hevc.mp4
Test: Ensure decoder doesn't attemp decoding all frames
Test: atest android.media.cts.DecoderTest
Test: android.media.cts.AdaptivePlaybackTest
Change-Id: Icb183d9aaa4280416c468e71cf319dacacf3b2ea
diff --git a/media/libstagefright/codecs/hevcdec/SoftHEVC.cpp b/media/libstagefright/codecs/hevcdec/SoftHEVC.cpp
index bb7d361..f6ae1f4 100644
--- a/media/libstagefright/codecs/hevcdec/SoftHEVC.cpp
+++ b/media/libstagefright/codecs/hevcdec/SoftHEVC.cpp
@@ -569,7 +569,7 @@
status = ivdec_api_function(mCodecCtx, (void *)&s_dec_ip, (void *)&s_dec_op);
bool unsupportedResolution =
- (IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED == (s_dec_op.u4_error_code & 0xFF));
+ (IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED == (s_dec_op.u4_error_code & IVD_ERROR_MASK));
/* Check for unsupported dimensions */
if (unsupportedResolution) {
@@ -579,7 +579,8 @@
return;
}
- bool allocationFailed = (IVD_MEM_ALLOC_FAILED == (s_dec_op.u4_error_code & 0xFF));
+ bool allocationFailed =
+ (IVD_MEM_ALLOC_FAILED == (s_dec_op.u4_error_code & IVD_ERROR_MASK));
if (allocationFailed) {
ALOGE("Allocation failure in decoder");
notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL);
@@ -587,7 +588,14 @@
return;
}
- bool resChanged = (IVD_RES_CHANGED == (s_dec_op.u4_error_code & 0xFF));
+ if (IS_IVD_FATAL_ERROR(s_dec_op.u4_error_code)) {
+ ALOGE("Fatal Error : 0x%x", s_dec_op.u4_error_code);
+ notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL);
+ mSignalledError = true;
+ return;
+ }
+
+ bool resChanged = (IVD_RES_CHANGED == (s_dec_op.u4_error_code & IVD_ERROR_MASK));
getVUIParams();