Commit 1d16d63a authored by vaclav's avatar vaclav
Browse files

FIX_FMSW_DEC_2

parent 41b03f2f
Loading
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -3399,6 +3399,15 @@ static ivas_error decodeVoIP(

        /* EVS RTP payload format has timescale 16000, JBM uses 1000 internally */
        rtpTimeStamp = rtpTimeStamp / 16;

#ifdef FIX_FMSW_DEC_2
        arg.decMode = ( ivasRtp.codecId == IVAS_RTP_EVS ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS;
        if ( ( error = IVAS_DEC_Restart( hIvasDec, arg.decMode ) ) != IVAS_ERR_OK ) /* note: when the RTP bitstream starts with EVS, do the restart */
        {
            fprintf( stderr, "\nIVAS_DEC_Restart restart failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }
#endif
    }
    if ( error != IVAS_ERR_OK )
    {
+1 −0
Original line number Diff line number Diff line
@@ -176,6 +176,7 @@
#define FIX_FLOAT_1569_REND_RENDER_CONFIG_CHECKS        /* Nokia: float issue 1569: fix render config checks in renderer */
#define FIX_1571_BFI_COPY_ARRAY_CORRECT_LEN             /* FhG: issue 1571: use correct channel signal length for copying signal to buffer */
#define FIX_FMSW_DEC                                    /* float issue 1542: fix JBM issue in format switching */
#define FIX_FMSW_DEC_2                                  /* float issue 1575: fix crash for format switching when bitsream starts with EVS */

/* ##################### End NON-BE switches ########################### */

+33 −2
Original line number Diff line number Diff line
@@ -161,6 +161,12 @@ static ivas_error ivas_dec_handle_init(
    st_ivas->writeFECoffset = 0;
    st_ivas->sba_analysis_order = 0; /* not really used in EVS mode, but initialize here to fix MSAN complaint */

#ifdef FIX_FMSW_DEC_2
    st_ivas->last_ivas_format = UNDEFINED_FORMAT;
    st_ivas->nSCE = 0;
    st_ivas->nCPE = 0;

#endif
    if ( mode == IVAS_DEC_MODE_EVS )
    {
        st_ivas->element_mode_init = EVS_MONO;
@@ -355,10 +361,32 @@ ivas_error IVAS_DEC_Restart(
        {
            return IVAS_ERR_OK;
        }

#ifdef FIX_FMSW_DEC_2
        else
        {
            /* switching between EVS and IVAS signaled in RTP */
            hIvasDec->st_ivas->restartNeeded = 1;
        }
#else
        return IVAS_ERR_WRONG_PARAMS;
#endif
    }

#ifdef FIX_FMSW_DEC_2
    if ( hIvasDec->mode != mode ) /* handle switching between EVS and IVAS */
    {
        /* initialize JBM */
        if ( JB4_Init( hIvasDec->hVoIP->hJBM, 60 ) != 0 )
        {
            return IVAS_ERR_FAILED_ALLOC;
        }

        hIvasDec->hasBeenFedFirstGoodFrame = false;
        hIvasDec->hasDecodedFirstGoodFrame = false;
        hIvasDec->isInitialized = false;
    }

#endif
    hIvasDec->mode = mode;

    /* destroy Split binaural renderer (ISAR) handle */
@@ -4002,7 +4030,7 @@ static ivas_error ivas_dec_voip_get_samples_common(
            nSamplesBuffered = 0;
            if ( hIvasDec->hasBeenFedFirstGoodFrame )
            {
                /* check if the TC buffer already exists, otherweise nothing is buffered anyway */
                /* check if the TC buffer already exists, otherwise nothing is buffered anyway */
                if ( st_ivas->hTcBuffer != NULL )
                {
                    nSamplesBuffered = st_ivas->hTcBuffer->n_samples_buffered - st_ivas->hTcBuffer->n_samples_rendered;
@@ -4930,6 +4958,9 @@ static ivas_error evs_dec_main(
    }

    st_ivas->BER_detect = hCoreCoder[0]->BER_detect;
#ifdef FIX_FMSW_DEC
    st_ivas->last_ivas_format = MONO_FORMAT;
#endif

    if ( st_ivas->hDecoderConfig->Opt_tsm && st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_MONO )
    {