Commit 35faa106 authored by premathasara's avatar premathasara
Browse files

Fix memory leak with binaural and binaural room output

parent 433bde48
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ typedef INT64 int64_t;
/* This is the maximum number of allocations for which to keep information.
   It can be increased if required. */
#ifdef SBA_BR_SWITCHING
#define MAX_INFO_RECORDS 5000
#define MAX_INFO_RECORDS 8000
#else
#define MAX_INFO_RECORDS 3000
#endif
+38 −6
Original line number Diff line number Diff line
@@ -526,14 +526,42 @@ ivas_error ivas_sba_dec_reinit(
        }
    }

    /*------------------------------------------------------------------------------------------*
     * Reopening Decoder handles for Reinitialisation
     *------------------------------------------------------------------------------------------*/

    /* Allocate and initialize Custom loudspeaker layout handle */
    if ( st_ivas->hDecoderConfig->Opt_LsCustom )
    {
        if ( ( error = ivas_ls_custom_open( &( st_ivas->hLsSetupCustom ) ) ) != IVAS_ERR_OK )
        {
            return error;
        }
    }

    /* Allocate and initialize Head-Tracking handle */
    if ( st_ivas->hDecoderConfig->Opt_Headrotation )
    {
        if ( ( error = ivas_headTrack_open( &( st_ivas->hHeadTrackData ) ) ) != IVAS_ERR_OK )
        {
            return error;
        }
    }

    /* Allocate HRTF binary handle */
    if ( st_ivas->hDecoderConfig->Opt_HRTF_binary )
    {
        if ( ( error = ivas_HRTF_binary_open( &( st_ivas->hHrtfTD ) ) ) != IVAS_ERR_OK )
        {
            return error;
        }
    }

    st_ivas->sba_dirac_stereo_flag = 0;
    /*Reconfigure output paramaters*/
    ivas_sba_config( ivas_total_brate, st_ivas->sba_analysis_order, -1, &( st_ivas->nchan_transport ), st_ivas->sba_planar, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init );
    ivas_renderer_select( st_ivas );
    ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config );
    /*------------------------------------------------------------------------------------------*
      * Reopening Decoder handles for Reinitialisation
      *------------------------------------------------------------------------------------------*/
    if ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK )
    {
        return error;
@@ -711,6 +739,10 @@ ivas_error ivas_sba_dec_reinit(
        {
            return error;
        }
        if ( ivas_render_config_init_from_rom( &st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM ) != IVAS_ERR_OK )
        {
            return IVAS_ERR_INTERNAL_FATAL;
        }
    }
    if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM )
    {