Index: /trunk/src/VBox/Devices/Audio/DrvHostNullAudio.cpp
===================================================================
--- /trunk/src/VBox/Devices/Audio/DrvHostNullAudio.cpp	(revision 55648)
+++ /trunk/src/VBox/Devices/Audio/DrvHostNullAudio.cpp	(revision 55649)
@@ -61,4 +61,5 @@
     /** Note: Always must come first! */
     PDMAUDIOHSTSTRMOUT hw;
+    uint64_t u64TicksLast;
 } NULLAUDIOSTREAMOUT;
 
@@ -134,4 +135,6 @@
     if (RT_SUCCESS(rc))
     {
+        NULLAUDIOSTREAMOUT *pNullStrmOut = (NULLAUDIOSTREAMOUT *)pHstStrmOut;
+        pNullStrmOut->u64TicksLast = 0;
         if (pcSamples)
             *pcSamples = _1K;
@@ -151,6 +154,25 @@
                                                  uint32_t *pcSamplesPlayed)
 {
-    /* Always pretend consuming all samples available at this time. */
-    const uint32_t cSamplesPlayed = audioMixBufSize(&pHstStrmOut->MixBuf);
+    PDRVHOSTNULLAUDIO pDrv = RT_FROM_MEMBER(pInterface, DRVHOSTNULLAUDIO, IHostAudio);
+    NULLAUDIOSTREAMOUT *pNullStrmOut = (NULLAUDIOSTREAMOUT *)pHstStrmOut;
+
+    /* Consume as many samples as would be played at the current frequency since last call. */
+    uint32_t csLive = drvAudioHstOutSamplesLive(pHstStrmOut, NULL /* pcStreamsLive */);
+    uint64_t u64TicksNow = PDMDrvHlpTMGetVirtualTime(pDrv->pDrvIns);
+    uint64_t u64TicksElapsed = u64TicksNow  - pNullStrmOut->u64TicksLast;
+    uint64_t u64TicksFreq = PDMDrvHlpTMGetVirtualFreq(pDrv->pDrvIns);
+
+    /* Remember when samples were consumed. */
+    pNullStrmOut->u64TicksLast = u64TicksNow;
+
+    /* Minimize the rounding error by adding 0.5: samples = int((u64TicksElapsed * samplesFreq) / u64TicksFreq + 0.5).
+     * If rounding is not taken into account then the playback rate will be consistently lower that expected.
+     */
+    uint64_t cSamplesPlayed = (2 * u64TicksElapsed * pHstStrmOut->Props.uHz + u64TicksFreq) / u64TicksFreq / 2;
+
+    /* Don't play more than available. */
+    if (cSamplesPlayed > csLive)
+        cSamplesPlayed = csLive;
+
     audioMixBufFinish(&pHstStrmOut->MixBuf, cSamplesPlayed);
 
