Commit 31376d2b authored by Dominik Weckbecker's avatar Dominik Weckbecker 💬
Browse files

fix crash with bitrate switching

parent ab3c74c3
Loading
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -2204,7 +2204,14 @@ ivas_error ivas_init_decoder(

    if ( !st_ivas->hDecoderConfig->Opt_5ms )
    {
        for ( n = 0; n < ivas_get_nchan_buffers_dec( st_ivas ); n++ )
        for ( n = 0; n < ivas_get_nchan_buffers_dec( st_ivas
#ifdef NONBE_FIX_798_OSBA_MC_DEC_CRASH
                                                     ,
                                                     st_ivas->sba_analysis_order,
                                                     st_ivas->hDecoderConfig->ivas_total_brate
#endif
                         );
              n++ )
        {
            /* note: these are intra-frame heap memories */
            if ( ( st_ivas->p_output_f[n] = (float *) malloc( ( 48000 / FRAMES_PER_SEC ) * sizeof( float ) ) ) == NULL )
+14 −2
Original line number Diff line number Diff line
@@ -81,7 +81,13 @@ static ivas_error ivas_ism_bitrate_switching_dec(
    st_ivas->ism_mode = last_ism_mode;
    ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old );
    st_ivas->ism_mode = ism_mode;
    nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas );
    nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas
#ifdef NONBE_FIX_798_OSBA_MC_DEC_CRASH
                                                     ,
                                                     st_ivas->sba_analysis_order,
                                                     st_ivas->hDecoderConfig->ivas_total_brate
#endif
    );

    if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->nchan_ism, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL,
                                    0 ) ) != IVAS_ERR_OK )
@@ -350,7 +356,13 @@ static ivas_error ivas_ism_bitrate_switching_dec(

    if ( !st_ivas->hDecoderConfig->Opt_5ms )
    {
        nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas );
        nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas
#ifdef NONBE_FIX_798_OSBA_MC_DEC_CRASH
                                                     ,
                                                     st_ivas->sba_analysis_order,
                                                     st_ivas->hDecoderConfig->ivas_total_brate
#endif
        );

        if ( nchan_out_buff > nchan_out_buff_old )
        {
+8 −1
Original line number Diff line number Diff line
@@ -483,7 +483,14 @@ void ivas_mc_paramupmix_dec(
        }
    }

    for ( ch = first_empty_channel; ch < ivas_get_nchan_buffers_dec( st_ivas ); ch++ )
    for ( ch = first_empty_channel; ch < ivas_get_nchan_buffers_dec( st_ivas
#ifdef NONBE_FIX_798_OSBA_MC_DEC_CRASH
                                                                     ,
                                                                     st_ivas->sba_analysis_order,
                                                                     st_ivas->hDecoderConfig->ivas_total_brate
#endif
                                         );
          ch++ )
    {
        set_f( output_f[ch], 0.0f, output_frame );
    }
+14 −2
Original line number Diff line number Diff line
@@ -181,7 +181,13 @@ ivas_error ivas_omasa_dec_config(
    ivas_format_orig = st_ivas->ivas_format;
    st_ivas->ivas_format = st_ivas->last_ivas_format;
    ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old );
    nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas );
    nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas
#ifdef NONBE_FIX_798_OSBA_MC_DEC_CRASH
                                                     ,
                                                     st_ivas->sba_analysis_order,
                                                     st_ivas->hDecoderConfig->ivas_total_brate
#endif
    );
    st_ivas->ivas_format = ivas_format_orig;

    nSCE_old = st_ivas->nSCE;
@@ -414,7 +420,13 @@ ivas_error ivas_omasa_dec_config(

        if ( !st_ivas->hDecoderConfig->Opt_5ms )
        {
            nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas );
            nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas
#ifdef NONBE_FIX_798_OSBA_MC_DEC_CRASH
                                                         ,
                                                         st_ivas->sba_analysis_order,
                                                         st_ivas->hDecoderConfig->ivas_total_brate
#endif
            );

            if ( nchan_out_buff > nchan_out_buff_old )
            {
+20 −2
Original line number Diff line number Diff line
@@ -112,6 +112,9 @@ ivas_error ivas_sba_dec_reconfigure(
    int32_t last_ivas_total_brate;
    int16_t num_channels, num_md_sub_frames;
    int16_t ch, nchan_out_buff, nchan_out_buff_old;
#ifdef NONBE_FIX_798_OSBA_MC_DEC_CRASH
    int16_t sba_analysis_order_old;
#endif
    DECODER_CONFIG_HANDLE hDecoderConfig;
    ivas_error error;
    ISM_MODE ism_mode_old;
@@ -122,6 +125,9 @@ ivas_error ivas_sba_dec_reconfigure(
    hDecoderConfig = st_ivas->hDecoderConfig;
    ivas_total_brate = hDecoderConfig->ivas_total_brate;
    last_ivas_total_brate = st_ivas->last_active_ivas_total_brate;
#ifdef NONBE_FIX_798_OSBA_MC_DEC_CRASH
    sba_analysis_order_old = ivas_sba_get_analysis_order( last_ivas_total_brate, st_ivas->sba_order );
#endif

    /*-----------------------------------------------------------------*
     * Set SBA high-level parameters
@@ -150,7 +156,13 @@ ivas_error ivas_sba_dec_reconfigure(
    nCPE_old = st_ivas->nCPE;
    nchan_transport_old = st_ivas->nchan_transport;
    sba_dirac_stereo_flag_old = st_ivas->sba_dirac_stereo_flag;
    nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas );
    nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas
#ifdef NONBE_FIX_798_OSBA_MC_DEC_CRASH
                                                     ,
                                                     sba_analysis_order_old,
                                                     last_ivas_total_brate
#endif
    );

    st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->sba_order );

@@ -570,7 +582,13 @@ ivas_error ivas_sba_dec_reconfigure(

    if ( !st_ivas->hDecoderConfig->Opt_5ms )
    {
        nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas );
        nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas
#ifdef NONBE_FIX_798_OSBA_MC_DEC_CRASH
                                                     ,
                                                     st_ivas->sba_analysis_order,
                                                     st_ivas->hDecoderConfig->ivas_total_brate
#endif
        );

        if ( nchan_out_buff > nchan_out_buff_old )
        {
Loading