Index: /trunk/src/VBox/Devices/Audio/DrvHostAudioPulseAudio.cpp
===================================================================
--- /trunk/src/VBox/Devices/Audio/DrvHostAudioPulseAudio.cpp	(revision 88486)
+++ /trunk/src/VBox/Devices/Audio/DrvHostAudioPulseAudio.cpp	(revision 88487)
@@ -1030,10 +1030,15 @@
         /*
          * Set up buffer attributes according to the stream type.
+         *
+         * For output streams we configure pre-buffering as requested, since
+         * there is little point in using a different size than DrvAudio. This
+         * assumes that a 'drain' request will override the prebuf size.
          */
-        pStreamPA->BufAttr.maxlength = -1; /* Let the PulseAudio server choose the biggest size it can handle. */
+        pStreamPA->BufAttr.maxlength = UINT32_MAX; /* Let the PulseAudio server choose the biggest size it can handle. */
         if (pCfgReq->enmDir == PDMAUDIODIR_IN)
         {
             pStreamPA->BufAttr.fragsize  = PDMAudioPropsFramesToBytes(&pCfgReq->Props, pCfgReq->Backend.cFramesPeriod);
-            LogFunc(("Requesting: BufAttr: fragsize=%RU32 maxlength=-1\n", pStreamPA->BufAttr.fragsize));
+            LogFunc(("Requesting: BufAttr: fragsize=%RU32\n", pStreamPA->BufAttr.fragsize));
+            /* (rlength, minreq and prebuf are playback only) */
         }
         else
@@ -1041,6 +1046,9 @@
             pStreamPA->cUsLatency        = PDMAudioPropsFramesToMicro(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize);
             pStreamPA->BufAttr.tlength   = pa_usec_to_bytes(pStreamPA->cUsLatency, &pStreamPA->SampleSpec);
-            pStreamPA->BufAttr.prebuf    = pStreamPA->BufAttr.tlength;
             pStreamPA->BufAttr.minreq    = PDMAudioPropsFramesToBytes(&pCfgReq->Props, pCfgReq->Backend.cFramesPeriod);
+            pStreamPA->BufAttr.prebuf    = pa_usec_to_bytes(PDMAudioPropsFramesToMicro(&pCfgReq->Props,
+                                                                                       pCfgReq->Backend.cFramesPreBuffering),
+                                                            &pStreamPA->SampleSpec);
+            /* (fragsize is capture only) */
             LogRel2(("PulseAudio: Initial output latency is %RU64 us (%RU32 bytes)\n",
                      pStreamPA->cUsLatency, pStreamPA->BufAttr.tlength));
@@ -1073,5 +1081,7 @@
                 pCfgAcq->Backend.cFramesPeriod        = PDMAudioPropsBytesToFrames(&pCfgAcq->Props, pStreamPA->BufAttr.minreq);
                 pCfgAcq->Backend.cFramesBufferSize    = PDMAudioPropsBytesToFrames(&pCfgAcq->Props, pStreamPA->BufAttr.tlength);
-                pCfgAcq->Backend.cFramesPreBuffering  = PDMAudioPropsBytesToFrames(&pCfgAcq->Props, pStreamPA->BufAttr.prebuf);
+                pCfgAcq->Backend.cFramesPreBuffering  = pCfgReq->Backend.cFramesPreBuffering
+                                                      * pCfgAcq->Backend.cFramesBufferSize
+                                                      / RT_MAX(pCfgReq->Backend.cFramesBufferSize, 1);
             }
             PDMAudioStrmCfgCopy(&pStreamPA->Cfg, pCfgAcq);
