- Timestamp:
- Aug 20, 2021 5:30:57 PM (3 years ago)
- Location:
- trunk/src/VBox/ValidationKit/utils/audio
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/utils/audio/vkat.cpp
r90721 r90766 246 246 if (strlen(pTstEnv->szDev)) 247 247 { 248 rc = audioTestDriverStackSetDevice( &pTstEnv->DrvStack, PDMAUDIODIR_OUT, pTstEnv->szDev);248 rc = audioTestDriverStackSetDevice(pTstEnv->pDrvStack, PDMAUDIODIR_OUT, pTstEnv->szDev); 249 249 if (RT_FAILURE(rc)) 250 250 return rc; … … 350 350 if (strlen(pTstEnv->szDev)) 351 351 { 352 rc = audioTestDriverStackSetDevice( &pTstEnv->DrvStack, PDMAUDIODIR_IN, pTstEnv->szDev);352 rc = audioTestDriverStackSetDevice(pTstEnv->pDrvStack, PDMAUDIODIR_IN, pTstEnv->szDev); 353 353 if (RT_FAILURE(rc)) 354 354 return rc; … … 857 857 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "No test mode (--mode) specified!\n"); 858 858 859 /* For now all tests have the same test environment. */ 860 rc = audioTestEnvInit(&TstEnv, pDrvReg, fWithDrvAudio); 859 AUDIOTESTDRVSTACK DrvStack; 860 rc = audioTestDriverStackInitEx(&DrvStack, pDrvReg, 861 true /* fEnabledIn */, true /* fEnabledOut */, fWithDrvAudio); /** @todo Make in/out configurable, too. */ 862 if (RT_FAILURE(rc)) 863 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unable to init driver stack: %Rrc\n", rc); 864 865 PPDMAUDIOHOSTDEV pDev; 866 rc = audioTestDevicesEnumerateAndCheck(&DrvStack, TstEnv.szDev, &pDev); 867 if (RT_FAILURE(rc)) 868 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Enumerating device(s) failed: %Rrc\n", rc); 869 870 /* For now all tests have the same test environment and driver stack. */ 871 rc = audioTestEnvInit(&TstEnv, &DrvStack); 861 872 if (RT_SUCCESS(rc)) 862 873 rc = audioTestWorker(&TstEnv); 863 874 864 875 audioTestEnvDestroy(&TstEnv); 876 audioTestDriverStackDelete(&DrvStack); 865 877 866 878 if (RT_FAILURE(rc)) /* Let us know that something went wrong in case we forgot to mention it. */ -
trunk/src/VBox/ValidationKit/utils/audio/vkatCmdSelfTest.cpp
r90721 r90766 77 77 2 /* 16-bit */, true /* fSigned */, 2 /* cChannels */, 44100 /* uHz */); 78 78 79 rc = audioTestEnvInit(pTstEnvGst, pTstEnvGst->DrvStack.pDrvReg, pCtx->fWithDrvAudio);79 rc = audioTestEnvInit(pTstEnvGst, &pCtx->DrvStack); 80 80 if (RT_SUCCESS(rc)) 81 81 { … … 150 150 /* else Step 1a later. */ 151 151 152 RTThreadSleep(5000); /* Fudge: Wait until guest ATS is up. */ 153 152 154 if (RT_SUCCESS(rc)) 153 155 { … … 157 159 pTstEnvHst->enmMode = AUDIOTESTMODE_HOST; 158 160 159 rc = audioTestEnvInit(pTstEnvHst, & g_DrvHostValidationKitAudio, true /* fWithDrvAudio */);161 rc = audioTestEnvInit(pTstEnvHst, &pCtx->DrvStack); 160 162 if (RT_SUCCESS(rc)) 161 163 { … … 260 262 RT_ZERO(Ctx); 261 263 262 /* Go with the platform's default backend if nothing else is specified. */263 Ctx.Guest.pDrvReg = AudioTestGetDefaultBackend();264 265 264 /* Argument processing loop: */ 266 265 int rc; … … 292 291 293 292 case 'b': 294 Ctx. Guest.pDrvReg = AudioTestFindBackendOpt(ValueUnion.psz);295 if (Ctx. Guest.pDrvReg == NULL)293 Ctx.pDrvReg = AudioTestFindBackendOpt(ValueUnion.psz); 294 if (Ctx.pDrvReg == NULL) 296 295 return RTEXITCODE_SYNTAX; 297 296 break; … … 320 319 } 321 320 321 /* Go with the Validation Kit audio backend if nothing else is specified. */ 322 if (Ctx.pDrvReg == NULL) 323 Ctx.pDrvReg = AudioTestFindBackendOpt("valkit"); 324 325 /* 326 * In self-test mode the guest and the host side have to share the same driver stack, 327 * as we don't have any device emulation between the two sides. 328 * 329 * This is necessary to actually get the played/recorded audio to from/to the guest 330 * and host respectively. 331 * 332 * Choosing any other backend than the Validation Kit above *will* break this self-test! 333 */ 334 rc = audioTestDriverStackInitEx(&Ctx.DrvStack, Ctx.pDrvReg, 335 true /* fEnabledIn */, true /* fEnabledOut */, Ctx.fWithDrvAudio); 336 if (RT_FAILURE(rc)) 337 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unable to init driver stack: %Rrc\n", rc); 338 322 339 /* 323 340 * Start testing. … … 328 345 if (RT_FAILURE(rc2)) 329 346 RTTestFailed(g_hTest, "Self test failed with rc=%Rrc", rc2); 347 348 audioTestDriverStackDelete(&Ctx.DrvStack); 330 349 331 350 /* -
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 -
trunk/src/VBox/ValidationKit/utils/audio/vkatDriverStack.cpp
r89575 r90766 486 486 pDrvStack->pDrvAudioIns = NULL; 487 487 pDrvStack->pIAudioConnector = NULL; 488 489 PDMAudioHostEnumDelete(&pDrvStack->DevEnum); 488 490 } 489 491 … … 505 507 RT_ZERO(*pDrvStack); 506 508 pDrvStack->pDrvReg = pDrvReg; 509 510 PDMAudioHostEnumInit(&pDrvStack->DevEnum); 507 511 508 512 if (!fWithDrvAudio) -
trunk/src/VBox/ValidationKit/utils/audio/vkatInternal.h
r90723 r90766 72 72 /** This is NULL if we don't use DrvAudio. */ 73 73 PPDMIAUDIOCONNECTOR pIAudioConnector; 74 75 /** The current (last) audio device enumeration to use. */ 76 PDMAUDIOHOSTENUM DevEnum; 74 77 } AUDIOTESTDRVSTACK; 75 78 /** Pointer to an audio driver stack. */ … … 222 225 /** Scheduling hint (in ms). */ 223 226 RTMSINTERVAL cMsSchedulingHint; 224 /** The audio test driver stack. */ 225 AUDIOTESTDRVSTACK DrvStack; 226 /** The current (last) audio device enumeration to use. */ 227 PDMAUDIOHOSTENUM DevEnum; 227 /** Pointer to audio test driver stack to use. */ 228 PAUDIOTESTDRVSTACK pDrvStack; 228 229 /** Audio stream. */ 229 230 AUDIOTESTSTREAM aStreams[AUDIOTESTENV_MAX_STREAMS]; … … 282 283 /** Whether to use DrvAudio in the driver stack or not. */ 283 284 bool fWithDrvAudio; 285 AUDIOTESTDRVSTACK DrvStack; 286 /** Audio driver to use. 287 * Defaults to the platform's default driver. */ 288 PCPDMDRVREG pDrvReg; 284 289 struct 285 290 { 286 291 AUDIOTESTENV TstEnv; 287 /** Audio driver to use.288 * Defaults to the platform's default driver. */289 PCPDMDRVREG pDrvReg;290 292 /** Where to bind the address of the guest ATS instance to. 291 293 * Defaults to localhost (127.0.0.1) if empty. */ … … 443 445 int audioTestDeviceOpen(PPDMAUDIOHOSTDEV pDev); 444 446 int audioTestDeviceClose(PPDMAUDIOHOSTDEV pDev); 447 448 int audioTestDevicesEnumerateAndCheck(PAUDIOTESTDRVSTACK pDrvStack, const char *pszDev, PPDMAUDIOHOSTDEV *ppDev); 445 449 /** @} */ 446 450 … … 453 457 /** @name Test environment handling 454 458 * @{ */ 455 int audioTestEnvInit(PAUDIOTESTENV pTstEnv, P CPDMDRVREG pDrvReg, bool fWithDrvAudio);459 int audioTestEnvInit(PAUDIOTESTENV pTstEnv, PAUDIOTESTDRVSTACK pDrvStack); 456 460 void audioTestEnvDestroy(PAUDIOTESTENV pTstEnv); 457 461 int audioTestEnvPrologue(PAUDIOTESTENV pTstEnv, bool fPack, char *pszPackFile, size_t cbPackFile);
Note:
See TracChangeset
for help on using the changeset viewer.