diff --git a/pasdk/test_dsp/framework/audioStreamOutProc.c b/pasdk/test_dsp/framework/audioStreamOutProc.c
index b8154d2ee1deff0f6b5cee131a4ed07b0a357e98..a4827864b0d8aa74736784ba90993c3d6c30dd8a 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 gAsopFinalCnt =0;
UInt32 gAsopQuitCnt =0;
+// FL: (***) debug
+#include "evmc66x_gpio_dbg.h"
/*
* ======== taskAsopFxn ========
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");
}
// Read decoder output circular buffer
//
pAfRd = pAstCfg->xStr[zS].pAudioFrame;
+ GPIOSetOutput(GPIO_PORT_0, GPIO_PIN_106);
cbErrno = cbReadAf(pCbCtl, z, pAfRd);
+ 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.
+
+ 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");
+
+ 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
+ }
+ GPIOClearOutput(GPIO_PORT_0, GPIO_PIN_106);
+
+
+#if 0
if (cbErrno != 0)
{
TRACE_TERSE1("PAF_ASOT_decodeStream:cbReadAf() error=%d", cbErrno);
}
}
}
- //Log_info0("PAF_ASOT_decodeStream:cbReadAf() complete.");
+ GPIOClearOutput(GPIO_PORT_0, GPIO_PIN_106);
+ Log_info0("PAF_ASOT_decodeStream:cbReadAf() complete.");
+#endif
+
+
+
+#if 1 // (***) FL: shows timing of CB read
+ //// (***) debug // B8
+ //{
+ // static Uint8 toggleState = 0;
+ // if (toggleState == 0)
+ // GPIOSetOutput(GPIO_PORT_0, GPIO_PIN_106);
+ // else
+ // GPIOClearOutput(GPIO_PORT_0, GPIO_PIN_106);
+ // toggleState = ~(toggleState);
+ //}
+#endif
// FL: debug
cbLog(pCbCtl, z, 1, "PAF_ASOT_decodeStream:cbReadAf");