VirtualBox

Changeset 90056 in vbox for trunk/src


Ignore:
Timestamp:
Jul 6, 2021 11:15:47 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
145551
Message:

Audio/ValKit: Added support for concurrent playback + recording tests to the ValKit audio driver. bugref:10008

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DrvHostAudioValidationKit.cpp

    r89994 r90056  
    131131    /** List keeping the recording tests (FIFO). */
    132132    RTLISTANCHOR        lstTestsRec;
     133    /** Pointer to current recording test being processed.
     134     *  NULL if no current test active. */
     135    PVALKITTESTDATA     pTestCurRec;
    133136    /** Number of tests in \a lstTestsPlay. */
    134137    uint32_t            cTestsPlay;
    135138    /** List keeping the recording tests (FIFO). */
    136139    RTLISTANCHOR        lstTestsPlay;
    137     /** Pointer to current test being processed. */
    138     PVALKITTESTDATA     pTestCur;
     140    /** Pointer to current playback test being processed.
     141     *  NULL if no current test active. */
     142    PVALKITTESTDATA     pTestCurPlay;
    139143    /** Critical section for serializing access across threads. */
    140144    RTCRITSECT          CritSect;
     
    635639    if (RT_SUCCESS(rc))
    636640    {
    637         PVALKITTESTDATA pTst = pThis->pTestCur;
     641        PVALKITTESTDATA pTst = pThis->pTestCurPlay;
    638642
    639643        if (pTst)
     
    648652            AudioTestSetTestDone(pTst->pEntry);
    649653
    650             pThis->pTestCur = NULL;
    651             pTst            = NULL;
     654            pThis->pTestCurPlay = NULL;
     655            pTst                = NULL;
    652656
    653657            if (pThis->fTestSetEnded)
     
    671675
    672676    PDRVHOSTVALKITAUDIO pThis = RT_FROM_MEMBER(pInterface, DRVHOSTVALKITAUDIO, IHostAudio);
     677    PVALKITTESTDATA     pTst  = NULL;
    673678
    674679    int rc = RTCritSectEnter(&pThis->CritSect);
    675680    if (RT_SUCCESS(rc))
    676681    {
    677         pThis->pTestCur = RTListGetFirst(&pThis->lstTestsPlay, VALKITTESTDATA, Node);
     682        pTst = RTListGetFirst(&pThis->lstTestsRec, VALKITTESTDATA, Node);
    678683
    679684        int rc2 = RTCritSectLeave(&pThis->CritSect);
     
    681686    }
    682687
    683     if (pThis->pTestCur == NULL) /* Empty list? */
     688    if (pTst == NULL) /* Empty list? */
    684689        return 0;
    685 
    686     PVALKITTESTDATA const pTst = pThis->pTestCur;
    687690
    688691    Assert(pTst->t.TestTone.u.Rec.cbToWrite >= pTst->t.TestTone.u.Rec.cbWritten);
     
    727730
    728731    PDRVHOSTVALKITAUDIO pThis = RT_FROM_MEMBER(pInterface, DRVHOSTVALKITAUDIO, IHostAudio);
     732    PVALKITTESTDATA     pTst  = NULL;
    729733
    730734    bool const fIsSilence = PDMAudioPropsIsBufferSilence(&pStream->pStream->Cfg.Props, pvBuf, cbBuf);
     
    733737    if (RT_SUCCESS(rc))
    734738    {
    735         if (pThis->pTestCur == NULL)
    736         {
    737             pThis->pTestCur = RTListGetFirst(&pThis->lstTestsPlay, VALKITTESTDATA, Node);
    738             if (pThis->pTestCur)
    739                 LogRel(("ValKit: Next guest playback test in queue is test #%RU32\n", pThis->pTestCur->idxTest));
    740         }
     739        if (pThis->pTestCurPlay == NULL)
     740        {
     741            pThis->pTestCurPlay = RTListGetFirst(&pThis->lstTestsPlay, VALKITTESTDATA, Node);
     742            if (pThis->pTestCurPlay)
     743                LogRel(("ValKit: Next guest playback test in queue is test #%RU32\n", pThis->pTestCurPlay->idxTest));
     744        }
     745
     746        pTst = pThis->pTestCurPlay;
    741747
    742748        int rc2 = RTCritSectLeave(&pThis->CritSect);
     
    744750    }
    745751
    746     if (pThis->pTestCur == NULL) /* Empty list? */
     752    if (pTst == NULL) /* Empty list? */
    747753    {
    748754#ifdef DEBUG_andy
     
    762768#endif
    763769
    764     PVALKITTESTDATA pTst = pThis->pTestCur;
    765 
    766770    const bool fHandleSilence = false; /** @todo Skip blocks of entire silence for now. */
    767771
    768     if (pTst->pEntry == NULL)
     772    if (pTst->pEntry == NULL) /* Test not started yet? */
    769773    {
    770774        AUDIOTESTPARMS Parms;
     
    814818                    drvHostValKiUnregisterPlayTest(pThis, pTst);
    815819
    816                     pThis->pTestCur = NULL;
    817                     pTst            = NULL;
     820                    pThis->pTestCurPlay = NULL;
     821                    pTst                = NULL;
    818822
    819823                    int rc2 = RTCritSectLeave(&pThis->CritSect);
     
    858862
    859863    PDRVHOSTVALKITAUDIO pThis = RT_FROM_MEMBER(pInterface, DRVHOSTVALKITAUDIO, IHostAudio);
     864    PVALKITTESTDATA     pTst  = NULL;
    860865
    861866    int rc = RTCritSectEnter(&pThis->CritSect);
    862867    if (RT_SUCCESS(rc))
    863868    {
    864         if (pThis->pTestCur == NULL)
    865         {
    866             pThis->pTestCur = RTListGetFirst(&pThis->lstTestsRec, VALKITTESTDATA, Node);
    867             if (pThis->pTestCur)
    868                 LogRel(("ValKit: Next guest recording test in queue is test #%RU32\n", pThis->pTestCur->idxTest));
    869         }
     869        if (pThis->pTestCurRec == NULL)
     870        {
     871            pThis->pTestCurRec = RTListGetFirst(&pThis->lstTestsRec, VALKITTESTDATA, Node);
     872            if (pThis->pTestCurRec)
     873                LogRel(("ValKit: Next guest recording test in queue is test #%RU32\n", pThis->pTestCurRec->idxTest));
     874        }
     875
     876        pTst = pThis->pTestCurRec;
    870877
    871878        int rc2 = RTCritSectLeave(&pThis->CritSect);
     
    873880    }
    874881
    875     if (pThis->pTestCur == NULL) /* Empty list? */
     882    if (pTst == NULL) /* Empty list? */
    876883    {
    877884        LogRelMax(64, ("ValKit: Warning: Guest is trying to record audio data when no recording test is active\n"));
     
    881888    }
    882889
    883     PVALKITTESTDATA pTst = pThis->pTestCur;
    884 
    885     if (pTst->pEntry == NULL)
     890    if (pTst->pEntry == NULL) /* Test not started yet? */
    886891    {
    887892        AUDIOTESTPARMS Parms;
     
    934939                        drvHostValKiUnregisterRecTest(pThis, pTst);
    935940
    936                         pThis->pTestCur = NULL;
    937                         pTst            = NULL;
     941                        pThis->pTestCurRec = NULL;
     942                        pTst               = NULL;
    938943
    939944                        int rc2 = RTCritSectLeave(&pThis->CritSect);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette