Commit 9cb5d2ce authored by vaclav's avatar vaclav
Browse files

replace IVAS_DEC_GetPcmFrameSize() by IVAS_DEC_GetOutputBufferSize(); revision...

replace IVAS_DEC_GetPcmFrameSize() by IVAS_DEC_GetOutputBufferSize(); revision of function description; formatting
parent 8807eab6
Loading
Loading
Loading
Loading
Loading
+34 −1
Original line number Diff line number Diff line
@@ -760,6 +760,13 @@ int main(
    }

    pcmBuf = malloc( pcmBufSize * sizeof( int16_t ) );
#ifdef LIB_DEC_REVISION
    if ( pcmBuf == NULL )
    {
        fprintf( stdout, "Error: Unable to allocate memory for output buffer.\n" );
        goto cleanup;
    }
#endif

    /*-----------------------------------------------------------------*
     * Decoding
@@ -1807,14 +1814,16 @@ static ivas_error initOnFirstGoodFrame(
        return error;
    }

#ifndef LIB_DEC_REVISION
    int32_t pcmFrameSize;

    if ( ( error = IVAS_DEC_GetPcmFrameSize( hIvasDec, &pcmFrameSize ) ) != IVAS_ERR_OK )

    {
        fprintf( stderr, "\nError in IVAS_DEC_GetPcmFrameSize, error code: %d\n", error );
        return error;
    }

#endif
    if ( isSplitRend )
    {
        /* Open split rendering metadata writer */
@@ -1872,7 +1881,23 @@ static ivas_error initOnFirstGoodFrame(
        }
    }

#ifdef LIB_DEC_REVISION
    int16_t pcmFrameSize;
    if ( ( error = IVAS_DEC_GetOutputBufferSize( hIvasDec, &pcmFrameSize ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nError in IVAS_DEC_GetOutputBufferSize, error code: %d\n", error );
        return error;
    }

#endif
    int16_t *zeroBuf = malloc( pcmFrameSize * sizeof( int16_t ) );
#ifdef LIB_DEC_REVISION
    if ( zeroBuf == NULL )
    {
        fprintf( stdout, "Error: Unable to allocate memory for output buffer.\n" );
        return IVAS_ERR_FAILED_ALLOC;
    }
#endif
    memset( zeroBuf, 0, pcmFrameSize * sizeof( int16_t ) );

    for ( int16_t i = 0; i < numInitialBadFrames; ++i )
@@ -3400,7 +3425,12 @@ static ivas_error decodeVoIP(
        {
            if ( ( error = IVAS_DEC_HasDecodedFirstGoodFrame( hIvasDec, &decodedGoodFrame ) ) != IVAS_ERR_OK )
            {
#ifdef LIB_DEC_REVISION
                fprintf( stderr, "Error in IVAS_DEC_HasDecodedFirstGoodFrame(): %s\n", IVAS_DEC_GetErrorMessage( error ) );
#else
                fprintf( stderr, "Error in IVAS_DEC_HasDecodedFirstGoodFrame, code: %d\n", error );

#endif
                goto cleanup;
            }

@@ -3412,6 +3442,9 @@ static ivas_error decodeVoIP(
                if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, &nOutSamples, NULL, delayNumSamples_orig, &delayNumSamples, &delayTimeScale,
                                                     &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj, &splitRendWriter ) ) != IVAS_ERR_OK )
                {
#ifdef LIB_DEC_REVISION
                    fprintf( stderr, "Error in initOnFirstGoodFrame(): %s\n", IVAS_DEC_GetErrorMessage( error ) );
#endif
                    goto cleanup;
                }
            }
+127 −81

File changed.

Preview size limit exceeded, changes collapsed.

+2 −1
Original line number Diff line number Diff line
@@ -503,12 +503,13 @@ ivas_error IVAS_DEC_HasDecodedFirstGoodFrame(
    bool *hasDecodedFirstGoodFrame              /* o  : flag indicating if the decoder has decoded a good frame since it was configured */
);

#ifndef LIB_DEC_REVISION
/*! r: error code */
ivas_error IVAS_DEC_GetPcmFrameSize(
    IVAS_DEC_HANDLE hIvasDec,                   /* i/o: IVAS decoder handle                                                     */
    int32_t *pcmFrameSize                       /* o  : total size of the PCM output frame. This takes into account the number of output channels */
);

#endif
/*! r: true if decoder has no data in VoIP jitter buffer */
bool IVAS_DEC_VoIP_IsEmpty(
    IVAS_DEC_HANDLE hIvasDec,                   /* i/o: IVAS decoder handle                                                     */