Commit a0213b3a authored by vaclav's avatar vaclav
Browse files

fix flush

parent d4a8eb17
Loading
Loading
Loading
Loading
Loading
+11 −3
Original line number Original line Diff line number Diff line
@@ -98,7 +98,7 @@ struct IVAS_DEC


#ifdef FIX_HRTF_LOAD
#ifdef FIX_HRTF_LOAD
    uint16_t nSamplesFlushed;
    uint16_t nSamplesFlushed;
    void *flushbuffer;
    int16_t flushbuffer[20 * 960 / 4]; // temp. hack
    IVAS_DEC_PCM_TYPE pcmType;
    IVAS_DEC_PCM_TYPE pcmType;
    bool hasBeenPreparedRendering;
    bool hasBeenPreparedRendering;
#endif
#endif
@@ -184,8 +184,9 @@ ivas_error IVAS_DEC_Open(
    hIvasDec->isInitialized = false;
    hIvasDec->isInitialized = false;
    hIvasDec->updateOrientation = false;
    hIvasDec->updateOrientation = false;
#ifdef FIX_HRTF_LOAD
#ifdef FIX_HRTF_LOAD
    hIvasDec->flushbuffer = NULL;
    //hIvasDec->flushbuffer = NULL;
    hIvasDec->pcmType = IVAS_DEC_PCM_INVALID;
    hIvasDec->pcmType = IVAS_DEC_PCM_INVALID;
    hIvasDec->pcmType = IVAS_DEC_PCM_INT16; // temp. hack
    hIvasDec->nSamplesFlushed = 0;
    hIvasDec->nSamplesFlushed = 0;
    hIvasDec->hasBeenPreparedRendering = false;
    hIvasDec->hasBeenPreparedRendering = false;
#endif
#endif
@@ -1655,6 +1656,8 @@ static ivas_error IVAS_DEC_GetRenderedSamples(
    st_ivas = hIvasDec->st_ivas;
    st_ivas = hIvasDec->st_ivas;


#ifdef FIX_HRTF_LOAD
#ifdef FIX_HRTF_LOAD
    // temp code to make HRTF changes working in the old API structure
    uint16_t nSamplesRendered_loop = 0;
    uint8_t nOutChannels = (uint8_t) st_ivas->hDecoderConfig->nchan_out;
    uint8_t nOutChannels = (uint8_t) st_ivas->hDecoderConfig->nchan_out;
    hIvasDec->hasBeenFedFrame = false;
    hIvasDec->hasBeenFedFrame = false;


@@ -1683,9 +1686,14 @@ static ivas_error IVAS_DEC_GetRenderedSamples(
        hIvasDec->nSamplesFlushed = 0;
        hIvasDec->nSamplesFlushed = 0;
    }
    }


#endif
    /* run the main IVAS decoding routine */
    error = ivas_jbm_dec_render( st_ivas, nSamplesForRendering - *nSamplesRendered, &nSamplesRendered_loop, nSamplesAvailableNext, pcm_type_API_to_internal( pcmType ), pcmBuf );

    *nSamplesRendered += nSamplesRendered_loop;
#else
    /* run the main IVAS decoding routine */
    /* run the main IVAS decoding routine */
    error = ivas_jbm_dec_render( st_ivas, nSamplesForRendering, nSamplesRendered, nSamplesAvailableNext, pcm_type_API_to_internal( pcmType ), pcmBuf );
    error = ivas_jbm_dec_render( st_ivas, nSamplesForRendering, nSamplesRendered, nSamplesAvailableNext, pcm_type_API_to_internal( pcmType ), pcmBuf );
#endif


    return error;
    return error;
}
}