[processor-sdk/performance-audio-sr.git] / processor_audio_sdk_1_00_00_00 / pasdk / test_dsp / framework / audioStreamOutProc.c
diff --git a/processor_audio_sdk_1_00_00_00/pasdk/test_dsp/framework/audioStreamOutProc.c b/processor_audio_sdk_1_00_00_00/pasdk/test_dsp/framework/audioStreamOutProc.c
index 7d0b61271fe644663849a3fb7098e0d4b459cafa..6438e654f71fd3f6039d1bba768f6becc0993326 100644 (file)
&gPAF_AST_config // pAstCfg
};
+// Underflow threshold before returning error to Top-Level FSM
+#define DEC_OP_CB_RDAF_UND_THR ( 20 ) // FL: arbitrary setting
+UInt32 gDecOpCbRdAfUnd =0; // decoder output circular buffer underflow count
+
// Global debug counters */
UInt32 gTaskAsopCnt=0; // debug
UInt32 gAsopInitCnt =0;
Int zS = pP->streamsFromDecodes[z];
//
- // (***) FL: read circular buffer
+ // Read decoder output circular buffer
//
pAfRd = pAstCfg->xStr[zS].pAudioFrame;
cbErrno = cbReadAf(pCbCtl, z, pAfRd);
{
TRACE_TERSE1("PAF_ASOT_decodeStream:cbReadAf() error=%d", cbErrno);
//SW_BREAKPOINT; // FL: debug
- //return cbErrno; // (***) FL: ignoring read failures??
+
+ if (cbErrno == ASP_DECOP_CB_READ_UNDERFLOW)
+ {
+ // Reset circular buffer
+ cbReset(pCbCtl, z);
+
+ // Update underflow count, return if above threshold
+ gDecOpCbRdAfUnd++;
+ if (gDecOpCbRdAfUnd == DEC_OP_CB_RDAF_UND_THR)
+ {
+ gDecOpCbRdAfUnd = 0;
+ return cbErrno;
+ }
+ }
}
//Log_info0("PAF_ASOT_decodeStream:cbReadAf() complete.");