diff --git a/lib_com/options.h b/lib_com/options.h index 2d346ef5916926dcd05c79e1df9c941a721e296d..bfb3f0a29ce3175f367f4193f3637f6a401f4df3 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -157,6 +157,7 @@ #define FIX_MDCT_ST_PLC_FADEOUT_DELAY #define FIX_DIRAC_LS_SYNTHESIS_CONFIG_479 /* FhG: fix for issue 479, broken LS output with DirAC at high BRs */ #define HYBRID_ITD_MAX /* FhG: Improvement for DFT-stereo for cases with large ITDs */ +#define FIX_462_HRTF_FILE_BR_SWITCH_MEM_ERR /* Eri: Fix for issue 462: Use-of-uninitialized memory in external HRTF deallocation in decoder together with BR switching */ #define FIX_487_LOWRATE_SBA_TUNING_FIX /* Dlb: TUning fix for low bitrate cases to match theoretical longest SPAR MD bitstream */ #define FIX_490_MASA_2TC_LBR_DTX /* Nokia: Fixes issue 490 by correcting condition. */ diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 571da52921b7bd2a581a06f08815ff7471c779f0..34645b07df8fd4fe711edcfc7c073f0dc5675597 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -42,7 +42,6 @@ #endif #include "wmc_auto.h" - /*-------------------------------------------------------------------------* * ivas_ism_bitrate_switching() * @@ -186,10 +185,20 @@ static ivas_error ivas_ism_bitrate_switching( ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); /* Open the TD Binaural renderer */ +#ifdef FIX_462_HRTF_FILE_BR_SWITCH_MEM_ERR + if ( st_ivas->hHrtfTD == NULL || st_ivas->hBinRendererTd == NULL ) + { + if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#else if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } +#endif } else { @@ -252,6 +261,20 @@ static ivas_error ivas_ism_bitrate_switching( } /* Close the TD Binaural renderer */ +#ifdef FIX_462_HRTF_FILE_BR_SWITCH_MEM_ERR + if ( st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM == TRUE ) + { + if ( st_ivas->hBinRendererTd != NULL ) + { + ivas_td_binaural_close( &st_ivas->hBinRendererTd ); + } + + if ( st_ivas->hHrtfTD != NULL ) + { + st_ivas->hHrtfTD = NULL; + } + } +#else if ( st_ivas->hBinRendererTd != NULL ) { ivas_td_binaural_close( &st_ivas->hBinRendererTd ); @@ -261,6 +284,7 @@ static ivas_error ivas_ism_bitrate_switching( { st_ivas->hHrtfTD = NULL; } +#endif } else {