VirtualBox

Changeset 87585 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Feb 3, 2021 4:41:18 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
142614
Message:

Audio/HDA: More timing-related fixes for Windows guests. This is a risky change and needs more testing / verification on other guests. Only got limited testing for Win10 AU / Win10 20H2 and Ubuntu 20.10 guests so far [build fix]. ticketoem2ref:36

Location:
trunk/src/VBox/Devices/Audio
Files:
2 edited

Legend:

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

    r87253 r87585  
    938938               pStream->szName, DrvAudioHlpAudDirToStr(pStream->enmDir)));
    939939
    940     AssertMsg(DrvAudioHlpBytesIsAligned(cbBuf, &pStream->Guest.Cfg.Props),
    941               ("Stream '%s' got a non-frame-aligned write (%RU32 bytes)\n", pStream->szName, cbBuf));
     940    /*AssertMsg(DrvAudioHlpBytesIsAligned(cbBuf, &pStream->Guest.Cfg.Props),
     941              ("Stream '%s' got a non-frame-aligned write (%RU32 bytes)\n", pStream->szName, cbBuf));*/
    942942
    943943    uint32_t cbWrittenTotal = 0;
     
    10041004            || !cfGstWritten)
    10051005        {
    1006             AssertMsgFailed(("[%s] Write failed: cbToWrite=%RU32, cfWritten=%RU32, rc=%Rrc\n",
    1007                              pStream->szName, cbToWrite, cfGstWritten, rc));
    10081006            break;
    10091007        }
     
    23342332#define QUERY_CONFIG(a_InOut) \
    23352333    /* PCM stuff. */ \
    2336     CFGMR3QueryU8Def (pNode, "PCMSampleBit"         #a_InOut, &pCfg->Props.cbSample,  0); \
    2337     CFGMR3QueryU32Def(pNode, "PCMSampleHz"          #a_InOut, &pCfg->Props.uHz,       0); \
    2338     CFGMR3QueryU8Def (pNode, "PCMSampleSigned"      #a_InOut, &pCfg->uSigned,         UINT8_MAX /* No custom value set */); \
    2339     CFGMR3QueryU8Def (pNode, "PCMSampleSwapEndian"  #a_InOut, &pCfg->uSwapEndian,     UINT8_MAX /* No custom value set */); \
    2340     CFGMR3QueryU8Def (pNode, "PCMSampleChannels"    #a_InOut, &pCfg->Props.cChannels, 0); \
     2334    CFGMR3QueryU8Def (pNode, "xPCMSampleBit"         #a_InOut, &pCfg->Props.cbSample,  0); \
     2335    CFGMR3QueryU32Def(pNode, "xPCMSampleHz"          #a_InOut, &pCfg->Props.uHz,       0); \
     2336    CFGMR3QueryU8Def (pNode, "xPCMSampleSigned"      #a_InOut, &pCfg->uSigned,         UINT8_MAX /* No custom value set */); \
     2337    CFGMR3QueryU8Def (pNode, "xPCMSampleSwapEndian"  #a_InOut, &pCfg->uSwapEndian,     UINT8_MAX /* No custom value set */); \
     2338    CFGMR3QueryU8Def (pNode, "xPCMSampleChannels"    #a_InOut, &pCfg->Props.cChannels, 0); \
    23412339    \
    23422340    /* Buffering stuff. */ \
    2343     CFGMR3QueryU32Def(pNode, "PeriodSizeMs"         #a_InOut, &pCfg->uPeriodSizeMs, 0); \
    2344     CFGMR3QueryU32Def(pNode, "BufferSizeMs"         #a_InOut, &pCfg->uBufferSizeMs, 0); \
    2345     CFGMR3QueryU32Def(pNode, "PreBufferSizeMs"      #a_InOut, &pCfg->uPreBufSizeMs, UINT32_MAX /* No custom value set */);
     2341    CFGMR3QueryU32Def(pNode, "xPeriodSizeMs"         #a_InOut, &pCfg->uPeriodSizeMs, 0); \
     2342    CFGMR3QueryU32Def(pNode, "xBufferSizeMs"         #a_InOut, &pCfg->uBufferSizeMs, 0); \
     2343    CFGMR3QueryU32Def(pNode, "xPreBufferSizeMs"      #a_InOut, &pCfg->uPreBufSizeMs, UINT32_MAX /* No custom value set */);
    23462344
    23472345    if (enmDir == PDMAUDIODIR_IN)
  • trunk/src/VBox/Devices/Audio/HDAStream.cpp

    r87583 r87585  
    2929#include <VBox/vmm/pdmdev.h>
    3030#include <VBox/vmm/pdmaudioifs.h>
    31 
    32 #include <math.h> /* Needed for roundl(). */
    3331
    3432#include "DrvAudio.h"
     
    548546                const double cTicksPerByte = cTicksPerHz / (double)pStreamShared->State.cbTransferChunk;
    549547
     548#define HDA_ROUND_NEAREST(a_X) ((a_X) >= 0 ? (uint32_t)((a_X) + 0.5) : (uint32_t)((a_X) - 0.5)) /** @todo r=andy Do we have rounding in IPRT? */
     549
    550550                /* Calculate the timer ticks per byte for this stream. */
    551                 pStreamShared->State.cTicksPerByte = roundl(cTicksPerByte); /** @todo r=andy Do we have rounding in IPRT? */
     551                pStreamShared->State.cTicksPerByte = HDA_ROUND_NEAREST(cTicksPerByte);
    552552                Assert(pStreamShared->State.cTicksPerByte);
    553553
     
    555555
    556556                /* Calculate timer ticks per transfer. */
    557                 pStreamShared->State.cTransferTicks = roundl(cTransferTicks);
     557                pStreamShared->State.cTransferTicks = HDA_ROUND_NEAREST(cTransferTicks);
    558558                Assert(pStreamShared->State.cTransferTicks);
     559
     560#undef HDA_ROUND_NEAREST
    559561
    560562                LogRel2(("HDA: Stream #%RU8 is using %uHz device timer (%RU64 virtual ticks / Hz), stream Hz=%RU32, "
     
    21102112
    21112113#endif /* IN_RING3 */
    2112 
Note: See TracChangeset for help on using the changeset viewer.

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