Changeset 91186 in vbox for trunk/src/VBox/ValidationKit
- Timestamp:
- Sep 9, 2021 6:54:31 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/utils/audio/vkatCommon.cpp
r91185 r91186 309 309 if (cbCanWrite) 310 310 { 311 if (g_uVerbosity) 312 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Stream is writable with %RU32ms (%RU32 bytes)\n", 313 PDMAudioPropsBytesToMilli(pMix->pProps, cbCanWrite), cbCanWrite); 314 311 315 uint32_t const cbToGenerate = RT_MIN(RT_MIN(cbToPlayTotal - cbPlayedTotal, sizeof(abBuf)), cbCanWrite); 312 316 uint32_t cbToPlay; … … 341 345 else if (AudioTestMixStreamIsOkay(&pStream->Mix)) 342 346 { 347 RTMSINTERVAL const msSleep = RT_MIN(RT_MAX(1, pStream->Cfg.Device.cMsSchedulingHint), 256); 348 343 349 if (!nsLastMsgCantWrite || nsNow - nsLastMsgCantWrite > RT_NS_10SEC) /* Don't spam the output too much. */ 344 350 { 345 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Waiting for stream to be writable again ...\n");351 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Waiting %RU32ms for stream to be writable again ...\n", msSleep); 346 352 nsLastMsgCantWrite = nsNow; 347 353 } 348 354 349 RTThreadSleep( RT_MIN(RT_MAX(1, pStream->Cfg.Device.cMsSchedulingHint), 256));355 RTThreadSleep(msSleep); 350 356 } 351 357 else … … 359 365 if (cNsElapsed > nsTimeout) 360 366 { 361 RTTestFailed(g_hTest, "Playback took too long (runn g %RU64 vs. timeout %RU64), aborting\n", cNsElapsed, nsTimeout);367 RTTestFailed(g_hTest, "Playback took too long (running %RU64 vs. timeout %RU64), aborting\n", cNsElapsed, nsTimeout); 362 368 rc = VERR_TIMEOUT; 363 369 } … … 433 439 uint32_t const cbSamplesAligned = PDMAudioPropsFloorBytesToFrame(pMix->pProps, sizeof(abSamples)); 434 440 uint64_t cbRecTotal = 0; 441 442 uint64_t const nsStarted = RTTimeNanoTS(); 443 444 uint64_t nsTimeout = RT_MS_5MIN_64 * RT_NS_1MS; 445 uint64_t nsLastMsgCantRead = 0; /* Timestamp (in ns) when the last message of an unreadable stream was shown. */ 446 435 447 while (!g_fTerminate && cbRecTotal < cbToRecTotal) 436 448 { 449 uint64_t const nsNow = RTTimeNanoTS(); 450 437 451 /* 438 452 * Anything we can read? … … 441 455 if (cbCanRead) 442 456 { 457 if (g_uVerbosity) 458 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Stream is readable with %RU32ms (%RU32 bytes)\n", 459 PDMAudioPropsBytesToMilli(pMix->pProps, cbCanRead), cbCanRead); 460 443 461 uint32_t const cbToRead = RT_MIN(cbCanRead, cbSamplesAligned); 444 462 uint32_t cbRecorded = 0; … … 459 477 } 460 478 else if (AudioTestMixStreamIsOkay(pMix)) 461 RTThreadSleep(RT_MIN(RT_MAX(1, pTstEnv->cMsSchedulingHint), 256)); 479 { 480 RTMSINTERVAL const msSleep = RT_MIN(RT_MAX(1, pStream->Cfg.Device.cMsSchedulingHint), 256); 481 482 if (!nsLastMsgCantRead || nsNow - nsLastMsgCantRead > RT_NS_10SEC) /* Don't spam the output too much. */ 483 { 484 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Waiting %RU32ms for stream to be readable again ...\n", msSleep); 485 nsLastMsgCantRead = nsNow; 486 } 487 488 RTThreadSleep(msSleep); 489 } 490 491 /* Fail-safe in case something screwed up while playing back. */ 492 uint64_t const cNsElapsed = nsNow - nsStarted; 493 if (cNsElapsed > nsTimeout) 494 { 495 RTTestFailed(g_hTest, "Recording took too long (running %RU64 vs. timeout %RU64), aborting\n", cNsElapsed, nsTimeout); 496 rc = VERR_TIMEOUT; 497 } 462 498 463 499 if (RT_FAILURE(rc)) 464 500 break; 465 501 } 502 503 if (cbRecTotal != cbToRecTotal) 504 RTTestFailed(g_hTest, "Recording ended unexpectedly (%RU32/%RU32 recorded)\n", cbRecTotal, cbToRecTotal); 466 505 467 506 int rc2 = AudioTestMixStreamDisable(pMix);
Note:
See TracChangeset
for help on using the changeset viewer.