Commit 37f235fe authored by TYAGIRIS's avatar TYAGIRIS
Browse files

Merge branch '1293-decoder-crash-with-new-error-pattern-which-starts-with-a-lost-frame' into 'main'

Resolve "Decoder crash with new error pattern (which starts with a lost frame)"

See merge request !2047
parents e993acc0 aaa90769
Loading
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -985,6 +985,9 @@ int main(

    while ( 1 )
    {
#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
        int16_t bfi = 0;
#endif
        int16_t num_in_channels;
        num_in_channels = inBuffer.config.numChannels;

@@ -993,7 +996,11 @@ int main(
        {
            ivas_error error_tmp;
            numSamplesRead = (int16_t) inBufferSize;
#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
            error_tmp = split_rend_read_bits_from_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten, &bfi );
#else
            error_tmp = split_rend_read_bits_from_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten );
#endif
            if ( error_tmp != IVAS_ERR_OK )
            {
                if ( error_tmp == IVAS_ERR_END_OF_FILE )
@@ -1060,19 +1067,33 @@ int main(
        /* Read from split renderer bfi file if specified */
        if ( splitRendBFIReader != NULL && splitBinNeedsNewFrame )
        {
#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST
            int16_t bfi;
#endif
            if ( ( error = SplitRendBFIFileReading( splitRendBFIReader, &bfi ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError in SplitRendBFIFileReading(): %s\n", ivas_error_to_string( error ) );
                goto cleanup;
            }

#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST
            if ( ( error = ISAR_POST_REND_SetSplitRendBFI( hIsarPostRend, bfi ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "Error in ISAR_POST_REND_SetSplitRendBFI(): %s\n", ivas_error_to_string( error ) );
                exit( -1 );
            }
#endif
        }
#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
        if ( splitBinNeedsNewFrame )
        {
            if ( ( error = ISAR_POST_REND_SetSplitRendBFI( hIsarPostRend, bfi ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError in ISAR_POST_REND_SetSplitRendBFI(): %s\n", ivas_error_to_string( error ) );
                goto cleanup;
            }
        }
#endif

        for ( i = 0; i < args.inConfig.numBinBuses; ++i )
        {
+1 −0
Original line number Diff line number Diff line
@@ -173,6 +173,7 @@

#define NONBE_1244_FIX_SWB_BWE_MEMORY                   /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ 
#define NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING           /* Ericsson: issue 1180, corrected long term mute loop attnuation after 200ms  in PhECU-PLC  */
#define NONBE_1293_CRASH_FIRST_FRAME_LOST               /* VA: issue 1293: fix G.192 decoder crash when first frame is lost */
#define NONBE_FIX_1297_SPAR_JBM_MEM_SAN                 /*Dolby: issue 1297, SPAR + JBM + BR switch memory sanitizer*/  
#define NONBE_1289_STEREO_SW_TO_MONO                    /* VA: issue 1289: Fix glitch when stereo signal is decoded to mono n TD->DFT switching */
#define NONBE_1122_JBM_FIX_PLAYOUT_DELAY_IN_DTX         /* FhG: Avoid JBM ignoring safety margin and setting playout delay to 0 during DTX */
+41 −1
Original line number Diff line number Diff line
@@ -1094,6 +1094,13 @@ ivas_error IVAS_DEC_GetSamplesDecoder(
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
    }

#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
    if ( !hIvasDec->hasBeenFedFirstGoodFrame && !hIvasDec->isInitialized ) /* note: 'isInitialized' is related to EVS decoder */
    {
        return IVAS_ERR_OK;
    }
#endif

    /* If TSM is generally enabled, we have to wait for the first good frame.
               Otherwise, we directly decode the first frame in any case. */
    if ( !hIvasDec->isInitialized || hIvasDec->hasBeenFedFrame )
@@ -1234,6 +1241,15 @@ ivas_error IVAS_DEC_GetEditableParameters(
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
    }

#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
    if ( !hIvasDec->hasBeenFedFirstGoodFrame )
    {
        hIvasEditableParameters->num_obj = 0;

        return IVAS_ERR_OK;
    }
#endif

    st_ivas = hIvasDec->st_ivas;
    ism_mode = st_ivas->ism_mode;

@@ -1373,6 +1389,13 @@ ivas_error IVAS_DEC_SetEditableParameters(
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
    }

#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
    if ( !hIvasDec->hasBeenFedFirstGoodFrame )
    {
        return IVAS_ERR_OK;
    }
#endif

    st_ivas = hIvasDec->st_ivas;
    ism_mode = st_ivas->ism_mode;

@@ -1606,7 +1629,12 @@ ivas_error IVAS_DEC_PrepareRenderer(
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
    }

#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
    if ( hIvasDec->hasBeenFedFirstGoodFrame || hIvasDec->isInitialized ) /* note: 'isInitialized' is related to EVS decoder */
#endif
    {
        ivas_dec_prepare_renderer( hIvasDec->st_ivas );
    }

    hIvasDec->hasBeenPreparedRendering = true;

@@ -1743,9 +1771,14 @@ ivas_error IVAS_DEC_GetSamplesRenderer(
        {
            *needNewFrame = false;
        }
#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
        *nOutSamples = nSamplesRendered;
#endif
    }

#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST
    *nOutSamples = nSamplesRendered;
#endif

    return IVAS_ERR_OK;
}
@@ -1849,6 +1882,13 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(
        return error;
    }

#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
    if ( !hIvasDec->hasBeenFedFirstGoodFrame )
    {
        return IVAS_ERR_OK;
    }
#endif

    /* change buffer layout */
    for ( i = 0; i < numSamplesPerChannelToDecode; ++i )
    {
+11 −0
Original line number Diff line number Diff line
@@ -1539,6 +1539,17 @@ static ivas_error renderSplitBinauralWithPostRot(
    }
    else
    {
#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
        if ( splitBinInput->numCachedSamples == 0 )
        {
            numSamplesPerChannelCacheSize = (int16_t) ( *splitBinInput->base.ctx.pOutSampleRate * bits.isar_frame_size_ms / 1000 ) - outAudio.config.numSamplesPerChannel;
            splitBinInput->numCachedSamples = numSamplesPerChannelCacheSize;
        }
        else
        {
            splitBinInput->numCachedSamples -= outAudio.config.numSamplesPerChannel;
        }
#endif
        if ( splitBinInput->base.inConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED )
        {
            for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ )
+16 −0
Original line number Diff line number Diff line
@@ -331,11 +331,20 @@ ivas_error split_rend_write_bitstream_to_file(
 *
 *-----------------------------------------------------------------------------------------*/

#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
ivas_error split_rend_read_bits_from_file(
    SplitFileReadWrite *hSplitRendFileReadWrite,
    uint8_t *bits,
    int32_t *bits_read,
    int32_t *bits_written,
    int16_t *bfi )
#else
ivas_error split_rend_read_bits_from_file(
    SplitFileReadWrite *hSplitRendFileReadWrite,
    uint8_t *bits,
    int32_t *bits_read,
    int32_t *bits_written )
#endif
{
    char header[SPLIT_RENDERER_FRAME_HEADER_LEN] = "SPLIT_FRAME";
    char header_read[SPLIT_RENDERER_FRAME_HEADER_LEN];
@@ -398,6 +407,13 @@ ivas_error split_rend_read_bits_from_file(

    *bits_read = 0;
    *bits_written = bit_len;
#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
    *bfi = 0;
    if ( bit_len == 0 )
    {
        *bfi = 1;
    }
#endif

    return IVAS_ERR_OK;
}
Loading