PASDK-218:Add CB drained indicator to CB read
authorFrank Livingston <frank-livingston@ti.com>
Fri, 23 Jun 2017 02:43:00 +0000 (21:43 -0500)
committerFrank Livingston <frank-livingston@ti.com>
Fri, 23 Jun 2017 02:43:00 +0000 (21:43 -0500)
pasdk/test_dsp/framework/aspDecOpCircBuf_master.c
pasdk/test_dsp/framework/aspDecOpCircBuf_master.h
pasdk/test_dsp/framework/audioStreamOutProc.c

index 38b90f146ca671b223f0aa7b807ab78d548db578..d40165830109863a82893321c12b0f2f727d6383 100644 (file)
@@ -572,7 +572,8 @@ Int cbReadStop(
 Int cbReadAf(
     PAF_AST_DecOpCircBufCtl *pCbCtl,    // decoder output circular buffer control
     Int8 cbIdx,                         // decoder output circular buffer index
-    PAF_AudioFrame *pAfRd               // audio frame into which to read
+    PAF_AudioFrame *pAfRd,              // audio frame into which to read
+    Int8 *pCbDrained                    // pointer to boolean, indicates if circular buffer drained: FALSE - not drained, TRUE - drained
 )
 {
     IArg key;
@@ -583,7 +584,9 @@ Int cbReadAf(
     Int8 i;
     Int16 j;
     Int8 numMetadata = 0;
-
+    
+    *pCbDrained = 0; // initialize drained indicator
+    
     // Get gate handle
     gateHandle = pCbCtl->gateHandle;
     // Enter gate
@@ -871,6 +874,7 @@ Int cbReadAf(
         if (pCb->numAfCb <= 0)
         {
             pCb->drainFlag = 0;
+            *pCbDrained = 1; // update drained indicator
         }
     }
     
index e06c5ff3d4a49f26bfeb864d2a81d3cd7adcaf15..81104a5cda131e3958450319df99460b8405ad66 100644 (file)
@@ -76,7 +76,8 @@ Int cbReadStop(
 Int cbReadAf(
     PAF_AST_DecOpCircBufCtl *pCbCtl,    // decoder output circular buffer control
     Int8 cbIdx,                         // decoder output circular buffer index
-    PAF_AudioFrame *pAfRd               // audio frame into which to read
+    PAF_AudioFrame *pAfRd,              // audio frame into which to read
+    Int8 *pCbDrained                    // pointer to boolean, indicates if circular buffer drained: FALSE - not drained, TRUE - drained
 );
 
 #endif /* _ASP_DECOP_CB_MASTER_H_ */
index f7135cf862c7ab59c353898da43335591865af38..ded055aa6133bae549d84fefffb3117c0082ae3b 100644 (file)
@@ -1856,6 +1856,8 @@ PAF_ASOT_decodeInfo2(
     return errno;
 } //PAF_ASOT_decodeInfo2
 
+
+PAF_AST_DecOpCircBufStats gCbStats; // FL: debug
 // -----------------------------------------------------------------------------
 // ASOT Decoding Function - Stream Processing
 //
@@ -1883,6 +1885,8 @@ PAF_ASOT_decodeStream(
     Int z;                              /* decode/stream counter */
     PAF_AudioFrame *pAfRd;
     Int cbErrno;
+    PAF_AST_DecOpCircBufStats cbStats;  /* circular buffer statistics */
+    Int8 cbDrained;
     Int errno;
 
 
@@ -1899,7 +1903,7 @@ PAF_ASOT_decodeStream(
         //
         pAfRd = pAstCfg->xStr[zS].pAudioFrame;
         //GPIOSetOutput(GPIO_PORT_0, GPIO_PIN_106);
-        cbErrno = cbReadAf(pCbCtl, z, pAfRd);
+        cbErrno = cbReadAf(pCbCtl, z, pAfRd, &cbDrained);
         if ((cbErrno < 0) && (cbErrno != ASP_DECOP_CB_READ_UNDERFLOW))
         {
             gCbReadAfErr++;
@@ -1965,6 +1969,11 @@ PAF_ASOT_decodeStream(
             }
 #endif
 
+        // FL: debug
+        // Get circular buffer statistics (debug)
+        //cbGetStats(pCbCtl, z, &cbStats);
+        cbGetStats(pCbCtl, z, &gCbStats);
+
         // FL: debug
         cbLog(pCbCtl, z, 1, "PAF_ASOT_decodeStream:cbReadAf");
         //if (capAfWrite(pAfRd, 0) != CAP_AF_SOK)