VirtualBox

Changeset 89835 in vbox for trunk/src/VBox/Devices/Audio


Ignore:
Timestamp:
Jun 22, 2021 1:57:01 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
145292
Message:

Audio/ValKit: Factored out cleaning up the registered tests in the ValKit audio driver and also do so when ending a test set. bugref:10008

File:
1 edited

Legend:

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

    r89685 r89835  
    211211}
    212212
    213 /** @copydoc ATSCALLBACKS::pfnTestSetBegin */
    214 static DECLCALLBACK(int) drvHostValKitTestSetBegin(void const *pvUser, const char *pszTag)
    215 {
    216     PDRVHOSTVALKITAUDIO pThis = (PDRVHOSTVALKITAUDIO)pvUser;
    217 
    218     LogRel(("Audio: Validation Kit: Beginning test set '%s'\n", pszTag));
    219     return AudioTestSetCreate(&pThis->Set, pThis->szPathTemp, pszTag);
     213/**
     214 * Performs some internal cleanup / housekeeping of all registered tests.
     215 *
     216 * @param   pThis               ValKit audio driver instance.
     217 */
     218static void drvHostValKitCleanup(PDRVHOSTVALKITAUDIO pThis)
     219{
     220    LogRel(("Audio: Validation Kit: Cleaning up ...\n"));
     221
     222    if (pThis->cTestsRec)
     223        LogRel(("Audio: Validation Kit: Warning: %RU32 guest recording tests still outstanding:\n", pThis->cTestsRec));
     224
     225    PVALKITTESTDATA pTst, pTstNext;
     226    RTListForEachSafe(&pThis->lstTestsRec, pTst, pTstNext, VALKITTESTDATA, Node)
     227    {
     228        size_t const cbOutstanding = pTst->t.TestTone.u.Rec.cbToWrite - pTst->t.TestTone.u.Rec.cbWritten;
     229        if (cbOutstanding)
     230            LogRel(("Audio: Validation Kit: \tRecording test #%RU32 has %RU64 bytes (%RU32ms) outstanding\n",
     231                    pTst->idxTest, cbOutstanding, PDMAudioPropsBytesToMilli(&pTst->t.TestTone.Parms.Props, cbOutstanding)));
     232        drvHostValKiUnregisterRecTest(pThis, pTst);
     233    }
     234
     235    if (pThis->cTestsPlay)
     236        LogRel(("Audio: Validation Kit: Warning: %RU32 guest playback tests still outstanding:\n", pThis->cTestsPlay));
     237
     238    RTListForEachSafe(&pThis->lstTestsPlay, pTst, pTstNext, VALKITTESTDATA, Node)
     239    {
     240        size_t const cbOutstanding = pTst->t.TestTone.u.Play.cbToRead - pTst->t.TestTone.u.Play.cbRead;
     241        if (cbOutstanding)
     242            LogRel(("Audio: Validation Kit: \tPlayback test #%RU32 has %RU64 bytes (%RU32ms) outstanding\n",
     243                    pTst->idxTest, cbOutstanding, PDMAudioPropsBytesToMilli(&pTst->t.TestTone.Parms.Props, cbOutstanding)));
     244        drvHostValKiUnregisterPlayTest(pThis, pTst);
     245    }
     246
     247    Assert(pThis->cTestsRec == 0);
     248    Assert(pThis->cTestsPlay == 0);
    220249}
    221250
     
    225254*********************************************************************************************************************************/
    226255
     256/** @copydoc ATSCALLBACKS::pfnTestSetBegin */
     257static DECLCALLBACK(int) drvHostValKitTestSetBegin(void const *pvUser, const char *pszTag)
     258{
     259    PDRVHOSTVALKITAUDIO pThis = (PDRVHOSTVALKITAUDIO)pvUser;
     260
     261    LogRel(("Audio: Validation Kit: Beginning test set '%s'\n", pszTag));
     262    return AudioTestSetCreate(&pThis->Set, pThis->szPathTemp, pszTag);
     263}
     264
    227265/** @copydoc ATSCALLBACKS::pfnTestSetEnd */
    228266static DECLCALLBACK(int) drvHostValKitTestSetEnd(void const *pvUser, const char *pszTag)
     
    242280    if (RT_SUCCESS(rc))
    243281        LogRel(("Audio: Validation Kit: Packed up to '%s'\n", pThis->szTestSetArchive));
     282
     283    /* Do some internal housekeeping. */
     284    drvHostValKitCleanup(pThis);
    244285
    245286    int rc2 = AudioTestSetWipe(pSet);
     
    869910    if (RT_SUCCESS(rc))
    870911    {
    871         LogRel(("Audio: Validation Kit: Shutdown of Audio Test Service complete\n"));
    872 
    873         if (pThis->cTestsRec)
    874             LogRel(("Audio: Validation Kit: Warning: %RU32 guest recording tests still outstanding:\n", pThis->cTestsRec));
    875 
    876         PVALKITTESTDATA pTst, pTstNext;
    877         RTListForEachSafe(&pThis->lstTestsRec, pTst, pTstNext, VALKITTESTDATA, Node)
    878         {
    879             size_t const cbOutstanding = pTst->t.TestTone.u.Rec.cbToWrite - pTst->t.TestTone.u.Rec.cbWritten;
    880             if (cbOutstanding)
    881                 LogRel(("Audio: Validation Kit: \tRecording test #%RU32 has %RU64 bytes outstanding\n", pTst->idxTest, cbOutstanding));
    882             drvHostValKiUnregisterRecTest(pThis, pTst);
    883         }
    884 
    885         if (pThis->cTestsPlay)
    886             LogRel(("Audio: Validation Kit: Warning: %RU32 guest playback tests still outstanding:\n", pThis->cTestsPlay));
    887 
    888         RTListForEachSafe(&pThis->lstTestsPlay, pTst, pTstNext, VALKITTESTDATA, Node)
    889         {
    890             size_t const cbOutstanding = pTst->t.TestTone.u.Play.cbToRead - pTst->t.TestTone.u.Play.cbRead;
    891             if (cbOutstanding)
    892                 LogRel(("Audio: Validation Kit: \tPlayback test #%RU32 has %RU64 bytes outstanding\n", pTst->idxTest, cbOutstanding));
    893             drvHostValKiUnregisterPlayTest(pThis, pTst);
    894         }
    895 
    896         Assert(pThis->cTestsRec == 0);
    897         Assert(pThis->cTestsPlay == 0);
     912        LogRel(("Audio: Validation Kit: Shutdown of Audio Test Service (ATS) complete\n"));
     913        drvHostValKitCleanup(pThis);
    898914    }
    899915    else
    900         LogRel(("Audio: Validation Kit: Shutdown of Audio Test Service failed, rc=%Rrc\n", rc));
     916        LogRel(("Audio: Validation Kit: Shutdown of Audio Test Service (ATS) failed, rc=%Rrc\n", rc));
    901917
    902918    /* Try cleaning up a bit. */
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