Commit c0d04d8d authored by TYAGIRIS's avatar TYAGIRIS
Browse files

add tc buffer NULL check in ivas_crend

parent aa1d6f09
Loading
Loading
Loading
Loading
+32 −11
Original line number Diff line number Diff line
@@ -1956,6 +1956,8 @@ ivas_error ivas_rend_crendProcessSubframe(
        p_pcm_tmp[ch] = pcm_tmp[ch];
    }

    if ( hTcBuffer != NULL )
    {
        slot_size = hTcBuffer->n_samples_granularity;

        /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */
@@ -1968,10 +1970,21 @@ ivas_error ivas_rend_crendProcessSubframe(
            slots_to_render -= hTcBuffer->subframe_nbslots[last_sf];
            last_sf++;
        }
        subframe_len = -1; /* will be set later */
    }
    else
    {
        subframe_len = (int16_t) ( output_Fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) );
        first_sf = 0;
        last_sf = n_samples_to_render / subframe_len;
    }

    for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ )
    {
        if ( hTcBuffer != NULL )
        {
            subframe_len = hTcBuffer->subframe_nbslots[subframe_idx] * hTcBuffer->n_samples_granularity;
        }

        /* Early Reflections */
        if ( hCrend->reflections != NULL )
@@ -2040,8 +2053,12 @@ ivas_error ivas_rend_crendProcessSubframe(
            {
                p_pcm_tmp[ch] += subframe_len;
            }

            if ( hTcBuffer != NULL )
            {
                hTcBuffer->slots_rendered += hTcBuffer->subframe_nbslots[subframe_idx];
            }
        }
        else
        {
            return IVAS_ERR_INVALID_INPUT_FORMAT;
@@ -2057,7 +2074,11 @@ ivas_error ivas_rend_crendProcessSubframe(
        mvr2r( pcm_tmp[ch], output[ch], n_samples_to_render );
    }

    if ( hTcBuffer != NULL )
    {
        hTcBuffer->subframes_rendered = last_sf;
    }

    pop_wmops();

    return IVAS_ERR_OK;