Changeset 91139 in vbox
- Timestamp:
- Sep 7, 2021 12:37:53 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/utils/audio/vkatCommon.cpp
r90978 r91139 265 265 uint32_t cbToPlayTotal = PDMAudioPropsMilliToBytes(&pStream->Cfg.Props, pParms->msDuration); 266 266 AssertStmt(cbToPlayTotal, rc = VERR_INVALID_PARAMETER); 267 uint32_t cbPlayedTotal = 0; 267 268 268 269 RTTestPrintf(g_hTest, RTTESTLVL_DEBUG, "Playing %RU32 bytes total\n", cbToPlayTotal); … … 286 287 287 288 uint64_t offStream = 0; 288 uint64_t tsStartMs = RTTimeMilliTS(); 289 RTMSINTERVAL uTimeoutMs = pParms->msDuration * 4; /* Four times the time playback should roughly take */ 289 uint64_t uTimeoutNs = (pParms->msDuration * 4) * RT_NS_1MS; /* Four times the time playback should roughly take */ 290 290 291 291 while (cbToPlayTotal) … … 322 322 { 323 323 offStream += cbPlayed; 324 325 if (cbPlayed != cbToPlay) 326 RTTestFailed(g_hTest, "Only played %RU32/%RU32 bytes", cbPlayed, cbToPlay); 324 327 } 325 328 } … … 334 337 AssertFailedBreakStmt(rc = VERR_AUDIO_STREAM_NOT_READY); 335 338 336 Assert(cbToPlayTotal >= cbPlayed);337 cbToPlayTotal -= cbPlayed;339 cbPlayedTotal += cbPlayed; 340 AssertBreakStmt(cbPlayedTotal <= cbToPlayTotal, VERR_BUFFER_OVERFLOW); 338 341 339 342 /* Fail-safe in case something screwed up while playing back. */ 340 if (RTTime MilliTS() - tsStartMs > uTimeoutMs)343 if (RTTimeNanoTS() - nsStarted > uTimeoutNs) 341 344 { 342 RTTestFailed(g_hTest, "Playback took too long (%RU32ms exceeded), aborting\n", uTimeout Ms);345 RTTestFailed(g_hTest, "Playback took too long (%RU32ms exceeded), aborting\n", uTimeoutNs / RT_NS_1MS); 343 346 rc = VERR_TIMEOUT; 347 } 348 349 if (RT_FAILURE(rc)) 344 350 break; 345 } 346 } 347 348 if (cbToPlayTotal != 0) 349 RTTestFailed(g_hTest, "Playback ended unexpectedly (%RU32 bytes left)\n", cbToPlayTotal); 351 } 352 353 if (cbPlayedTotal != cbToPlayTotal) 354 RTTestFailed(g_hTest, "Playback ended unexpectedly (%RU32/%RU32 played)\n", cbPlayedTotal, cbToPlayTotal); 350 355 351 356 if (RT_SUCCESS(rc))
Note:
See TracChangeset
for help on using the changeset viewer.