diff --git a/apps/decoder.c b/apps/decoder.c index b32d9d92c82249ce3a02bb9e2e45526734a78e40..41a737c46dce8e910b02e0f11595644dc95ff2a4 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -2046,7 +2046,22 @@ static ivas_error initOnFirstGoodFrame( if ( numInitialBadFrames > 0 ) { /* Duplicate good first frame metadata to fill the beginning of stream. */ +#ifdef NONBE_FIX_1261_MASA_EXT_META_JBM + int16_t fullDelayNumSamplesLocal[3]; + int32_t delayTimeScaleLocal; + float delayMs; + IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; + hMasaExtOutMeta = NULL; + + /* fullDelayNumSamples is zeroed so need to re-fetch delay info */ + if ( ( error = IVAS_DEC_GetDelay( hIvasDec, fullDelayNumSamplesLocal, &delayTimeScaleLocal ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); + } + delayMs = (float) ( fullDelayNumSamplesLocal[0] ) / (float) ( delayTimeScaleLocal ); +#else IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta = NULL; +#endif if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK ) { @@ -2056,7 +2071,9 @@ static ivas_error initOnFirstGoodFrame( for ( int16_t j = 0; j < numInitialBadFrames; ++j ) { +#ifndef NONBE_FIX_1261_MASA_EXT_META_JBM float delayMs = (float) ( pFullDelayNumSamples[0] ) / (float) ( *delayTimeScale ); +#endif if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) ); diff --git a/lib_com/options.h b/lib_com/options.h index 08791c0959cab24b647de61b3027b6691fae8b49..a50299efb49c889371e302eb138fdef59180c31e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -164,6 +164,7 @@ #define FIX_1320_STACK_CPE_DECODER /* VA: issue 1320: Optimize the stack memory consumption in the CPE decoder */ #define NONBE_1302_FIX_OMASA_JBM_FLUSH /* VA: issue 1302: fix OMASA JBM bitrate switching flush in binaural output */ #define FIX_1319_STACK_SBA_DECODER /* VA: issue 1319: Optimize the definition of buffer lengths in the SBA decoder */ +#define NONBE_FIX_1261_MASA_EXT_META_JBM /* Nokia: issue #1261: MASA metadata EXT output delay buffer init in JBM */ /* #################### End BASOP porting switches ############################ */