summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f0d81e7)
raw | patch | inline | side by side (parent: f0d81e7)
author | Frank Livingston <frank-livingston@ti.com> | |
Wed, 1 Mar 2017 19:13:18 +0000 (13:13 -0600) | ||
committer | Frank Livingston <frank-livingston@ti.com> | |
Wed, 1 Mar 2017 19:13:18 +0000 (13:13 -0600) |
pasdk/test_arm/framework/audioStreamDecodeProc.c | patch | blob | history |
diff --git a/pasdk/test_arm/framework/audioStreamDecodeProc.c b/pasdk/test_arm/framework/audioStreamDecodeProc.c
index e4a25538d81f1d38655c995b91322caf6f54d471..3ed8e1483f8118f7abce63dc1bc535fa8a092c73 100644 (file)
PAF_AudioSize gDecAudioFrameChannelSizes[PAF_MAXNUMCHAN_AF];
PAF_AudioData *gDecOrigAudioFrameChannelPointers[PAF_MAXNUMCHAN_AF];
-// Underflow threshold before circular buffer reset and return error to Top-Level FSM
+// Overflow threshold before circular buffer reset and return error to Top-Level FSM
#define DEC_OP_CB_WRTAF_OVR_THR ( 20 ) // FL: arbitrary setting
-UInt32 gDecOpCbWrtAfOvr =0; // decoder output circular buffer overflow count
+UInt32 gCbWrtAfErrCnt =0; // decoder output circular buffer write error count, not including overflows
+UInt32 gDecOpCbWrtAfOvr =0; // decoder output circular buffer overflow count
+UInt32 gMaxDecOpCbWrtAfOvr =0; // max (consecutive) decoder output circular buffer overflow count
// Global debug counters */
UInt32 gSlaveStartErrCnt =0;
UInt32 gSlaveDecDecodeCnt =0;
UInt32 gSlaveDecDeactivateCnt =0;
-// debug
-UInt32 gCbWrtAfErrCnt =0; // decoder output circular buffer write error count
// FL: (***) debug
#include "evmc66x_gpio_dbg.h"
{
SW_BREAKPOINT;
}
- gCbWrtAfErrCnt=0; // debug
- gDecOpCbWrtAfOvr=0; // decoder output circular buffer overflow count
+ gCbWrtAfErrCnt=0; // reset write circular buffer error count
+ gDecOpCbWrtAfOvr=0; // reset decoder output circular buffer overflow count
+ gMaxDecOpCbWrtAfOvr=0; // reset max decoder output circular buffer overflow count
// FL: debug, log circular buffer control variables
cbLog(pCbCtl, z, 1, "cbWriteStart");
// Reset audio frame
//}
cbErrno = cbWriteAf(pCbCtl, z, pAfWrt);
- if (cbErrno < 0)
+ if ((cbErrno < 0) && (cbErrno != ASP_DECOP_CB_WRITE_OVERFLOW))
{
gCbWrtAfErrCnt++;
//SW_BREAKPOINT; // FL: debug
+ }
+
+ // Handle overflows
+ if (cbErrno == ASP_DECOP_CB_WRITE_OVERFLOW)
+ {
+ gDecOpCbWrtAfOvr++; // increment circular buffer overflow count
+ if (gDecOpCbWrtAfOvr >= DEC_OP_CB_WRTAF_OVR_THR)
+ {
+ gMaxDecOpCbWrtAfOvr = DEC_OP_CB_WRTAF_OVR_THR; // update max overflow count
+ gDecOpCbWrtAfOvr = 0; // reset overflow count
+
+ // Reset circular buffer
+ cbReset(pCbCtl, z);
+ }
+ }
+ else if ((cbErrno == ASP_DECOP_CB_SOK) && (gDecOpCbWrtAfOvr > 0))
+ {
+ // No overflow detected.
+ // update max overflow count,
+ // reset overflow count
- if (cbErrno == ASP_DECOP_CB_WRITE_OVERFLOW)
+ if (gDecOpCbWrtAfOvr > gMaxDecOpCbWrtAfOvr)
{
- // Update underflow count.
- // If above underflow threshold, reset circular buffer underflow count.
- gDecOpCbWrtAfOvr++;
- if (gDecOpCbWrtAfOvr < DEC_OP_CB_WRTAF_OVR_THR)
- {
- cbErrno = 0;
- }
- else
- {
- // Reset circular buffer
- cbReset(pCbCtl, z);
- gDecOpCbWrtAfOvr = 0; // reset underflow count
- }
+ gMaxDecOpCbWrtAfOvr = gDecOpCbWrtAfOvr;
}
+ gDecOpCbWrtAfOvr = 0; // reset circular buffer overflow count
+
+ cbErrno = 0; // don't return error condition
}
TRACE_TERSE0("Dec:cbWriteAf() complete");
}
#endif
-
// FL: debug, log circular buffer control variables
cbLog(pCbCtl, z, 1, "cbWriteAf");
}