VirtualBox

Changeset 71117 in vbox


Ignore:
Timestamp:
Feb 23, 2018 5:56:51 PM (7 years ago)
Author:
vboxsync
Message:

Audio/DrvHostDSound.cpp: Removed unnecessary code to stop the playback buffer within the notification thread; the logic here is that the audio connector tells the backend when to stop playing as soon as there is no pending playback data left to be played (reported by the backend).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DrvHostDSound.cpp

    r70974 r71117  
    21262126                        }
    21272127                    }
    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 out
    2139                              * 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 estimate
    2142                              * 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                     }
    21582128                }
    21592129                break;
     
    24602430            const uint64_t msThreshold    = pThis->Cfg.msLatencyOut;
    24612431
    2462             Log3Func(("diffLastPlayMs=%RU64ms\n", diffLastPlayMs));
     2432            Log2Func(("diffLastPlayMs=%RU64ms\n", diffLastPlayMs));
    24632433
    24642434            cbPending = (diffLastPlayMs >= msThreshold) ? 0 : 1;
    2465 
    2466             pStreamDS->Out.tsLastPlayMs = tsNowMs;
    24672435        }
    24682436
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette