Commit d6b5a1d4 authored by sagnowski's avatar sagnowski
Browse files

Do not try to render ISMs if there are none to render

parent c9d35820
Loading
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -6357,9 +6357,24 @@ static ivas_error renderActiveInputsIsm(
    input_ism *pCurrentInput;
    ivas_error error;
#ifdef FIX_BASOP_2436_REUSED_CLDFB_IN_OMASA_SR
    int16_t num_active_inputs;
    IVAS_REND_AudioBuffer work_buffer;
    float tmp_td_binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS * L_FRAME48k];

    // Early return in case there are no active ISM inputs
    num_active_inputs = 0;
    for ( i = 0, pCurrentInput = hIvasRend->inputsIsm; i < RENDERER_MAX_ISM_INPUTS; ++i, ++pCurrentInput )
    {
        if ( pCurrentInput->base.inConfig != IVAS_AUDIO_CONFIG_INVALID )
        {
            ++num_active_inputs;
        }
    }
    if ( num_active_inputs == 0 )
    {
        return IVAS_ERR_OK;
    }

    // By default (TD output), use outAudio as work_buffer. This means we render individual ISMs
    // directly to outAudio, since the `data` member of both these structs is pointing to the same memory.
    // Initializing this way also fixes MSVC's false-positive warning about work_buffer being used