VirtualBox

Changeset 89310 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 27, 2021 10:11:23 AM (4 years ago)
Author:
vboxsync
Message:

Audio/ValKit: Also use the test driver stack functions for recording path. bugref:10008

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/utils/audio/vkat.cpp

    r89308 r89310  
    13481348}
    13491349
     1350/**
     1351 * Tries to capture @a cbBuf bytes of samples in @a pvBuf.
     1352 */
     1353static int audioTestDriverStackStreamCapture(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream,
     1354                                             void *pvBuf, uint32_t cbBuf, uint32_t *pcbCaptured)
     1355{
     1356    int rc;
     1357    if (pDrvStack->pIAudioConnector)
     1358    {
     1359        rc = pDrvStack->pIAudioConnector->pfnStreamCapture(pDrvStack->pIAudioConnector, pStream, pcbCaptured);
     1360        if (RT_FAILURE(rc))
     1361            RTTestFailed(g_hTest, "pfnStreamCapture(,,,%#x) failed: %Rrc", cbBuf, rc);
     1362    }
     1363    else
     1364    {
     1365        PAUDIOTESTDRVSTACKSTREAM pStreamAt = (PAUDIOTESTDRVSTACKSTREAM)pStream;
     1366        rc = pDrvStack->pIHostAudio->pfnStreamCapture(pDrvStack->pIHostAudio, &pStreamAt->Backend, pvBuf, cbBuf, pcbCaptured);
     1367        if (RT_FAILURE(rc))
     1368            RTTestFailed(g_hTest, "PDMIHOSTAUDIO::pfnStreamCapture(,,,%#x) failed: %Rrc", cbBuf, rc);
     1369    }
     1370    return rc;
     1371}
     1372
    13501373
    13511374/*********************************************************************************************************************************
     
    16091632    /** @todo Use .WAV here? */
    16101633    PAUDIOTESTOBJ pObj;
    1611     int rc = AudioTestSetObjCreateAndRegister(&pTstEnv->Set, "tone.pcm", &pObj);
     1634    int rc = AudioTestSetObjCreateAndRegister(&pTstEnv->Set, "tone-rec.pcm", &pObj);
    16121635    AssertRCReturn(rc, rc);
    16131636
    1614     PDMHOSTAUDIOSTREAMSTATE enmState = pTstEnv->DrvStack.pIHostAudio->pfnStreamGetState(pTstEnv->DrvStack.pIHostAudio,
    1615                                                                                         pStream->pBackend);
    1616     if (enmState == PDMHOSTAUDIOSTREAMSTATE_OKAY)
    1617     {
    1618         uint8_t  abBuf[_4K];
     1637    if (audioTestDriverStackStreamIsOkay(&pTstEnv->DrvStack, pStream->pStream))
     1638    {
     1639        uint8_t abBuf[_4K];
    16191640
    16201641        const uint64_t tsStartMs     = RTTimeMilliTS();
    1621         const uint16_t cSchedulingMs = RTRandU32Ex(10, 80); /* Chose a random scheduling (in ms). */
     1642        const uint16_t cSchedulingMs = RTRandU32Ex(10, 80); /* Choose a random scheduling (in ms). */
    16221643
    16231644        do
    16241645        {
    16251646            uint32_t cbRead = 0;
    1626             rc = pTstEnv->DrvStack.pIHostAudio->pfnStreamCapture(pTstEnv->DrvStack.pIHostAudio, pStream->pBackend, abBuf,
    1627                                                                  sizeof(abBuf), &cbRead);
     1647            rc = audioTestDriverStackStreamCapture(&pTstEnv->DrvStack, pStream->pStream, (void *)abBuf, sizeof(abBuf), &cbRead);
    16281648            if (RT_SUCCESS(rc))
    16291649                rc = AudioTestSetObjWrite(pObj, abBuf, cbRead);
     
    16901710    /** @todo Use .WAV here? */
    16911711    PAUDIOTESTOBJ pObj;
    1692     int rc = AudioTestSetObjCreateAndRegister(&pTstEnv->Set, "tone.pcm", &pObj);
     1712    int rc = AudioTestSetObjCreateAndRegister(&pTstEnv->Set, "tone-play.pcm", &pObj);
    16931713    AssertRCReturn(rc, rc);
    16941714
     
    16991719
    17001720        const uint64_t tsStartMs     = RTTimeMilliTS();
    1701         const uint16_t cSchedulingMs = RTRandU32Ex(10, 80); /* Chose a random scheduling (in ms). */
     1721        const uint16_t cSchedulingMs = RTRandU32Ex(10, 80); /* Choose a random scheduling (in ms). */
    17021722        const uint32_t cbPerMs       = PDMAudioPropsMilliToBytes(&pParms->Props, cSchedulingMs);
    17031723
     
    17711791
    17721792    pTstParmsAcq->enmDir      = PDMAUDIODIR_OUT;
    1773 #ifdef DEBUG_andy
    1774     pTstParmsAcq->cIterations = RTRandU32Ex(1, 1);
     1793#ifdef DEBUG
     1794    pTstParmsAcq->cIterations = 2;
     1795#else
     1796    pTstParmsAcq->cIterations = RTRandU32Ex(1, 10);
    17751797#endif
    1776     pTstParmsAcq->cIterations = RTRandU32Ex(1, 10);
    17771798    pTstParmsAcq->idxCurrent  = 0;
    17781799
     
    18471868
    18481869    pTstParmsAcq->enmDir      = PDMAUDIODIR_IN;
     1870#ifdef DEBUG
     1871    pTstParmsAcq->cIterations = 2;
     1872#else
    18491873    pTstParmsAcq->cIterations = RTRandU32Ex(1, 10);
     1874#endif
    18501875    pTstParmsAcq->idxCurrent  = 0;
    18511876
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