Further cleanup of CB underflow handling
authorFrank Livingston <frank-livingston@ti.com>
Wed, 1 Mar 2017 19:12:03 +0000 (13:12 -0600)
committerFrank Livingston <frank-livingston@ti.com>
Wed, 1 Mar 2017 19:12:03 +0000 (13:12 -0600)
pasdk/test_dsp/framework/audioStreamInpProc.c
pasdk/test_dsp/framework/audioStreamOutProc.c

index a12b52214233c5a75a9a2d257826b909b6c27f73..2f2a85ea9ba9248498b6e59483bae158a5cd833d 100644 (file)
@@ -2533,7 +2533,6 @@ PAF_ASIT_decodeInit(
     Int zMI;
     ASP_Msg* pAspMsg;                   /* Messaging */
     Int argIdx;
-    Int errno;
     Int status;
 #ifdef NON_CACHE_STATUS
     Int8 tempVar8;
index 8a9220bff54fdc50431769a72cd9e2b2eb19e0c2..e53574063771b45a87dece673c4ac91a9090a6dc 100644 (file)
@@ -121,7 +121,7 @@ PAF_ASOT_Config gPAF_ASOT_config = {
 
 // 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
+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
 
@@ -1865,11 +1865,12 @@ PAF_ASOT_decodeStream(
         //
         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
@@ -1882,7 +1883,7 @@ PAF_ASOT_decodeStream(
             // 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) 
+            if (gDecOpCbRdAfUnd >= DEC_OP_CB_RDAF_UND_THR) 
             {
                 // Underflow count above threshold.
                 // (1) set max underflow count to threshold
@@ -1899,7 +1900,7 @@ PAF_ASOT_decodeStream(
                 return cbErrno;
             }
         }
-        else if (gDecOpCbRdAfUnd > 0)
+        else if ((cbErrno == ASP_DECOP_CB_SOK) && (gDecOpCbRdAfUnd > 0))
         {
             // No underflow detected.
             // update max underflow count,