Changeset 90766 in vbox for trunk/src/VBox/ValidationKit/utils/audio/vkatCommon.cpp
- Timestamp:
- Aug 20, 2021 5:30:57 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/utils/audio/vkatCommon.cpp
r90724 r90766 70 70 static int audioTestStreamInit(PAUDIOTESTDRVSTACK pDrvStack, PAUDIOTESTSTREAM pStream, PDMAUDIODIR enmDir, PCPDMAUDIOPCMPROPS pProps, bool fWithMixer, uint32_t cMsBufferSize, uint32_t cMsPreBuffer, uint32_t cMsSchedulingHint); 71 71 static int audioTestStreamDestroy(PAUDIOTESTENV pTstEnv, PAUDIOTESTSTREAM pStream); 72 static int audioTestDevicesEnumerateAndCheck(PAUDIOTESTENV pTstEnv, const char *pszDev, PPDMAUDIOHOSTDEV *ppDev);73 72 74 73 … … 81 80 * 82 81 * @returns VBox status code. 83 * @param p TstEnv Test envto use for enumeration.82 * @param pDrvStack Driver stack to use for enumeration. 84 83 * @param pszDev Device name to search for. Can be NULL if the default device shall be used. 85 84 * @param ppDev Where to return the pointer of the device enumeration of \a pTstEnv when a 86 85 * specific device was found. 87 86 */ 88 static int audioTestDevicesEnumerateAndCheck(PAUDIOTESTENV pTstEnv, const char *pszDev, PPDMAUDIOHOSTDEV *ppDev)87 int audioTestDevicesEnumerateAndCheck(PAUDIOTESTDRVSTACK pDrvStack, const char *pszDev, PPDMAUDIOHOSTDEV *ppDev) 89 88 { 90 89 RTTestSubF(g_hTest, "Enumerating audio devices and checking for device '%s'", pszDev && *pszDev ? pszDev : "<Default>"); 91 90 92 if (!p TstEnv->DrvStack.pIHostAudio->pfnGetDevices)91 if (!pDrvStack->pIHostAudio->pfnGetDevices) 93 92 { 94 93 RTTestSkipped(g_hTest, "Backend does not support device enumeration, skipping"); … … 101 100 *ppDev = NULL; 102 101 103 int rc = p TstEnv->DrvStack.pIHostAudio->pfnGetDevices(pTstEnv->DrvStack.pIHostAudio, &pTstEnv->DevEnum);102 int rc = pDrvStack->pIHostAudio->pfnGetDevices(pDrvStack->pIHostAudio, &pDrvStack->DevEnum); 104 103 if (RT_SUCCESS(rc)) 105 104 { 106 105 PPDMAUDIOHOSTDEV pDev; 107 RTListForEach(&p TstEnv->DevEnum.LstDevices, pDev, PDMAUDIOHOSTDEV, ListEntry)106 RTListForEach(&pDrvStack->DevEnum.LstDevices, pDev, PDMAUDIOHOSTDEV, ListEntry) 108 107 { 109 108 char szFlags[PDMAUDIOHOSTDEV_MAX_FLAGS_STRING_LEN]; … … 199 198 /** @todo Anything else to do here, e.g. test if there are left over samples or some such? */ 200 199 201 audioTestDriverStackStreamDestroy( &pTstEnv->DrvStack, pStream->pStream);200 audioTestDriverStackStreamDestroy(pTstEnv->pDrvStack, pStream->pStream); 202 201 pStream->pStream = NULL; 203 202 pStream->pBackend = NULL; … … 504 503 const PAUDIOTESTSTREAM pTstStream = &pTstEnv->aStreams[0]; /** @todo Make this dynamic. */ 505 504 506 int rc = audioTestStreamInit( &pTstEnv->DrvStack, pTstStream, PDMAUDIODIR_OUT, &pTstEnv->Props, false /* fWithMixer */,505 int rc = audioTestStreamInit(pTstEnv->pDrvStack, pTstStream, PDMAUDIODIR_OUT, &pTstEnv->Props, false /* fWithMixer */, 507 506 pTstEnv->cMsBufferSize, pTstEnv->cMsPreBuffer, pTstEnv->cMsSchedulingHint); 508 507 if (RT_SUCCESS(rc)) … … 545 544 const PAUDIOTESTSTREAM pTstStream = &pTstEnv->aStreams[0]; /** @todo Make this dynamic. */ 546 545 547 int rc = audioTestStreamInit( &pTstEnv->DrvStack, pTstStream, PDMAUDIODIR_IN, &pTstEnv->Props, false /* fWithMixer */,546 int rc = audioTestStreamInit(pTstEnv->pDrvStack, pTstStream, PDMAUDIODIR_IN, &pTstEnv->Props, false /* fWithMixer */, 548 547 pTstEnv->cMsBufferSize, pTstEnv->cMsPreBuffer, pTstEnv->cMsSchedulingHint); 549 548 if (RT_SUCCESS(rc)) … … 795 794 * @param fWithDrvAudio Whether to include DrvAudio in the stack or not. 796 795 */ 797 int audioTestEnvInit(PAUDIOTESTENV pTstEnv, 798 PCPDMDRVREG pDrvReg, bool fWithDrvAudio) 796 int audioTestEnvInit(PAUDIOTESTENV pTstEnv, PAUDIOTESTDRVSTACK pDrvStack) 799 797 { 800 798 int rc = VINF_SUCCESS; 799 800 pTstEnv->pDrvStack = pDrvStack; 801 801 802 802 /* … … 821 821 } 822 822 823 /* Go with the platform's default backend if nothing else is set. */824 if (!pDrvReg)825 pDrvReg = AudioTestGetDefaultBackend();826 827 823 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Initializing environment for mode '%s'\n", pTstEnv->enmMode == AUDIOTESTMODE_HOST ? "host" : "guest"); 828 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Using backend '%s'\n", pDrvReg->szName);829 824 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Using tag '%s'\n", pTstEnv->szTag); 830 825 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Output directory is '%s'\n", pTstEnv->szPathOut); … … 837 832 if (!pTstEnv->cMsSchedulingHint) 838 833 pTstEnv->cMsSchedulingHint = UINT32_MAX; 839 840 PDMAudioHostEnumInit(&pTstEnv->DevEnum);841 842 bool fUseDriverStack = false; /* Whether to init + use the audio driver stack or not. */843 844 /* In regular testing mode only the guest mode needs initializing the driver stack. */845 if (pTstEnv->enmMode == AUDIOTESTMODE_GUEST)846 fUseDriverStack = true;847 848 /* When running in self-test mode, the host mode also needs to initialize the stack in order to849 * to run the Valdation Kit audio driver ATS (no "real" VBox involved). */850 if (pTstEnv->enmMode == AUDIOTESTMODE_HOST && pTstEnv->fSelftest)851 fUseDriverStack = true;852 853 if (fUseDriverStack)854 {855 rc = audioTestDriverStackInitEx(&pTstEnv->DrvStack, pDrvReg,856 true /* fEnabledIn */, true /* fEnabledOut */, fWithDrvAudio);857 if (RT_FAILURE(rc))858 return rc;859 860 PPDMAUDIOHOSTDEV pDev;861 rc = audioTestDevicesEnumerateAndCheck(pTstEnv, pTstEnv->szDev, &pDev);862 if (RT_FAILURE(rc))863 return rc;864 }865 834 866 835 char szPathTemp[RTPATH_MAX]; … … 983 952 } 984 953 985 if ( RT_FAILURE(rc)986 && fUseDriverStack)987 audioTestDriverStackDelete(&pTstEnv->DrvStack);988 989 954 return rc; 990 955 } … … 999 964 if (!pTstEnv) 1000 965 return; 1001 1002 PDMAudioHostEnumDelete(&pTstEnv->DevEnum);1003 966 1004 967 for (unsigned i = 0; i < RT_ELEMENTS(pTstEnv->aStreams); i++) … … 1013 976 RTDirRemove(pTstEnv->szPathOut); 1014 977 1015 audioTestDriverStackDelete(&pTstEnv->DrvStack);978 pTstEnv->pDrvStack = NULL; 1016 979 } 1017 980
Note:
See TracChangeset
for help on using the changeset viewer.