diff --git a/pasdk/test_dsp/framework/audioStreamOutProc.c b/pasdk/test_dsp/framework/audioStreamOutProc.c
index 2395334e7899a833b0aee625d52d69fbbb95392f..3cbf034f3541dad7dd139b4846e3da96fe32db13 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
+// Underflow threshold before circular buffer reset and return error to Top-Level FSM
+#define DEC_OP_CB_RDAF_UND_THR ( 80 ) // FL: arbitrary setting
+UInt32 gCbReadAfErr =0; // read circular buffer error count, not including underflows
+UInt32 gDecOpCbRdAfUnd =0; // decoder output circular buffer underflow count
+UInt32 gMaxDecOpCbRdAfUnd =0; // max (consecutive) decoder output circular buffer underflow count
// Global debug counters */
UInt32 gTaskAsopCnt=0; // debug
-UInt32 gAsopInitCnt =0;
-UInt32 gAsopStreamCnt =0;
-UInt32 gAsopEncodeCnt =0;
-UInt32 gAsopFinalCnt =0;
-UInt32 gAsopQuitCnt =0;
-//debug
-UInt32 gCbReadAfErr =0;
+UInt32 gAsopInitCnt =0;
+UInt32 gAsopStreamCnt =0;
+UInt32 gAsopEncodeCnt =0;
+UInt32 gAsopFinalCnt =0;
+UInt32 gAsopQuitCnt =0;
// FL: (***) debug
#include "evmc66x_gpio_dbg.h"
SW_BREAKPOINT; // FL: debug
return errno;
}
+ gCbReadAfErr=0; // reset read circular buffer error count
+ gDecOpCbRdAfUnd=0; // reset decoder output circular buffer underflow count
+ gMaxDecOpCbRdAfUnd=0; // reset max decoder output circular buffer underflow count
+
// FL: debug
cbLog(pCbCtl, z, 1, "PAF_ASOT_decodeInit:cbReadStart");
}
}
}
+
return 0;
}
//
pAfRd = pAstCfg->xStr[zS].pAudioFrame;
cbErrno = cbReadAf(pCbCtl, z, pAfRd);
- if (cbErrno != 0)
+ if ((cbErrno < 0) && (cbErrno != ASP_DECOP_CB_READ_UNDERFLOW))
{
gCbReadAfErr++;
TRACE_TERSE1("PAF_ASOT_decodeStream:cbReadAf() error=%d", cbErrno);
//SW_BREAKPOINT; // FL: debug
+ return cbErrno;
+ }
+
+ // Handle underflows
+ if (cbErrno == ASP_DECOP_CB_READ_UNDERFLOW)
+ {
+ // FL: some number of underflows alway occur on start of stream when ASOT only depends on configured Output.
+ // DDP: ~2 underflows
+ // MAT-THD: ~16 underflows
+ // Need to check behavior of cbReset().
+ // Need to check behavior on exit/re-entry into Output processing.
- if (cbErrno == ASP_DECOP_CB_READ_UNDERFLOW)
+ gDecOpCbRdAfUnd++; // increment circular buffer underflow count
+ if (gDecOpCbRdAfUnd >= DEC_OP_CB_RDAF_UND_THR)
{
+ // Underflow count above threshold.
+ // (1) set max underflow count to threshold
+ // (2) reset underflow count
+ // (3) reset circular buffer
+
+ gMaxDecOpCbRdAfUnd = DEC_OP_CB_RDAF_UND_THR; // update max underflow count
+ gDecOpCbRdAfUnd = 0; // reset underflow count
+
// Reset circular buffer
- //cbReset(pCbCtl, z);
- //Log_info0("PAF_ASOT_decodeStream:cbReset");
-
- // Update underflow count, return if above threshold
- gDecOpCbRdAfUnd++;
- //if (gDecOpCbRdAfUnd == DEC_OP_CB_RDAF_UND_THR)
- //{
- // gDecOpCbRdAfUnd = 0;
- // return cbErrno;
- //}
+ cbReset(pCbCtl, z);
+ Log_info0("PAF_ASOT_decodeStream:cbReset");
+
+ return cbErrno;
+ }
+ }
+ else if ((cbErrno == ASP_DECOP_CB_SOK) && (gDecOpCbRdAfUnd > 0))
+ {
+ // No underflow detected.
+ // update max underflow count,
+ // reset underflow count
+
+ // update max underflow count
+ if (gDecOpCbRdAfUnd > gMaxDecOpCbRdAfUnd)
+ {
+ gMaxDecOpCbRdAfUnd = gDecOpCbRdAfUnd;
}
+ gDecOpCbRdAfUnd = 0; // reset circular buffer underflow count
}
//Log_info0("PAF_ASOT_decodeStream:cbReadAf() complete.");
}
// TODO: use pC->xOut[z].pOutBuf in following ->encode call
-#if 1 // (***) FL: shows timing of Input Rx SIO reclaim after decoding has started (autodet complete)
+#if 0 // (***) FL: shows timing of Input Rx SIO reclaim after decoding has started (autodet complete)
// (***) debug // B8
{
static Uint8 toggleState = 0;