From e736f91c0361099a85619a2b83340c98e2be04e6 Mon Sep 17 00:00:00 2001 From: Konstantin Date: Tue, 14 Feb 2023 20:54:54 +0100 Subject: When token timestamps are requested, disabled streaming in C++ CLI example --- Examples/main/main.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'Examples') diff --git a/Examples/main/main.cpp b/Examples/main/main.cpp index 7706b8f..28dcada 100644 --- a/Examples/main/main.cpp +++ b/Examples/main/main.cpp @@ -277,16 +277,22 @@ int wmain( int argc, wchar_t* argv[] ) wparams.encoder_begin_callback_user_data = &is_aborted; } -#if STREAM_AUDIO - ComLight::CComPtr reader; - CHECK( mf->openAudioFile( fname.c_str(), params.diarize, &reader ) ); - sProgressSink progressSink{ nullptr, nullptr }; - hr = context->runStreamed( wparams, progressSink, reader ); -#else - ComLight::CComPtr buffer; - CHECK( mf->loadAudioFile( fname.c_str(), params.diarize, &buffer ) ); - hr = context->runFull( wparams, buffer ); -#endif + if( STREAM_AUDIO && !wparams.flag( eFullParamsFlags::TokenTimestamps ) ) + { + ComLight::CComPtr reader; + CHECK( mf->openAudioFile( fname.c_str(), params.diarize, &reader ) ); + sProgressSink progressSink{ nullptr, nullptr }; + hr = context->runStreamed( wparams, progressSink, reader ); + } + else + { + // Token-level timestamps feature is not currently implemented when streaming the audio + // When these timestamps are requested, fall back to buffered mode. + ComLight::CComPtr buffer; + CHECK( mf->loadAudioFile( fname.c_str(), params.diarize, &buffer ) ); + hr = context->runFull( wparams, buffer ); + } + if( FAILED( hr ) ) { printError( "Unable to process audio", hr ); -- cgit v1.2.3