Commit a3c49f12 authored by norvell's avatar norvell
Browse files

Change FIX_462_HRTF_FILE_BR_SWITCH_MEM_ERR such that it does not deallocate HRTFs loaded from file

parent 27bf2432
Loading
Loading
Loading
Loading
Loading
+24 −5
Original line number Diff line number Diff line
@@ -41,9 +41,6 @@
#include "debug.h"
#endif
#include "wmc_auto.h"
#ifdef FIX_462_HRTF_FILE_BR_SWITCH_MEM_ERR
#include "hrtf_file_reader.h"
#endif

/*-------------------------------------------------------------------------*
 * ivas_ism_bitrate_switching()
@@ -196,11 +193,21 @@ 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 )
            {
                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
        {
            /* close the ISM renderer and reinitialize */
@@ -263,8 +270,8 @@ static ivas_error ivas_ism_bitrate_switching(

            /* Close the TD Binaural renderer */
#ifdef FIX_462_HRTF_FILE_BR_SWITCH_MEM_ERR
            dealloc_HRTF_binary( st_ivas->hBinRendererTd->HrFiltSet_p );
#endif
            if ( st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM == TRUE )
            {
                if ( st_ivas->hBinRendererTd != NULL )
                {
                    ivas_td_binaural_close( &st_ivas->hBinRendererTd );
@@ -275,6 +282,18 @@ static ivas_error ivas_ism_bitrate_switching(
                    st_ivas->hHrtfTD = NULL;
                }
            }
#else
            if ( st_ivas->hBinRendererTd != NULL )
            {
                ivas_td_binaural_close( &st_ivas->hBinRendererTd );
            }

            if ( st_ivas->hHrtfTD != NULL )
            {
                st_ivas->hHrtfTD = NULL;
            }
#endif
        }
        else
        {
            /* Close the ISM renderer */