VirtualBox

Changeset 88487 in vbox


Ignore:
Timestamp:
Apr 13, 2021 9:56:59 AM (3 years ago)
Author:
vboxsync
Message:

DrvHostAudioPulseAudio: Aligned pre-buffering config with ALSA and OSS, i.e. don't set the playback threshold too high and preserve the ratio to the actual buffer size. bugref:9890

File:
1 edited

Legend:

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

    r88486 r88487  
    10301030        /*
    10311031         * Set up buffer attributes according to the stream type.
     1032         *
     1033         * For output streams we configure pre-buffering as requested, since
     1034         * there is little point in using a different size than DrvAudio. This
     1035         * assumes that a 'drain' request will override the prebuf size.
    10321036         */
    1033         pStreamPA->BufAttr.maxlength = -1; /* Let the PulseAudio server choose the biggest size it can handle. */
     1037        pStreamPA->BufAttr.maxlength = UINT32_MAX; /* Let the PulseAudio server choose the biggest size it can handle. */
    10341038        if (pCfgReq->enmDir == PDMAUDIODIR_IN)
    10351039        {
    10361040            pStreamPA->BufAttr.fragsize  = PDMAudioPropsFramesToBytes(&pCfgReq->Props, pCfgReq->Backend.cFramesPeriod);
    1037             LogFunc(("Requesting: BufAttr: fragsize=%RU32 maxlength=-1\n", pStreamPA->BufAttr.fragsize));
     1041            LogFunc(("Requesting: BufAttr: fragsize=%RU32\n", pStreamPA->BufAttr.fragsize));
     1042            /* (rlength, minreq and prebuf are playback only) */
    10381043        }
    10391044        else
     
    10411046            pStreamPA->cUsLatency        = PDMAudioPropsFramesToMicro(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize);
    10421047            pStreamPA->BufAttr.tlength   = pa_usec_to_bytes(pStreamPA->cUsLatency, &pStreamPA->SampleSpec);
    1043             pStreamPA->BufAttr.prebuf    = pStreamPA->BufAttr.tlength;
    10441048            pStreamPA->BufAttr.minreq    = PDMAudioPropsFramesToBytes(&pCfgReq->Props, pCfgReq->Backend.cFramesPeriod);
     1049            pStreamPA->BufAttr.prebuf    = pa_usec_to_bytes(PDMAudioPropsFramesToMicro(&pCfgReq->Props,
     1050                                                                                       pCfgReq->Backend.cFramesPreBuffering),
     1051                                                            &pStreamPA->SampleSpec);
     1052            /* (fragsize is capture only) */
    10451053            LogRel2(("PulseAudio: Initial output latency is %RU64 us (%RU32 bytes)\n",
    10461054                     pStreamPA->cUsLatency, pStreamPA->BufAttr.tlength));
     
    10731081                pCfgAcq->Backend.cFramesPeriod        = PDMAudioPropsBytesToFrames(&pCfgAcq->Props, pStreamPA->BufAttr.minreq);
    10741082                pCfgAcq->Backend.cFramesBufferSize    = PDMAudioPropsBytesToFrames(&pCfgAcq->Props, pStreamPA->BufAttr.tlength);
    1075                 pCfgAcq->Backend.cFramesPreBuffering  = PDMAudioPropsBytesToFrames(&pCfgAcq->Props, pStreamPA->BufAttr.prebuf);
     1083                pCfgAcq->Backend.cFramesPreBuffering  = pCfgReq->Backend.cFramesPreBuffering
     1084                                                      * pCfgAcq->Backend.cFramesBufferSize
     1085                                                      / RT_MAX(pCfgReq->Backend.cFramesBufferSize, 1);
    10761086            }
    10771087            PDMAudioStrmCfgCopy(&pStreamPA->Cfg, pCfgAcq);
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