Changeset 91143 in vbox for trunk/src/VBox/ValidationKit
- Timestamp:
- Sep 7, 2021 5:32:09 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/utils/audio/vkatCommon.cpp
r91141 r91143 288 288 uint64_t offStream = 0; 289 289 uint64_t nsTimeout = RT_MS_5MIN_64 * RT_NS_1MS; 290 uint64_t nsLastMsgCantWrite = 0; /* Timestamp (in ns) when the last message of an unwritable stream was shown. */ 290 291 291 292 while (cbPlayedTotal < cbToPlayTotal) 292 293 { 294 uint64_t const nsNow = RTTimeNanoTS(); 295 293 296 /* Pace ourselves a little. */ 294 297 if (offStream >= cbPreBuffer) 295 298 { 296 299 if (!nsDonePreBuffering) 297 nsDonePreBuffering = RTTimeNanoTS();300 nsDonePreBuffering = nsNow; 298 301 uint64_t const cNsWritten = PDMAudioPropsBytesToNano64(pMix->pProps, offStream - cbPreBuffer); 299 uint64_t const cNsElapsed = RTTimeNanoTS()- nsStarted;302 uint64_t const cNsElapsed = nsNow - nsStarted; 300 303 if (cNsWritten > cNsElapsed + RT_NS_10MS) 301 304 RTThreadSleep((cNsWritten - cNsElapsed - RT_NS_10MS / 2) / RT_NS_1MS); … … 333 336 if (RT_FAILURE(rc)) 334 337 break; 338 339 nsLastMsgCantWrite = 0; 335 340 } 336 341 else if (AudioTestMixStreamIsOkay(&pStream->Mix)) 342 { 343 if (!nsLastMsgCantWrite || nsNow - nsLastMsgCantWrite > RT_NS_10SEC) /* Don't spam the output too much. */ 344 { 345 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Waiting for stream to be writable again ...\n"); 346 nsLastMsgCantWrite = nsNow; 347 } 337 348 RTThreadSleep(RT_MIN(RT_MAX(1, pStream->Cfg.Device.cMsSchedulingHint), 256)); 349 } 338 350 else 339 351 AssertFailedBreakStmt(rc = VERR_AUDIO_STREAM_NOT_READY); … … 343 355 344 356 /* Fail-safe in case something screwed up while playing back. */ 345 uint64_t const cNsElapsed = RTTimeNanoTS()- nsStarted;357 uint64_t const cNsElapsed = nsNow - nsStarted; 346 358 if (cNsElapsed > nsTimeout) 347 359 {
Note:
See TracChangeset
for help on using the changeset viewer.