Changeset 71117 in vbox
- Timestamp:
- Feb 23, 2018 5:56:51 PM (7 years ago)
- File:
-
- 1 edited
-
trunk/src/VBox/Devices/Audio/DrvHostDSound.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvHostDSound.cpp
r70974 r71117 2126 2126 } 2127 2127 } 2128 else /* Continue playback */2129 {2130 if ( !RTCircBufUsed(pCircBuf)2131 && pStreamDS->Out.cbPlayed == pStreamDS->Out.cbWritten)2132 {2133 Assert(pStreamDS->Out.cbPlayed == pStreamDS->Out.cbWritten);2134 2135 Log3Func(("Stopping (cbFree=%ld, cbRemaining=%ld, cbUsed=%ld, cbToPlay=%ld, offPlay=%ld, offWrite=%ld)\n",2136 cbFree, cbRemaining, cbUsed, cbToPlay, offPlayCursor, offWriteCursor));2137 2138 /* As we're using a streaming buffer and DirectSound apparently has no clean way of figuring out2139 * when such a buffer was played back fully, we need to make a guess ourselves:2140 *2141 * See if there's any data left between the play and write cursors and calculate some rough estimate2142 * how long we have to wait before actually stopping the buffer.2143 *2144 * Sleeping here is fine, as we're running in a (dedicated) thread anyway. */2145 const DWORD cbRemaining = dsoundRingDistance(offWriteCursor, offPlayCursor, pStreamDS->cbBufSize);2146 uint64_t msWait = cbRemaining / DrvAudioHlpMsToBytes(&pStreamDS->pCfg->Props, 1 /* ms */);2147 2148 if (msWait)2149 {2150 Log3Func(("Waiting %RU64ms (%ld bytes)\n", msWait, cbRemaining));2151 RTThreadSleep(msWait);2152 }2153 2154 DSLOG(("DSound: Stopping playing output\n"));2155 hr = IDirectSoundBuffer8_Stop(pDSB);2156 }2157 }2158 2128 } 2159 2129 break; … … 2460 2430 const uint64_t msThreshold = pThis->Cfg.msLatencyOut; 2461 2431 2462 Log 3Func(("diffLastPlayMs=%RU64ms\n", diffLastPlayMs));2432 Log2Func(("diffLastPlayMs=%RU64ms\n", diffLastPlayMs)); 2463 2433 2464 2434 cbPending = (diffLastPlayMs >= msThreshold) ? 0 : 1; 2465 2466 pStreamDS->Out.tsLastPlayMs = tsNowMs;2467 2435 } 2468 2436
Note:
See TracChangeset
for help on using the changeset viewer.

