Commit 5c769f4d authored by bayers's avatar bayers
Browse files

fix tc buffer reconfiguration

parent 611f3838
Loading
Loading
Loading
Loading
Loading
+49 −21
Original line number Diff line number Diff line
@@ -2865,7 +2865,15 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure(
        {
#endif
            /* realloc buffers */
#ifdef REMOVE_5MS_FLAG
            if ( hTcBuffer->tc_buffer != NULL )
            {
#endif
                free( hTcBuffer->tc_buffer );
                hTcBuffer->tc_buffer = NULL;
#ifdef REMOVE_5MS_FLAG
            }
#endif
#ifndef UNIFY_CHANNEL_MEM_HEAP
            if ( st_ivas->hDecoderConfig->Opt_tsm )
            {
@@ -2883,6 +2891,23 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure(
            nsamp_to_allocate = hTcBuffer->nchan_buffer_full * n_samp_full;
            nsamp_to_allocate += nchan_residual * n_samp_residual;

#ifdef REMOVE_5MS_FLAG
            if ( nsamp_to_allocate == 0 )
            {
                hTcBuffer->tc_buffer = NULL;
                for ( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS
#ifdef JBM_FOR_OSBA
                                               + MAX_NUM_OBJECTS
#endif
                      ;
                      ch_idx++ )
                {
                    hTcBuffer->tc[ch_idx] = NULL;
                }
            }
            else
            {
#endif
                if ( ( hTcBuffer->tc_buffer = (float *) malloc( nsamp_to_allocate * sizeof( float ) ) ) == NULL )
                {
                    return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM TC Buffer\n" ) );
@@ -2909,6 +2934,9 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure(
                {
                    hTcBuffer->tc[ch_idx] = NULL;
                }
#ifdef REMOVE_5MS_FLAG
            }
#endif
#ifdef UNIFY_CHANNEL_MEM_HEAP
        }
    }