Index: /trunk/src/VBox/Main/src-client/DrvAudioVRDE.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/DrvAudioVRDE.cpp	(revision 55649)
+++ /trunk/src/VBox/Main/src-client/DrvAudioVRDE.cpp	(revision 55650)
@@ -216,7 +216,4 @@
     AssertPtrReturn(pVRDEStrmOut, VERR_INVALID_POINTER);
 
-    /*
-     * Just call the VRDP server with the data.
-     */
     uint32_t live = drvAudioHstOutSamplesLive(pHstStrmOut, NULL /* pcStreamsLive */);
     uint64_t now = PDMDrvHlpTMGetVirtualTime(pDrv->pDrvIns);
@@ -224,7 +221,13 @@
     uint64_t ticks_per_second = PDMDrvHlpTMGetVirtualFreq(pDrv->pDrvIns);
 
+    /* Minimize the rounding error: samples = int((ticks * freq) / ticks_per_second + 0.5). */
     uint32_t cSamplesPlayed = (int)((2 * ticks * pHstStrmOut->Props.uHz + ticks_per_second) / ticks_per_second / 2);
-    if (!cSamplesPlayed)
+
+    /* Don't play more than available. */
+    if (cSamplesPlayed > live)
         cSamplesPlayed = live;
+
+    /* Remember when samples were consumed. */
+    pVRDEStrmOut->old_ticks = now;
 
     VRDEAUDIOFORMAT format = VRDE_AUDIO_FMT_MAKE(pHstStrmOut->Props.uHz,
@@ -233,15 +236,5 @@
                                                  pHstStrmOut->Props.fSigned);
 
-    pVRDEStrmOut->old_ticks = now;
-
-    int cSamplesToSend = live;
-
-/*  if (!cSamplesToSend)
-    {
-        if (pcSamplesPlayed)
-            pcSamplesPlayed = 0;
-
-        return 0;
-    }*/
+    int cSamplesToSend = cSamplesPlayed;
 
     LogFlowFunc(("uFreq=%RU32, cChan=%RU8, cBits=%RU8, fSigned=%RTbool, enmFormat=%ld, cSamplesToSend=%RU32\n",
@@ -250,4 +243,7 @@
                  format, cSamplesToSend));
 
+    /*
+     * Call the VRDP server with the data.
+     */
     uint32_t cReadTotal = 0;
 
