VirtualBox

Changeset 87994 in vbox


Ignore:
Timestamp:
Mar 7, 2021 3:22:36 PM (4 years ago)
Author:
vboxsync
Message:

Audio: Switched DrvAudioHlpFramesToBytes parameters. bugref:9890

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

Legend:

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

    r87991 r87994  
    17151715            break;
    17161716
    1717         const uint32_t cbChunk = DrvAudioHlpFramesToBytes(cfChunk, &pSink->PCMProps);
     1717        const uint32_t cbChunk = DrvAudioHlpFramesToBytes(&pSink->PCMProps, cfChunk);
    17181718        Assert(cbChunk <= pSink->cbScratchBuf);
    17191719
     
    21192119            break;
    21202120
    2121         const uint32_t cbWrittenChunk = DrvAudioHlpFramesToBytes(cfWritten, &pSink->PCMProps);
     2121        const uint32_t cbWrittenChunk = DrvAudioHlpFramesToBytes(&pSink->PCMProps, cfWritten);
    21222122
    21232123        Assert(cbToWrite >= cbWrittenChunk);
  • trunk/src/VBox/Devices/Audio/DrvAudio.h

    r87993 r87994  
    204204uint64_t DrvAudioHlpBytesToMicro(PCPDMAUDIOPCMPROPS pProps, uint32_t cb);
    205205uint64_t DrvAudioHlpBytesToNano(PCPDMAUDIOPCMPROPS pProps, uint32_t cb);
    206 uint32_t DrvAudioHlpFramesToBytes(uint32_t cFrames, PCPDMAUDIOPCMPROPS pProps);
     206uint32_t DrvAudioHlpFramesToBytes(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames);
    207207uint64_t DrvAudioHlpFramesToMilli(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames);
    208208uint64_t DrvAudioHlpFramesToNano(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames);
  • trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp

    r87993 r87994  
    137137
    138138    Assert(pPCMProps->cbSample);
    139     size_t cbToClear = DrvAudioHlpFramesToBytes(cFrames, pPCMProps);
     139    size_t cbToClear = DrvAudioHlpFramesToBytes(pPCMProps, cFrames);
    140140    Assert(cbBuf >= cbToClear);
    141141
     
    13241324
    13251325/**
    1326  * Returns the bytes for a given audio frames amount and PCM properties.
    1327  *
    1328  * @return Calculated bytes for given audio frames.
    1329  * @param  cFrames              Amount of audio frames to calculate bytes for.
    1330  * @param  pProps               PCM properties to calculate bytes for.
    1331  */
    1332 uint32_t DrvAudioHlpFramesToBytes(uint32_t cFrames, PCPDMAUDIOPCMPROPS pProps)
     1326 * Converts frames to bytes.
     1327 *
     1328 * @return Number of bytes.
     1329 * @param   pProps      The PCM properties to use.
     1330 * @param   cFrames     Number of audio frames to convert.
     1331 */
     1332uint32_t DrvAudioHlpFramesToBytes(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames)
    13331333{
    13341334    AssertPtrReturn(pProps, 0);
    1335 
    1336     if (!cFrames)
    1337         return 0;
    1338 
    1339     return cFrames * PDMAUDIOPCMPROPS_F2B(pProps, 1 /* Frame */);
     1335    return PDMAUDIOPCMPROPS_F2B(pProps, cFrames);
    13401336}
    13411337
  • trunk/src/VBox/Devices/Audio/DrvHostALSAAudio.cpp

    r87300 r87994  
    15011501    Log2Func(("cFramesDelay=%RI32, enmState=%d, rc=%d\n", cFramesDelay, enmState, rc));
    15021502
    1503     return DrvAudioHlpFramesToBytes(cFramesDelay, &pStreamALSA->pCfg->Props);
     1503    return DrvAudioHlpFramesToBytes(&pStreamALSA->pCfg->Props, cFramesDelay);
    15041504}
    15051505
  • trunk/src/VBox/Devices/Audio/DrvHostCoreAudio.cpp

    r87639 r87994  
    13051305        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
    13061306
    1307     const size_t cbBufSize = DrvAudioHlpFramesToBytes(pCAStream->pCfg->Backend.cFramesPeriod, &pCAStream->pCfg->Props);
     1307    const size_t cbBufSize = DrvAudioHlpFramesToBytes(&pCAStream->pCfg->Props, pCAStream->pCfg->Backend.cFramesPeriod);
    13081308
    13091309    /*
  • trunk/src/VBox/Devices/Audio/DrvHostDSound.cpp

    r87991 r87994  
    666666         */
    667667        bd.dwFlags       = DSBCAPS_GLOBALFOCUS | DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_LOCSOFTWARE;
    668         bd.dwBufferBytes = DrvAudioHlpFramesToBytes(pCfgReq->Backend.cFramesBufferSize, &pCfgReq->Props);
     668        bd.dwBufferBytes = DrvAudioHlpFramesToBytes(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize);
    669669
    670670        DSLOG(("DSound: Requested playback buffer is %RU64ms (%ld bytes)\n",
     
    895895
    896896    if (   pStreamDS->Out.fFirstTransfer
    897         && pStreamDS->Out.cbTransferred >= DrvAudioHlpFramesToBytes(pStreamDS->Cfg.Backend.cFramesPreBuffering, &pStreamDS->Cfg.Props))
     897        && pStreamDS->Out.cbTransferred >= DrvAudioHlpFramesToBytes(&pStreamDS->Cfg.Props, pStreamDS->Cfg.Backend.cFramesPreBuffering))
    898898    {
    899899        hr = directSoundPlayStart(pThis, pStreamDS);
     
    14011401        bd.dwSize        = sizeof(bd);
    14021402        bd.lpwfxFormat   = &wfx;
    1403         bd.dwBufferBytes = DrvAudioHlpFramesToBytes(pCfgReq->Backend.cFramesBufferSize, &pCfgReq->Props);
     1403        bd.dwBufferBytes = DrvAudioHlpFramesToBytes(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize);
    14041404
    14051405        DSLOG(("DSound: Requested capture buffer is %RU64ms (%ld bytes)\n",
  • trunk/src/VBox/Devices/Audio/DrvHostPulseAudio.cpp

    r87993 r87994  
    803803    pStreamPA->BufAttr.maxlength   = -1; /* Let the PulseAudio server choose the biggest size it can handle. */
    804804    pStreamPA->BufAttr.prebuf      = cbLatency;
    805     pStreamPA->BufAttr.minreq      = DrvAudioHlpFramesToBytes(pCfgReq->Backend.cFramesPeriod, &pCfgReq->Props);
     805    pStreamPA->BufAttr.minreq      = DrvAudioHlpFramesToBytes(&pCfgReq->Props, pCfgReq->Backend.cFramesPeriod);
    806806
    807807    LogFunc(("Requested: BufAttr tlength=%RU32, maxLength=%RU32, minReq=%RU32\n",
     
    849849    pStreamPA->SampleSpec.channels = pCfgReq->Props.cChannels;
    850850
    851     pStreamPA->BufAttr.fragsize    = DrvAudioHlpFramesToBytes(pCfgReq->Backend.cFramesPeriod, &pCfgReq->Props);
     851    pStreamPA->BufAttr.fragsize    = DrvAudioHlpFramesToBytes(&pCfgReq->Props, pCfgReq->Backend.cFramesPeriod);
    852852    pStreamPA->BufAttr.maxlength   = -1; /* Let the PulseAudio server choose the biggest size it can handle. */
    853853
  • trunk/src/VBox/Devices/Audio/DrvHostValidationKit.cpp

    r82968 r87994  
    145145    pStreamDbg->uSamplesSinceStarted = 0;
    146146    pStreamDbg->Out.tsLastPlayed  = 0;
    147     pStreamDbg->Out.cbPlayBuffer  = DrvAudioHlpFramesToBytes(pCfgReq->Backend.cFramesBufferSize, &pCfgReq->Props);
     147    pStreamDbg->Out.cbPlayBuffer  = DrvAudioHlpFramesToBytes(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize);
    148148    pStreamDbg->Out.pu8PlayBuffer = (uint8_t *)RTMemAlloc(pStreamDbg->Out.cbPlayBuffer);
    149149    AssertReturn(pStreamDbg->Out.pu8PlayBuffer, VERR_NO_MEMORY);
  • trunk/src/VBox/Devices/Audio/testcase/tstAudioMixBuffer.cpp

    r87993 r87994  
    5050
    5151    uint32_t u32;
    52     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpFramesToBytes(44100, &s_Cfg441StereoS16)) == 44100 * 2 * 2,
     52    RTTESTI_CHECK_MSG((u32 = DrvAudioHlpFramesToBytes(&s_Cfg441StereoS16, 44100)) == 44100 * 2 * 2,
    5353                      ("cb=%RU32\n", u32));
    54     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpFramesToBytes(2, &s_Cfg441StereoS16)) == 2 * 2 * 2,
     54    RTTESTI_CHECK_MSG((u32 = DrvAudioHlpFramesToBytes(&s_Cfg441StereoS16, 2)) == 2 * 2 * 2,
    5555                      ("cb=%RU32\n", u32));
    5656
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