Changeset 89310 in vbox for trunk/src/VBox
- Timestamp:
- May 27, 2021 10:11:23 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/utils/audio/vkat.cpp
r89308 r89310 1348 1348 } 1349 1349 1350 /** 1351 * Tries to capture @a cbBuf bytes of samples in @a pvBuf. 1352 */ 1353 static 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 1350 1373 1351 1374 /********************************************************************************************************************************* … … 1609 1632 /** @todo Use .WAV here? */ 1610 1633 PAUDIOTESTOBJ pObj; 1611 int rc = AudioTestSetObjCreateAndRegister(&pTstEnv->Set, "tone .pcm", &pObj);1634 int rc = AudioTestSetObjCreateAndRegister(&pTstEnv->Set, "tone-rec.pcm", &pObj); 1612 1635 AssertRCReturn(rc, rc); 1613 1636 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]; 1619 1640 1620 1641 const uint64_t tsStartMs = RTTimeMilliTS(); 1621 const uint16_t cSchedulingMs = RTRandU32Ex(10, 80); /* Cho se a random scheduling (in ms). */1642 const uint16_t cSchedulingMs = RTRandU32Ex(10, 80); /* Choose a random scheduling (in ms). */ 1622 1643 1623 1644 do 1624 1645 { 1625 1646 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); 1628 1648 if (RT_SUCCESS(rc)) 1629 1649 rc = AudioTestSetObjWrite(pObj, abBuf, cbRead); … … 1690 1710 /** @todo Use .WAV here? */ 1691 1711 PAUDIOTESTOBJ pObj; 1692 int rc = AudioTestSetObjCreateAndRegister(&pTstEnv->Set, "tone .pcm", &pObj);1712 int rc = AudioTestSetObjCreateAndRegister(&pTstEnv->Set, "tone-play.pcm", &pObj); 1693 1713 AssertRCReturn(rc, rc); 1694 1714 … … 1699 1719 1700 1720 const uint64_t tsStartMs = RTTimeMilliTS(); 1701 const uint16_t cSchedulingMs = RTRandU32Ex(10, 80); /* Cho se a random scheduling (in ms). */1721 const uint16_t cSchedulingMs = RTRandU32Ex(10, 80); /* Choose a random scheduling (in ms). */ 1702 1722 const uint32_t cbPerMs = PDMAudioPropsMilliToBytes(&pParms->Props, cSchedulingMs); 1703 1723 … … 1771 1791 1772 1792 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); 1775 1797 #endif 1776 pTstParmsAcq->cIterations = RTRandU32Ex(1, 10);1777 1798 pTstParmsAcq->idxCurrent = 0; 1778 1799 … … 1847 1868 1848 1869 pTstParmsAcq->enmDir = PDMAUDIODIR_IN; 1870 #ifdef DEBUG 1871 pTstParmsAcq->cIterations = 2; 1872 #else 1849 1873 pTstParmsAcq->cIterations = RTRandU32Ex(1, 10); 1874 #endif 1850 1875 pTstParmsAcq->idxCurrent = 0; 1851 1876
Note:
See TracChangeset
for help on using the changeset viewer.