VirtualBox

Changeset 88002 in vbox


Ignore:
Timestamp:
Mar 8, 2021 11:28:46 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
143125
Message:

Audio: Swapped parameters for DrvAudioHlpNanoToFrames, DrvAudioHlpMilliToFrames, DrvAudioHlpNanoToBytes and DrvAudioHlpMilliToBytes and reimplemented them using integer math. Also inverted the relationship to avoid an unnecessary division in the frame variants. bugref:9890

Location:
trunk/src/VBox
Files:
11 edited

Legend:

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

    r87994 r88002  
    656656    if (RT_SUCCESS(rc))
    657657    {
    658         rc = RTCircBufCreate(&pMixStream->pCircBuf, DrvAudioHlpMilliToBytes(100 /* ms */, &pSink->PCMProps)); /** @todo Make this configurable. */
     658        rc = RTCircBufCreate(&pMixStream->pCircBuf, DrvAudioHlpMilliToBytes(&pSink->PCMProps, 100 /*ms*/)); /** @todo Make this configurable. */
    659659        AssertRC(rc);
    660660    }
     
    14951495    AudioMixBufDestroy(&pSink->MixBuf);
    14961496    rc = AudioMixBufInit(&pSink->MixBuf, pSink->pszName, &pSink->PCMProps,
    1497                          DrvAudioHlpMilliToFrames(100 /* ms */, &pSink->PCMProps)); /** @todo Make this configurable? */
     1497                         DrvAudioHlpMilliToFrames(&pSink->PCMProps, 100 /*ms*/)); /** @todo Make this configurable? */
    14981498    if (RT_SUCCESS(rc))
    14991499    {
  • trunk/src/VBox/Devices/Audio/DevIchAc97.cpp

    r87991 r88002  
    22282228                }
    22292229
    2230                 rc = RTCircBufCreate(&pStreamCC->State.pCircBuf, DrvAudioHlpMilliToBytes(100 /* ms */, &Cfg.Props)); /** @todo Make this configurable. */
     2230                rc = RTCircBufCreate(&pStreamCC->State.pCircBuf, DrvAudioHlpMilliToBytes(&Cfg.Props, 100 /*ms*/)); /** @todo Make this configurable. */
    22312231                if (RT_SUCCESS(rc))
    22322232                {
  • trunk/src/VBox/Devices/Audio/DrvAudio.cpp

    r87993 r88002  
    668668        LogRel2(("Audio: Stream '%s' got a scheduling hint of %RU32ms (%RU32 bytes)\n",
    669669                 pStream->szName, pCfgGuest->Device.cMsSchedulingHint,
    670                  DrvAudioHlpMilliToBytes(pCfgGuest->Device.cMsSchedulingHint, &pCfgGuest->Props)));
     670                 DrvAudioHlpMilliToBytes(&pCfgGuest->Props, pCfgGuest->Device.cMsSchedulingHint)));
    671671
    672672    /* Destroy any former mixing buffer. */
     
    15441544#endif
    15451545        const uint64_t tsDeltaPlayedCapturedNs = RTTimeNanoTS() - pStream->tsLastPlayedCapturedNs;
    1546         const uint32_t cfPassedReal            = DrvAudioHlpNanoToFrames(tsDeltaPlayedCapturedNs, &pStream->Host.Cfg.Props);
     1546        const uint32_t cfPassedReal            = DrvAudioHlpNanoToFrames(&pStream->Host.Cfg.Props, tsDeltaPlayedCapturedNs);
    15471547
    15481548        const uint32_t cFramesPeriod     = pStream->Host.Cfg.Backend.cFramesPeriod;
     
    16141614                /* Did we reach/pass (in real time) the device scheduling slot?
    16151615                 * Play as much as we can write to the backend then. */
    1616                 if (cfPassedReal >= DrvAudioHlpMilliToFrames(pStream->Guest.Cfg.Device.cMsSchedulingHint, &pStream->Host.Cfg.Props))
     1616                if (cfPassedReal >= DrvAudioHlpMilliToFrames(&pStream->Host.Cfg.Props, pStream->Guest.Cfg.Device.cMsSchedulingHint))
    16171617                    cfToPlay = cfWritable;
    16181618            }
     
    16521652                      "-> cfToPlay=%RU32 (%RU64ms), cfPlayed=%RU32 (%RU64ms)\n",
    16531653                      pStream->szName, fJustStarted,
    1654                       DrvAudioHlpMilliToFrames(pStream->Guest.Cfg.Device.cMsSchedulingHint, &pStream->Host.Cfg.Props),
     1654                      DrvAudioHlpMilliToFrames(&pStream->Host.Cfg.Props, pStream->Guest.Cfg.Device.cMsSchedulingHint),
    16551655                      pStream->Guest.Cfg.Device.cMsSchedulingHint,
    16561656                      cfPassedReal, DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cfPassedReal),
     
    29662966                || fDisabled)
    29672967            {
    2968                 cbReadable = DrvAudioHlpNanoToBytes(RTTimeNanoTS() - pStream->tsLastReadWrittenNs,
    2969                                                     &pStream->Host.Cfg.Props);
     2968                cbReadable = DrvAudioHlpNanoToBytes(&pStream->Host.Cfg.Props, RTTimeNanoTS() - pStream->tsLastReadWrittenNs);
    29702969                if (!(pStream->fWarningsShown & PDMAUDIOSTREAM_WARN_FLAGS_DISABLED))
    29712970                {
     
    32183217    if (pDrvCfg->uPeriodSizeMs)
    32193218    {
    3220         pCfgReq->Backend.cFramesPeriod = DrvAudioHlpMilliToFrames(pDrvCfg->uPeriodSizeMs, &pCfgReq->Props);
     3219        pCfgReq->Backend.cFramesPeriod = DrvAudioHlpMilliToFrames(&pCfgReq->Props, pDrvCfg->uPeriodSizeMs);
    32213220        RTStrPrintf(szWhat, sizeof(szWhat), "custom");
    32223221    }
     
    32243223    if (!pCfgReq->Backend.cFramesPeriod) /* Set default period size if nothing explicitly is set. */
    32253224    {
    3226         pCfgReq->Backend.cFramesPeriod = DrvAudioHlpMilliToFrames(150 /* ms */, &pCfgReq->Props);
     3225        pCfgReq->Backend.cFramesPeriod = DrvAudioHlpMilliToFrames(&pCfgReq->Props, 150 /*ms*/);
    32273226        RTStrPrintf(szWhat, sizeof(szWhat), "default");
    32283227    }
     
    32373236    if (pDrvCfg->uBufferSizeMs)
    32383237    {
    3239         pCfgReq->Backend.cFramesBufferSize = DrvAudioHlpMilliToFrames(pDrvCfg->uBufferSizeMs, &pCfgReq->Props);
     3238        pCfgReq->Backend.cFramesBufferSize = DrvAudioHlpMilliToFrames(&pCfgReq->Props, pDrvCfg->uBufferSizeMs);
    32403239        RTStrPrintf(szWhat, sizeof(szWhat), "custom");
    32413240    }
     
    32433242    if (!pCfgReq->Backend.cFramesBufferSize) /* Set default buffer size if nothing explicitly is set. */
    32443243    {
    3245         pCfgReq->Backend.cFramesBufferSize = DrvAudioHlpMilliToFrames(300 /* ms */, &pCfgReq->Props);
     3244        pCfgReq->Backend.cFramesBufferSize = DrvAudioHlpMilliToFrames(&pCfgReq->Props, 300 /*ms*/);
    32463245        RTStrPrintf(szWhat, sizeof(szWhat), "default");
    32473246    }
     
    32563255    if (pDrvCfg->uPreBufSizeMs != UINT32_MAX) /* Anything set via global / per-VM extra-data? */
    32573256    {
    3258         pCfgReq->Backend.cFramesPreBuffering = DrvAudioHlpMilliToFrames(pDrvCfg->uPreBufSizeMs, &pCfgReq->Props);
     3257        pCfgReq->Backend.cFramesPreBuffering = DrvAudioHlpMilliToFrames(&pCfgReq->Props, pDrvCfg->uPreBufSizeMs);
    32593258        RTStrPrintf(szWhat, sizeof(szWhat), "custom");
    32603259    }
  • trunk/src/VBox/Devices/Audio/DrvAudio.h

    r87994 r88002  
    207207uint64_t DrvAudioHlpFramesToMilli(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames);
    208208uint64_t DrvAudioHlpFramesToNano(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames);
    209 uint32_t DrvAudioHlpMilliToBytes(uint64_t uMs, PCPDMAUDIOPCMPROPS pProps);
    210 uint32_t DrvAudioHlpNanoToBytes(uint64_t uNs, PCPDMAUDIOPCMPROPS pProps);
    211 uint32_t DrvAudioHlpMilliToFrames(uint64_t uMs, PCPDMAUDIOPCMPROPS pProps);
    212 uint32_t DrvAudioHlpNanoToFrames(uint64_t uNs, PCPDMAUDIOPCMPROPS pProps);
     209uint32_t DrvAudioHlpMilliToBytes(PCPDMAUDIOPCMPROPS pProps, uint64_t cMs);
     210uint32_t DrvAudioHlpNanoToBytes(PCPDMAUDIOPCMPROPS pProps, uint64_t cNs);
     211uint32_t DrvAudioHlpMilliToFrames(PCPDMAUDIOPCMPROPS pProps, uint64_t cMs);
     212uint32_t DrvAudioHlpNanoToFrames(PCPDMAUDIOPCMPROPS pProps, uint64_t cNs);
    213213/** @}  */
    214214
  • trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp

    r87998 r88002  
    13621362
    13631363/**
    1364  * Returns the amount of bytes for a given time (in ms) and PCM properties.
    1365  *
    1366  * Note: The result will return an amount of bytes which is aligned to the audio frame size.
    1367  *
    1368  * @return  uint32_t            Calculated amount of bytes.
    1369  * @param   uMs                 Time (in ms) to calculate amount of bytes for.
    1370  * @param   pProps              PCM properties to calculate amount of bytes for.
    1371  */
    1372 uint32_t DrvAudioHlpMilliToBytes(uint64_t uMs, PCPDMAUDIOPCMPROPS pProps)
     1364 * Converts milliseconds to frames.
     1365 *
     1366 * @returns Number of frames
     1367 * @param   pProps      The PCM properties to use.
     1368 * @param   cMs         The number of milliseconds to convert.
     1369 *
     1370 * @note    The result is rounded rather than floored (hysterical raisins).
     1371 */
     1372uint32_t DrvAudioHlpMilliToFrames(PCPDMAUDIOPCMPROPS pProps, uint64_t cMs)
    13731373{
    13741374    AssertPtrReturn(pProps, 0);
    13751375
    1376     if (!uMs)
    1377         return 0;
    1378 
    1379     const uint32_t uBytesPerFrame = DrvAudioHlpPCMPropsBytesPerFrame(pProps);
    1380 
    1381     uint32_t uBytes = ((double)drvAudioHlpBytesPerSec(pProps) / (double)RT_MS_1SEC) * uMs;
    1382     if (uBytes % uBytesPerFrame) /* Any remainder? Make the returned bytes an integral number to the given frames. */
    1383         uBytes = uBytes + (uBytesPerFrame - uBytes % uBytesPerFrame);
    1384 
    1385     Assert(uBytes % uBytesPerFrame == 0); /* Paranoia. */
    1386 
    1387     return uBytes;
    1388 }
    1389 
    1390 /**
    1391  * Returns the amount of bytes for a given time (in ns) and PCM properties.
    1392  *
    1393  * Note: The result will return an amount of bytes which is aligned to the audio frame size.
    1394  *
    1395  * @return  uint32_t            Calculated amount of bytes.
    1396  * @param   uNs                 Time (in ns) to calculate amount of bytes for.
    1397  * @param   pProps              PCM properties to calculate amount of bytes for.
    1398  */
    1399 uint32_t DrvAudioHlpNanoToBytes(uint64_t uNs, PCPDMAUDIOPCMPROPS pProps)
     1376    uint32_t const uHz = pProps->uHz;
     1377    uint32_t cFrames;
     1378    if (cMs < RT_MS_1SEC)
     1379        cFrames = 0;
     1380    else
     1381    {
     1382        cFrames = cMs / RT_MS_1SEC * uHz;
     1383        cMs %= RT_MS_1SEC;
     1384    }
     1385    cFrames += (ASMMult2xU32RetU64(uHz, (uint32_t)cMs) + RT_MS_1SEC - 1) / RT_MS_1SEC;
     1386    return cFrames;
     1387}
     1388
     1389/**
     1390 * Converts milliseconds to bytes.
     1391 *
     1392 * @returns Number of bytes (frame aligned).
     1393 * @param   pProps      The PCM properties to use.
     1394 * @param   cMs         The number of milliseconds to convert.
     1395 *
     1396 * @note    The result is rounded rather than floored (hysterical raisins).
     1397 */
     1398uint32_t DrvAudioHlpMilliToBytes(PCPDMAUDIOPCMPROPS pProps, uint64_t cMs)
     1399{
     1400    return PDMAUDIOPCMPROPS_F2B(pProps, DrvAudioHlpMilliToFrames(pProps, cMs));
     1401}
     1402
     1403/**
     1404 * Converts nanoseconds to frames.
     1405 *
     1406 * @returns Number of frames
     1407 * @param   pProps      The PCM properties to use.
     1408 * @param   cNs         The number of nanoseconds to convert.
     1409 *
     1410 * @note    The result is rounded rather than floored (hysterical raisins).
     1411 */
     1412uint32_t DrvAudioHlpNanoToFrames(PCPDMAUDIOPCMPROPS pProps, uint64_t cNs)
    14001413{
    14011414    AssertPtrReturn(pProps, 0);
    14021415
    1403     if (!uNs)
    1404         return 0;
    1405 
    1406     const uint32_t uBytesPerFrame = DrvAudioHlpPCMPropsBytesPerFrame(pProps);
    1407 
    1408     uint32_t uBytes = ((double)drvAudioHlpBytesPerSec(pProps) / (double)RT_NS_1SEC) * uNs;
    1409     if (uBytes % uBytesPerFrame) /* Any remainder? Make the returned bytes an integral number to the given frames. */
    1410         uBytes = uBytes + (uBytesPerFrame - uBytes % uBytesPerFrame);
    1411 
    1412     Assert(uBytes % uBytesPerFrame == 0); /* Paranoia. */
    1413 
    1414     return uBytes;
    1415 }
    1416 
    1417 /**
    1418  * Returns the amount of audio frames for a given time (in ms) and PCM properties.
    1419  *
    1420  * @return  uint32_t            Calculated amount of audio frames.
    1421  * @param   uMs                 Time (in ms) to calculate amount of frames for.
    1422  * @param   pProps              PCM properties to calculate amount of frames for.
    1423  */
    1424 uint32_t DrvAudioHlpMilliToFrames(uint64_t uMs, PCPDMAUDIOPCMPROPS pProps)
    1425 {
    1426     AssertPtrReturn(pProps, 0);
    1427 
    1428     const uint32_t cbFrame = PDMAUDIOPCMPROPS_F2B(pProps, 1 /* Frame */);
    1429     if (!cbFrame) /* Prevent division by zero. */
    1430         return 0;
    1431 
    1432     return DrvAudioHlpMilliToBytes(uMs, pProps) / cbFrame;
    1433 }
    1434 
    1435 /**
    1436  * Returns the amount of audio frames for a given time (in ns) and PCM properties.
    1437  *
    1438  * @return  uint32_t            Calculated amount of audio frames.
    1439  * @param   uNs                 Time (in ns) to calculate amount of frames for.
    1440  * @param   pProps              PCM properties to calculate amount of frames for.
    1441  */
    1442 uint32_t DrvAudioHlpNanoToFrames(uint64_t uNs, PCPDMAUDIOPCMPROPS pProps)
    1443 {
    1444     AssertPtrReturn(pProps, 0);
    1445 
    1446     const uint32_t cbFrame = PDMAUDIOPCMPROPS_F2B(pProps, 1 /* Frame */);
    1447     if (!cbFrame) /* Prevent division by zero. */
    1448         return 0;
    1449 
    1450     return DrvAudioHlpNanoToBytes(uNs, pProps) / cbFrame;
     1416    uint32_t const uHz = pProps->uHz;
     1417    uint32_t cFrames;
     1418    if (cNs < RT_NS_1SEC)
     1419        cFrames = 0;
     1420    else
     1421    {
     1422        cFrames = cNs / RT_NS_1SEC * uHz;
     1423        cNs %= RT_NS_1SEC;
     1424    }
     1425    cFrames += (ASMMult2xU32RetU64(uHz, (uint32_t)cNs) + RT_NS_1SEC - 1) / RT_NS_1SEC;
     1426    return cFrames;
     1427}
     1428
     1429/**
     1430 * Converts nanoseconds to bytes.
     1431 *
     1432 * @returns Number of bytes (frame aligned).
     1433 * @param   pProps      The PCM properties to use.
     1434 * @param   cNs         The number of nanoseconds to convert.
     1435 *
     1436 * @note    The result is rounded rather than floored (hysterical raisins).
     1437 */
     1438uint32_t DrvAudioHlpNanoToBytes(PCPDMAUDIOPCMPROPS pProps, uint64_t cNs)
     1439{
     1440    return PDMAUDIOPCMPROPS_F2B(pProps, DrvAudioHlpNanoToFrames(pProps, cNs));
    14511441}
    14521442
  • trunk/src/VBox/Devices/Audio/DrvHostALSAAudio.cpp

    r87994 r88002  
    10391039        req.freq        = pCfgReq->Props.uHz;
    10401040        req.nchannels   = pCfgReq->Props.cChannels;
    1041         req.period_size = DrvAudioHlpMilliToFrames(50 /* ms */, &pCfgReq->Props); /** @todo Make this configurable. */
     1041        req.period_size = DrvAudioHlpMilliToFrames(&pCfgReq->Props, 50 /*ms*/); /** @todo Make this configurable. */
    10421042        req.buffer_size = req.period_size * 2; /** @todo Make this configurable. */
    10431043        req.threshold   = req.period_size;
  • trunk/src/VBox/Devices/Audio/DrvHostDebugAudio.cpp

    r87861 r88002  
    349349    AssertPtr(pStreamDbg->pCfg);
    350350
    351     return DrvAudioHlpMilliToBytes(10 /* ms */, &pStreamDbg->pCfg->Props);
     351    return DrvAudioHlpMilliToBytes(&pStreamDbg->pCfg->Props, 10 /*ms*/);
    352352}
    353353
  • trunk/src/VBox/Devices/Audio/HDAStream.cpp

    r87991 r88002  
    456456
    457457    /* Audio data per second the stream needs. */
    458     const uint32_t cbDataPerSec = DrvAudioHlpMilliToBytes(RT_MS_1SEC, &pStreamR3->State.Mapping.PCMProps);
     458    const uint32_t cbDataPerSec = DrvAudioHlpMilliToBytes(&pStreamR3->State.Mapping.PCMProps, RT_MS_1SEC);
    459459
    460460    /* This is used to indicate whether we're done or should the uTimerIoHz as fallback. */
     
    698698         *       channels we don't support / need to save space.
    699699         */
    700         uint32_t cbCircBuf = DrvAudioHlpMilliToBytes(RT_MS_1SEC * 6 / RT_MIN(uTransferHz, pStreamShared->State.uTimerIoHz),
    701                                                      &pCfg->Props);
     700        uint32_t cbCircBuf = DrvAudioHlpMilliToBytes(&pCfg->Props,
     701                                                     RT_MS_1SEC * 6 / RT_MIN(uTransferHz, pStreamShared->State.uTimerIoHz));
    702702        LogRel2(("HDA: Stream #%RU8 default ring buffer size is %RU32 bytes / %RU64 ms\n",
    703703                 uSD, cbCircBuf, DrvAudioHlpBytesToMilli(&pCfg->Props, cbCircBuf)));
     
    706706        if (msCircBufCfg) /* Anything set via CFGM? */
    707707        {
    708             cbCircBuf = DrvAudioHlpMilliToBytes(msCircBufCfg, &pCfg->Props);
     708            cbCircBuf = DrvAudioHlpMilliToBytes(&pCfg->Props, msCircBufCfg);
    709709            LogRel2(("HDA: Stream #%RU8 is using a custom ring buffer size of %RU32 bytes / %RU64 ms\n",
    710710                     uSD, cbCircBuf, DrvAudioHlpBytesToMilli(&pCfg->Props, cbCircBuf)));
  • trunk/src/VBox/Devices/Audio/testcase/tstAudioMixBuffer.cpp

    r87997 r88002  
    3535static void tstBasics(RTTEST hTest)
    3636{
    37     RTTestSub(hTest, "Single buffer");
     37    RTTestSub(hTest, "Basics");
    3838
    3939    static const PDMAUDIOPCMPROPS s_Cfg441StereoS16 = PDMAUDIOPCMPROPS_INITIALIZOR(
     
    104104    RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToMilli(&s_Cfg441StereoS16, 44100)) == RT_MS_1SEC, ("ms=%RU64\n", u64));
    105105    RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToMilli(&s_Cfg441StereoS16,   255)) == 5,          ("ms=%RU64\n", u64));
     106
     107    RTTESTI_CHECK_MSG((u32 = DrvAudioHlpNanoToFrames(&s_Cfg441StereoS16,  RT_NS_1SEC)) == 44100, ("cb=%RU32\n", u32));
     108    RTTESTI_CHECK_MSG((u32 = DrvAudioHlpNanoToFrames(&s_Cfg441StereoS16,      215876)) == 10,    ("cb=%RU32\n", u32));
     109    RTTESTI_CHECK_MSG((u32 = DrvAudioHlpMilliToFrames(&s_Cfg441StereoS16, RT_MS_1SEC)) == 44100, ("cb=%RU32\n", u32));
     110    RTTESTI_CHECK_MSG((u32 = DrvAudioHlpMilliToFrames(&s_Cfg441StereoU32,          6)) == 265,   ("cb=%RU32\n", u32));
     111
     112    RTTESTI_CHECK_MSG((u32 = DrvAudioHlpNanoToBytes(&s_Cfg441StereoS16,  RT_NS_1SEC)) == 44100*2*2, ("cb=%RU32\n", u32));
     113    RTTESTI_CHECK_MSG((u32 = DrvAudioHlpNanoToBytes(&s_Cfg441StereoS16,      702947)) == 31*2*2,    ("cb=%RU32\n", u32));
     114    RTTESTI_CHECK_MSG((u32 = DrvAudioHlpMilliToBytes(&s_Cfg441StereoS16, RT_MS_1SEC)) == 44100*2*2, ("cb=%RU32\n", u32));
     115    RTTESTI_CHECK_MSG((u32 = DrvAudioHlpMilliToBytes(&s_Cfg441StereoS16,          5)) == 884,       ("cb=%RU32\n", u32));
    106116
    107117    /* DrvAudioHlpClearBuf: */
  • trunk/src/VBox/Main/src-client/DrvAudioRec.cpp

    r87995 r88002  
    553553
    554554                    /* Every Opus frame marks a period for now. Optimize this later. */
    555                     pCfgAcq->Backend.cFramesPeriod     = DrvAudioHlpMilliToFrames(pSink->Codec.Opus.msFrame, &pCfgAcq->Props);
    556                     pCfgAcq->Backend.cFramesBufferSize = DrvAudioHlpMilliToFrames(100 /* ms */, &pCfgAcq->Props); /** @todo Make this configurable. */
    557                     pCfgAcq->Backend.cFramesPreBuffering     = pCfgAcq->Backend.cFramesPeriod * 2;
     555                    pCfgAcq->Backend.cFramesPeriod       = DrvAudioHlpMilliToFrames(&pCfgAcq->Props, pSink->Codec.Opus.msFrame);
     556                    pCfgAcq->Backend.cFramesBufferSize   = DrvAudioHlpMilliToFrames(&pCfgAcq->Props, 100 /*ms*/); /** @todo Make this configurable. */
     557                    pCfgAcq->Backend.cFramesPreBuffering = pCfgAcq->Backend.cFramesPeriod * 2;
    558558                }
    559559            }
  • trunk/src/VBox/Main/src-client/DrvAudioVRDE.cpp

    r87995 r88002  
    9393
    9494    /* According to the VRDP docs, the VRDP server stores audio in 200ms chunks. */
    95     const uint32_t cFramesVrdpServer = DrvAudioHlpMilliToFrames(200  /* ms */, &pCfgAcq->Props);
     95    const uint32_t cFramesVrdpServer = DrvAudioHlpMilliToFrames(&pCfgAcq->Props, 200 /*ms*/);
    9696
    9797    int rc = RTCircBufCreate(&pStreamVRDE->In.pCircBuf, DrvAudioHlpFramesToBytes(&pCfgAcq->Props, cFramesVrdpServer));
     
    137137
    138138        /* According to the VRDP docs, the VRDP server stores audio in 200ms chunks. */
    139         pCfgAcq->Backend.cFramesPeriod     = DrvAudioHlpMilliToFrames(20  /* ms */, &pCfgAcq->Props);
    140         pCfgAcq->Backend.cFramesBufferSize = DrvAudioHlpMilliToFrames(100 /* ms */, &pCfgAcq->Props);
    141         pCfgAcq->Backend.cFramesPreBuffering     = pCfgAcq->Backend.cFramesPeriod * 2;
     139        pCfgAcq->Backend.cFramesPeriod       = DrvAudioHlpMilliToFrames(&pCfgAcq->Props, 20  /*ms*/);
     140        pCfgAcq->Backend.cFramesBufferSize   = DrvAudioHlpMilliToFrames(&pCfgAcq->Props, 100 /*ms*/);
     141        pCfgAcq->Backend.cFramesPreBuffering = pCfgAcq->Backend.cFramesPeriod * 2;
    142142    }
    143143
     
    174174        {
    175175            rc = pDrv->pConsoleVRDPServer->SendAudioInputBegin(NULL, pStreamVRDE,
    176                                                                DrvAudioHlpMilliToFrames(200 /* ms */, &pStreamVRDE->pCfg->Props),
     176                                                               DrvAudioHlpMilliToFrames(&pStreamVRDE->pCfg->Props, 200 /*ms*/),
    177177                                                               pStreamVRDE->pCfg->Props.uHz, pStreamVRDE->pCfg->Props.cChannels,
    178178                                                               pStreamVRDE->pCfg->Props.cbSample * 8 /* Bit */);
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