Commit e011bcc7 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

[fix] mono SR segfaults and post renderer crashes

parent d4365753
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -203,7 +203,11 @@ int main(
    bool mainFailed = true; /* Assume main failed until cleanup is reached without errors */
    DecArguments arg;
    ivas_error error = IVAS_ERR_UNKNOWN;
#ifdef FIX_1419_SPATIAL_UMX // not doing this can make splitRendBits.bits_written be garbage causing a garbage frame write
    ISAR_SPLIT_REND_BITS_DATA splitRendBits = { 0 };
#else
    ISAR_SPLIT_REND_BITS_DATA splitRendBits;
#endif
    uint8_t splitRendBitsBuf[ISAR_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES];

    /* Any handles that require cleanup must be declared here and initialized to NULL */
+33 −0
Original line number Diff line number Diff line
@@ -5161,16 +5161,49 @@ ivas_error IVAS_DEC_GetSplitRendBitstreamHeader(
    int16_t *pLc3plusHighRes                              /* o  : pointer to LC3plus High-Res setting   */
)
{
#ifdef FIX_1419_SPATIAL_UMX
    Decoder_Struct *st_ivas;
    int16_t cldfb_in_flag;
    int16_t pcm_out_flag;
    int16_t num_subframes;
    ISAR_SPLIT_REND_CODEC codec;
    int16_t isar_frame_size_ms;
    int16_t codec_frame_size_ms;
    ivas_error error;

#endif
    if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
    }

#ifdef FIX_1419_SPATIAL_UMX // copying blindly causes issues for VoIP, set values properly instead
    st_ivas = hIvasDec->st_ivas;
    cldfb_in_flag = ivas_dec_split_rend_cldfb_in( st_ivas->renderer_type );
    pcm_out_flag = ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0;
    num_subframes = (int16_t) st_ivas->hDecoderConfig->render_num_subframes;

    codec = st_ivas->hRenderConfig->split_rend_config.codec;
    isar_frame_size_ms = st_ivas->hRenderConfig->split_rend_config.isar_frame_size_ms;
    codec_frame_size_ms = st_ivas->hRenderConfig->split_rend_config.codec_frame_size_ms;

    if ( ( error = isar_split_rend_choose_default_codec( &codec, &isar_frame_size_ms, &codec_frame_size_ms, cldfb_in_flag, pcm_out_flag, num_subframes ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    *pCodec = codec;
    *pCodec_frame_size_ms = codec_frame_size_ms;
    *poseCorrection = st_ivas->hRenderConfig->split_rend_config.poseCorrectionMode;
    *pIsar_frame_size_ms = isar_frame_size_ms;
    *pLc3plusHighRes = st_ivas->hRenderConfig->split_rend_config.lc3plus_highres;
#else
    *pCodec = hIvasDec->st_ivas->hRenderConfig->split_rend_config.codec;
    *pCodec_frame_size_ms = hIvasDec->st_ivas->hRenderConfig->split_rend_config.codec_frame_size_ms;
    *poseCorrection = hIvasDec->st_ivas->hRenderConfig->split_rend_config.poseCorrectionMode;
    *pIsar_frame_size_ms = hIvasDec->st_ivas->hRenderConfig->split_rend_config.isar_frame_size_ms;
    *pLc3plusHighRes = hIvasDec->st_ivas->hRenderConfig->split_rend_config.lc3plus_highres;
#endif

    return IVAS_ERR_OK;
}