Changeset 89435 in vbox
- Timestamp:
- Jun 1, 2021 1:30:30 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/utils/audio/vkat.cpp
r89433 r89435 184 184 /** Temporary path for this test environment. */ 185 185 char szPathTemp[RTPATH_MAX]; 186 /** Buffer size (in ms). */ 187 RTMSINTERVAL cMsBufferSize; 188 /** Pre-buffering time (in ms). */ 189 RTMSINTERVAL cMsPreBuffer; 190 /** Scheduling hint (in ms). */ 191 RTMSINTERVAL cMsSchedulingHint; 186 192 /** The audio test driver stack. */ 187 193 AUDIOTESTDRVSTACK DrvStack; … … 430 436 uint8_t abBuf[_4K]; 431 437 432 const uint16_t cSchedulingMs = RTRandU32Ex(10, 80); /* Choose a random scheduling (in ms). */ 433 const uint32_t cbPerMs = PDMAudioPropsMilliToBytes(&pParms->Props, cSchedulingMs); 438 const uint32_t cbPerMs = PDMAudioPropsMilliToBytes(&pParms->Props, pTstEnv->cMsSchedulingHint); 434 439 uint32_t cbToWrite = PDMAudioPropsMilliToBytes(&pParms->Props, pParms->msDuration); 435 440 436 AudioTestSetObjAddMetadataStr(pObj, "schedule_ms=%RU16", cSchedulingMs); 441 AudioTestSetObjAddMetadataStr(pObj, "buffer_size_ms=%RU32", pTstEnv->cMsBufferSize); 442 AudioTestSetObjAddMetadataStr(pObj, "prebuf_size_ms=%RU32", pTstEnv->cMsPreBuffer); 443 AudioTestSetObjAddMetadataStr(pObj, "scheduling_hint_ms=%RU32", pTstEnv->cMsSchedulingHint); 437 444 438 445 while (cbToWrite) 439 446 { 440 447 uint32_t cbWritten = 0; 441 uint32_t cbToGenerate = RT_MIN(cbToWrite, RT_MIN(cbPerMs, (uint32_t)sizeof(abBuf)));448 uint32_t cbToGenerate = RT_MIN(cbToWrite, RT_MIN(cbPerMs, sizeof(abBuf))); 442 449 Assert(cbToGenerate); 443 450 … … 455 462 break; 456 463 457 RTThreadSleep( cSchedulingMs);464 RTThreadSleep(pTstEnv->cMsSchedulingHint); 458 465 459 466 Assert(cbToWrite >= cbWritten); … … 573 580 PDMAudioHostEnumInit(&pTstEnv->DevEnum); 574 581 582 pTstEnv->cMsBufferSize = 300; /* ms */ /** @todo Randomize this also? */ 583 pTstEnv->cMsPreBuffer = 150; /* ms */ /** @todo Ditto. */ 584 pTstEnv->cMsSchedulingHint = RTRandU32Ex(10, 80); /* Choose a random scheduling (in ms). */ 585 575 586 /* Only the guest mode needs initializing the driver stack. */ 576 587 const bool fUseDriverStack = pTstEnv->enmMode == AUDIOTESTMODE_GUEST; … … 858 869 { 859 870 pStream->pBackend = NULL; 860 int rc = audioTestDriverStackStreamCreateInput(&pTstEnv->DrvStack, pProps, 300 /*cMsBufferSize*/, 150 /*cMsPreBuffer*/,861 10 /*cMsSchedulingHint*/, &pStream->pStream, &pStream->Cfg);871 int rc = audioTestDriverStackStreamCreateInput(&pTstEnv->DrvStack, pProps, pTstEnv->cMsBufferSize, pTstEnv->cMsPreBuffer, 872 pTstEnv->cMsSchedulingHint, &pStream->pStream, &pStream->Cfg); 862 873 if (RT_SUCCESS(rc) && !pTstEnv->DrvStack.pIAudioConnector) 863 874 pStream->pBackend = &((PAUDIOTESTDRVSTACKSTREAM)pStream->pStream)->Backend; … … 892 903 893 904 const uint64_t tsStartMs = RTTimeMilliTS(); 894 const uint16_t cSchedulingMs = RTRandU32Ex(10, 80); /* Choose a random scheduling (in ms). */895 905 896 906 do … … 907 917 break; 908 918 909 RTThreadSleep( cSchedulingMs);919 RTThreadSleep(pTstEnv->cMsSchedulingHint); 910 920 911 921 } while (RT_SUCCESS(rc)); … … 933 943 { 934 944 pStream->pBackend = NULL; 935 int rc = audioTestDriverStackStreamCreateOutput(&pTstEnv->DrvStack, pProps, 300 /*cMsBufferSize*/, 200 /*cMsPreBuffer*/,936 10 /*cMsSchedulingHint*/, &pStream->pStream, &pStream->Cfg);945 int rc = audioTestDriverStackStreamCreateOutput(&pTstEnv->DrvStack, pProps, pTstEnv->cMsBufferSize, pTstEnv->cMsPreBuffer, 946 pTstEnv->cMsSchedulingHint, &pStream->pStream, &pStream->Cfg); 937 947 if (RT_SUCCESS(rc) && !pTstEnv->DrvStack.pIAudioConnector) 938 948 pStream->pBackend = &((PAUDIOTESTDRVSTACKSTREAM)pStream->pStream)->Backend;
Note:
See TracChangeset
for help on using the changeset viewer.