VirtualBox

Changeset 88256 in vbox


Ignore:
Timestamp:
Mar 23, 2021 8:55:43 AM (4 years ago)
Author:
vboxsync
Message:

DrvAudio: Ditched the bogus scheduling and switched to always feeding the host audio driver whatever we've got handy (not a big change, except at start). bugref:9890

File:
1 edited

Legend:

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

    r88255 r88256  
    16901690    /*
    16911691     * Figure out how much to play now.
    1692      *
    1693      * The algorithm here is a litte dubious.  The first time we get here after
    1694      * pre-buffering is complete, we write one host DMA period wort of data to
    1695      * the host audio driver.  Then we refuse to write any more till one guest
    1696      * device DMA period has elapsed, but when then we try to write as much
    1697      * as we can to the host device driver.
    1698      */
    1699     uint32_t cbWritable = pThis->pHostDrvAudio->pfnStreamGetWritable(pThis->pHostDrvAudio, pStream->pvBackend);
     1692     * Easy, as much as the host audio backend will allow us to.
     1693     */
     1694    uint32_t cbWritable      = pThis->pHostDrvAudio->pfnStreamGetWritable(pThis->pHostDrvAudio, pStream->pvBackend);
    17001695    uint32_t cFramesWritable = PDMAUDIOPCMPROPS_B2F(&pStream->Host.Cfg.Props, cbWritable);
    1701     uint32_t cFramesToPlay;
    1702     if (!fJustStarted)
    1703         cFramesToPlay = 0;
    1704     else
    1705         cFramesToPlay = RT_MIN(cFramesWritable, pStream->Host.Cfg.Backend.cFramesPeriod);
    1706     if (!cFramesToPlay)
    1707     {
    1708         /* Did we reach/pass (in real time) the device scheduling slot?
    1709          * Play as much as we can write to the backend then. */
    1710         if (cFramesPassedReal >= PDMAudioPropsMilliToFrames(&pStream->Host.Cfg.Props, pStream->Guest.Cfg.Device.cMsSchedulingHint))
    1711             cFramesToPlay = cFramesWritable;
    1712     }
    1713 
    1714     if (cFramesToPlay > cFramesLive) /* Don't try to play more than available. */
     1696    uint32_t cFramesToPlay   = cFramesWritable;
     1697    if (cFramesToPlay > cFramesLive) /* Don't try to play more than available, we don't want to block. */
    17151698        cFramesToPlay = cFramesLive;
    17161699
     
    17651748    }
    17661749
    1767     Log3Func(("[%s] SchedHint=%RU32 ms (%RU32 fr) Passed=%RU64 ms (%RU32 fr) Live=%RU32 fr (%RU64 ms) Period=%RU32 fr (%RU64 ms) Writable=%RU32 fr (%RU64 ms) -> ToPlay=%RU32 fr (%RU64 ms) Played=%RU32 fr (%RU64 ms)%s\n",
    1768               pStream->szName, pStream->Guest.Cfg.Device.cMsSchedulingHint,
    1769               PDMAudioPropsMilliToFrames(&pStream->Host.Cfg.Props, pStream->Guest.Cfg.Device.cMsSchedulingHint),
     1750    Log3Func(("[%s] Passed=%RU64 ms (%RU32 fr) Live=%RU32 fr (%RU64 ms) Period=%RU32 fr (%RU64 ms) Writable=%RU32 fr (%RU64 ms) -> ToPlay=%RU32 fr (%RU64 ms) Played=%RU32 fr (%RU64 ms)%s\n",
     1751              pStream->szName,
    17701752              PDMAudioPropsFramesToMilli(&pStream->Host.Cfg.Props, cFramesPassedReal), cFramesPassedReal,
    17711753              cFramesLive, PDMAudioPropsFramesToMilli(&pStream->Host.Cfg.Props, cFramesLive),
     
    17761758              *pcFramesPlayed, PDMAudioPropsFramesToMilli(&pStream->Host.Cfg.Props, *pcFramesPlayed),
    17771759              fJustStarted ? "just-started" : ""));
     1760    RT_NOREF(fJustStarted);
    17781761
    17791762    if (RT_SUCCESS(rc))
     
    17861769        STAM_COUNTER_INC(&pStream->Out.Stats.TotalTimesPlayed);
    17871770    }
    1788 
    1789     Log3Func(("[%s] End fStatus=%s, cFramesLive=%RU32, cfPlayedTotal=%RU32, rc=%Rrc\n", pStream->szName,
    1790               dbgAudioStreamStatusToStr(szStreamSts, fStrmStatus), AudioMixBufLive(&pStream->Host.MixBuf), *pcFramesPlayed, rc));
    17911771    return rc;
    17921772}
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