Changeset 88256 in vbox
- Timestamp:
- Mar 23, 2021 8:55:43 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r88255 r88256 1690 1690 /* 1691 1691 * 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); 1700 1695 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. */ 1715 1698 cFramesToPlay = cFramesLive; 1716 1699 … … 1765 1748 } 1766 1749 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, 1770 1752 PDMAudioPropsFramesToMilli(&pStream->Host.Cfg.Props, cFramesPassedReal), cFramesPassedReal, 1771 1753 cFramesLive, PDMAudioPropsFramesToMilli(&pStream->Host.Cfg.Props, cFramesLive), … … 1776 1758 *pcFramesPlayed, PDMAudioPropsFramesToMilli(&pStream->Host.Cfg.Props, *pcFramesPlayed), 1777 1759 fJustStarted ? "just-started" : "")); 1760 RT_NOREF(fJustStarted); 1778 1761 1779 1762 if (RT_SUCCESS(rc)) … … 1786 1769 STAM_COUNTER_INC(&pStream->Out.Stats.TotalTimesPlayed); 1787 1770 } 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));1791 1771 return rc; 1792 1772 }
Note:
See TracChangeset
for help on using the changeset viewer.