Fixed problem of input task being stuck when input stream stops:
authorJianzhong Xu <a0869574@ti.com>
Mon, 29 Jan 2018 20:55:03 +0000 (15:55 -0500)
committerJianzhong Xu <a0869574@ti.com>
Mon, 29 Jan 2018 20:55:03 +0000 (15:55 -0500)
1. sends message ASP_SLAVE_DEC_EXIT when finishing decoding,
2. skip I/O PHY prime when restarting - workaround for now.

pasdk/test_dsp/framework/audioStreamInpDec.c
pasdk/test_dsp/framework/audioStreamInpProcNewIO.c

index 3da417719d40e4faba5164440da8cfb89a931b8e..6cf54662f1a3a9ba95038019800a1db420e6c1fb 100644 (file)
@@ -134,9 +134,10 @@ Int asipDecodeProcessing(
     // Check if source has configured to NONE
     tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
                                  GATEMP_INDEX_DEC);
-    if (tempVar8 == PAF_SOURCE_NONE) {
+    if (tempVar8 == PAF_SOURCE_NONE || sourceSelect == PAF_SOURCE_NONE) {
         TRACE_VERBOSE0("PAF_ASIT_decodeProcessing: sourceSelect == PAF_SOURCE_NONE");
         pAsitCfg->inpDec.state = QUIT;   // skip processing, quit decoding
+        retVal = ASIP_ERR_DECODE_QUIT;
     }
 
     // Process commands (decode)
index 1ce5608d32efdafd040b152b3849b7e90198dad9..4d95b8b4bd579144d7b9c4d114d1a59a57157707 100644 (file)
@@ -190,6 +190,8 @@ Int asipErrno;
 Int inputReadyForProcessing;
 #endif
 
+    Int firstTimeInit = TRUE;
+
     Log_info0("Enter taskAsipFxn()");
 
     taskAsipFxnInit(pP, pQ);  // initialization of input task
@@ -240,15 +242,22 @@ Int inputReadyForProcessing;
 
             inputReadyForProcessing = asipPrepareProcessing(pP, pQ, pAsitCfg, &asipErrno);
             if (inputReadyForProcessing) {
-                // Input is ready for processing, so we initialize the I/O components
-                asipIoCompsInit(&pAstCfg->xInp[zMI], pInp);
+                // Input is ready for processing, so we initialize the I/O components.
+                // Note that the I/O components init. and I/O PHY prime are performed only at the
+                // first time. This should be changed later - init. and prime should be done whenever
+                // input interface has changed.
+                if(firstTimeInit) {
+                    asipIoCompsInit(&pAstCfg->xInp[zMI], pInp);
+
+                    // Start I/O physical layer by priming McASP LLD for input
+                    asipIoPhyPrime(pInp);
+
+                    firstTimeInit = FALSE;
+                }
 
                 // Initialize ASIP processing
                 asipProcInit(pInp, &pAsitCfg->inpDec);
 
-                // Start I/O physical layer by priming McASP LLD for input
-                asipIoPhyPrime(pInp);
-
                 pInp->asipState = ASIP_INPUT_PROCESSING;
             }
             break;
@@ -1072,7 +1081,7 @@ Int asipProcessing(const PAF_ASIT_Params *pP,
             }
 
             // Inform decoder to complete decoding previous frame
-            pInp->sourceSelect = PAF_SOURCE_UNKNOWN;
+            pInp->sourceSelect = PAF_SOURCE_NONE;
 
             pInp->numFrameReceived = 0;
             pInp->asipProcState  = ASIP_SOURCE_DETECTION;
@@ -1087,6 +1096,15 @@ Int asipProcessing(const PAF_ASIT_Params *pP,
 #ifndef PCM_LOOPBACK_TEST
         asipStatus = asipDecodeProcessing(pP, pQ, pAsitCfg, pInp->sourceSelect);
         if(asipStatus != ASIP_NO_ERR) {
+
+            // FL: send dec exit message to slave
+            if( AspMsgSend(ASP_SLAVE_DEC_EXIT, ASP_MASTER_DEC_EXIT_DONE, NULL, NULL)
+                != ASP_MSG_NO_ERR)
+            {
+                TRACE_VERBOSE0("TaskAsip: error in sending DEC_EXIT message");
+                SW_BREAKPOINT;
+            }
+
             return asipStatus;
         }
 #else