Commit 5000adfe authored by vaclav's avatar vaclav
Browse files

fix SBA constant bitrate DTX crash

parent 113ffe1f
Loading
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -493,7 +493,7 @@ ivas_error ivas_sba_dec_reconfigure(
            st_ivas->hSpar->i_subframe = 0;
        }

        if ( st_ivas->hSpar == NULL )
        if ( st_ivas->hSpar == NULL && st_ivas->sba_mode == SBA_MODE_SPAR )
        {
            if ( ( error = ivas_spar_dec_open( st_ivas ) ) != IVAS_ERR_OK )
            {
@@ -506,7 +506,7 @@ ivas_error ivas_sba_dec_reconfigure(
        sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER );
        ivas_spar_config( ivas_total_brate, sba_order_internal, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->hSpar->core_nominal_brate, st_ivas->sid_format );

        if ( st_ivas->hDirAC == NULL )
        if ( st_ivas->hDirAC == NULL && st_ivas->sba_mode == SBA_MODE_DIRAC )
        {
            if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK )
            {
@@ -514,10 +514,13 @@ ivas_error ivas_sba_dec_reconfigure(
            }
        }

        if ( st_ivas->hDirAC != NULL )
        {
            ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE_MODE );

            mvs2s( st_ivas->hDirAC->dirac_to_spar_md_bands, st_ivas->hSpar->dirac_to_spar_md_bands, DIRAC_MAX_NBANDS );
            st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band;
        }

        if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, st_ivas->sba_mode, IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) != IVAS_ERR_OK )
        {
@@ -535,10 +538,9 @@ ivas_error ivas_sba_dec_reconfigure(
    }
#else

    ivas_sba_config( sba_total_brate, st_ivas->sba_analysis_order, -1, &nchan_transport, st_ivas->sba_planar, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init );

    st_ivas->nchan_transport = nchan_transport;
    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 );
#endif

    /*-----------------------------------------------------------------*
     * Renderer selection
     *-----------------------------------------------------------------*/