diff --git a/lib_com/options.h b/lib_com/options.h index 9a99079a85175bc8df09cd6f153c70eaddeb6ac1..b7394459f34752548b29494cae0200526d0fc575 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -179,6 +179,7 @@ #define NONBE_1211_DTX_BR_SWITCHING /* VA: issue 1211: fix crash in MASA DTX bitrate switching */ #define NONBE_1217_INIT_OBJ_EDIT /* VA: issue 1217: do object editing only when objects metadata is available */ #define NONBE_1217_OBJ_EDIT_FOA /* VA/Nokia: isse 1217: fix crash in object editing to FOA output in ParamISM */ +#define NONBE_1215_FIX_JBM_MAX_SCALING /* FhG: issue 1215: Fix assert hit in a specific VoIP decoder config. Caused by integer overflow in max scaling calculation. */ #define NONBE_1230_DECODE_MASA_ISM_AZIMUTH_PREC_FROM_BASOP /* Nokia: Fixes ivas_decode_masaism_metadata decision logic change due to precision difference; this is the fix in floating point */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/jbm_jb4sb.c b/lib_dec/jbm_jb4sb.c index 8ea0e54d822e1b0c630a02336bf62450815d33f6..8b8f467d382191ab1927157734c57519f9f88aa6 100644 --- a/lib_dec/jbm_jb4sb.c +++ b/lib_dec/jbm_jb4sb.c @@ -811,7 +811,15 @@ static void JB4_adaptActivePlayout( ( dropRateMax - dropRateMin ) / dropGapMax + dropRateMin; *scale = ( 1000 - rate ) / 10; +#ifdef NONBE_1215_FIX_JBM_MAX_SCALING + /* Limit max scaling to the duration of one frame. APA will not exceed this limit + * anyway due to the 50% limitation of APA_MIN_SCALE and APA_MAX_SCALE. Limiting + * the value to a sensible range here avoids integer overflows at later stages when + * converting maxScaling from milliseconds to samples. */ + *maxScaling = JB4_MIN( currPlayoutDelay - targetMax, 1000 / IVAS_NUM_FRAMES_PER_SEC ); +#else *maxScaling = currPlayoutDelay - targetMax; +#endif } } } @@ -827,7 +835,15 @@ static void JB4_adaptActivePlayout( currPlayoutDelay < targetMaxStretch && currPlayoutDelay < (uint32_t) ( 110 + h->rfDelay / 4 ) ) { *scale = 120; +#ifdef NONBE_1215_FIX_JBM_MAX_SCALING + /* Limit max scaling to the duration of one frame. APA will not exceed this limit + * anyway due to the 50% limitation of APA_MIN_SCALE and APA_MAX_SCALE. Limiting + * the value to a sensible range here avoids integer overflows at later stages when + * converting maxScaling from milliseconds to samples. */ + *maxScaling = JB4_MIN( targetMaxStretch - currPlayoutDelay, 1000 / IVAS_NUM_FRAMES_PER_SEC ); +#else *maxScaling = targetMaxStretch - currPlayoutDelay; +#endif } }