Index: /trunk/src/VBox/Devices/Audio/DrvAudio.cpp
===================================================================
--- /trunk/src/VBox/Devices/Audio/DrvAudio.cpp	(revision 65026)
+++ /trunk/src/VBox/Devices/Audio/DrvAudio.cpp	(revision 65027)
@@ -935,6 +935,7 @@
 
 #ifdef VBOX_WITH_STATISTICS
-            STAM_COUNTER_ADD(&pThis->Stats.TotalSamplesMixed,        csMixed);
-            STAM_COUNTER_ADD(&pThis->Stats.TotalSamplesLost,         csWritten - csMixed);
+            STAM_COUNTER_ADD(&pThis->Stats.TotalSamplesMixedOut,     csMixed);
+            Assert(csWritten >= csMixed);
+            STAM_COUNTER_ADD(&pThis->Stats.TotalSamplesLostOut,      csWritten - csMixed);
             STAM_COUNTER_ADD(&pThis->Stats.TotalBytesWritten,        cbWritten);
             STAM_COUNTER_ADD(&pGstStream->Out.StatBytesTotalWritten, cbWritten);
@@ -1080,5 +1081,5 @@
     do
     {
-        uint32_t cSamplesMixed = 0;
+        uint32_t csMixed = 0;
 
         rc = pThis->pHostDrvAudio->pfnStreamIterate(pThis->pHostDrvAudio, pHstStream);
@@ -1089,10 +1090,10 @@
         {
             /* Has the host captured any samples which were not mixed to the guest side yet? */
-            uint32_t cSamplesCaptured = AudioMixBufUsed(&pHstStream->MixBuf);
-            if (cSamplesCaptured)
+            uint32_t csCaptured = AudioMixBufUsed(&pHstStream->MixBuf);
+            if (csCaptured)
             {
                 /* When capturing samples, the guest is the parent while the host is the child.
                  * So try mixing not yet mixed host-side samples to the guest-side buffer. */
-                rc = AudioMixBufMixToParent(&pHstStream->MixBuf, cSamplesCaptured, &cSamplesMixed);
+                rc = AudioMixBufMixToParent(&pHstStream->MixBuf, csCaptured, &csMixed);
                 if (RT_FAILURE(rc))
                 {
@@ -1106,5 +1107,10 @@
                 }
 
-                Log3Func(("[%s] %RU32/%RU32 input samples mixed, rc=%Rrc\n", pHstStream->szName, cSamplesMixed, cSamplesCaptured, rc));
+#ifdef VBOX_WITH_STATISTICS
+                STAM_COUNTER_ADD(&pThis->Stats.TotalSamplesMixedIn, csMixed);
+                Assert(csCaptured >= csMixed);
+                STAM_COUNTER_ADD(&pThis->Stats.TotalSamplesLostIn,  csCaptured - csMixed);
+#endif
+                Log3Func(("[%s] %RU32/%RU32 input samples mixed, rc=%Rrc\n", pHstStream->szName, csMixed, csCaptured, rc));
             }
             else
@@ -1249,5 +1255,5 @@
             {
 #ifdef VBOX_WITH_STATISTICS
-                STAM_COUNTER_ADD(&pThis->Stats.TotalSamplesPlayed, csPlayed);
+                STAM_COUNTER_ADD(&pThis->Stats.TotalSamplesOut, csPlayed);
                 STAM_PROFILE_ADV_STOP(&pThis->Stats.DelayOut, out);
                 STAM_COUNTER_ADD(&pHstStream->Out.StatSamplesPlayed, csPlayed);
@@ -1315,5 +1321,5 @@
                pStream->szName, pStream->enmDir));
 
-    uint32_t cSamplesCaptured = 0;
+    uint32_t csCaptured = 0;
 
     do
@@ -1336,6 +1342,6 @@
         PDMAUDIOSTRMSTS stsBackend = pThis->pHostDrvAudio->pfnStreamGetStatus(pThis->pHostDrvAudio, pHstStream);
 
-        uint32_t cSamplesLive = AudioMixBufLive(&pGstStream->MixBuf);
-        if (!cSamplesLive)
+        uint32_t csLive = AudioMixBufLive(&pGstStream->MixBuf);
+        if (!csLive)
         {
             if (   (stsBackend & PDMAUDIOSTRMSTS_FLAG_ENABLED)
@@ -1343,5 +1349,5 @@
             {
                 rc = pThis->pHostDrvAudio->pfnStreamCapture(pThis->pHostDrvAudio, pHstStream, NULL /* pvBuf */, 0 /* cbBuf */,
-                                                            &cSamplesCaptured);
+                                                            &csCaptured);
                 if (RT_FAILURE(rc))
                 {
@@ -1352,8 +1358,8 @@
                 {
 #ifdef VBOX_WITH_STATISTICS
-                    STAM_COUNTER_ADD(&pThis->Stats.TotalSamplesCaptured,  cSamplesCaptured);
-                    STAM_COUNTER_ADD(&pHstStream->In.StatSamplesCaptured, cSamplesCaptured);
-#endif
-                    Log3Func(("[%s] %RU32 samples captured\n", pHstStream->szName, cSamplesCaptured));
+                    STAM_COUNTER_ADD(&pThis->Stats.TotalSamplesIn,  csCaptured);
+                    STAM_COUNTER_ADD(&pHstStream->In.StatSamplesCaptured, csCaptured);
+#endif
+                    Log3Func(("[%s] %RU32 samples captured\n", pHstStream->szName, csCaptured));
                 }
             }
@@ -1368,5 +1374,5 @@
         }
         else
-            Log3Func(("[%s] Skipping (still has %RU32 live samples)\n", pHstStream->szName, cSamplesLive));
+            Log3Func(("[%s] Skipping (still has %RU32 live samples)\n", pHstStream->szName, csLive));
 
     } while (0);
@@ -1375,5 +1381,5 @@
     {
         if (pcSamplesCaptured)
-            *pcSamplesCaptured = cSamplesCaptured;
+            *pcSamplesCaptured = csCaptured;
     }
     else
@@ -2662,11 +2668,15 @@
         PDMDrvHlpSTAMRegCounterEx(pDrvIns, &pThis->Stats.TotalSamplesWritten,  "TotalSamplesWritten",
                                   STAMUNIT_COUNT, "Total samples written by device emulation ");
-        PDMDrvHlpSTAMRegCounterEx(pDrvIns, &pThis->Stats.TotalSamplesMixed,    "TotalSamplesMixed",
-                                  STAMUNIT_COUNT, "Total samples mixed.");
-        PDMDrvHlpSTAMRegCounterEx(pDrvIns, &pThis->Stats.TotalSamplesLost,     "TotalSamplesLost",
-                                  STAMUNIT_COUNT, "Total samples lost.");
-        PDMDrvHlpSTAMRegCounterEx(pDrvIns, &pThis->Stats.TotalSamplesPlayed,   "TotalSamplesPlayed",
+        PDMDrvHlpSTAMRegCounterEx(pDrvIns, &pThis->Stats.TotalSamplesMixedIn,  "TotalSamplesMixedIn",
+                                  STAMUNIT_COUNT, "Total input samples mixed.");
+        PDMDrvHlpSTAMRegCounterEx(pDrvIns, &pThis->Stats.TotalSamplesMixedOut, "TotalSamplesMixedOut",
+                                  STAMUNIT_COUNT, "Total output samples mixed.");
+        PDMDrvHlpSTAMRegCounterEx(pDrvIns, &pThis->Stats.TotalSamplesLostIn,   "TotalSamplesLostIn",
+                                  STAMUNIT_COUNT, "Total input samples lost.");
+        PDMDrvHlpSTAMRegCounterEx(pDrvIns, &pThis->Stats.TotalSamplesLostOut,  "TotalSamplesLostOut",
+                                  STAMUNIT_COUNT, "Total output samples lost.");
+        PDMDrvHlpSTAMRegCounterEx(pDrvIns, &pThis->Stats.TotalSamplesOut,   "TotalSamplesPlayed",
                                   STAMUNIT_COUNT, "Total samples played by backend.");
-        PDMDrvHlpSTAMRegCounterEx(pDrvIns, &pThis->Stats.TotalSamplesCaptured, "TotalSamplesCaptured",
+        PDMDrvHlpSTAMRegCounterEx(pDrvIns, &pThis->Stats.TotalSamplesIn, "TotalSamplesCaptured",
                                   STAMUNIT_COUNT, "Total samples captured by backend.");
         PDMDrvHlpSTAMRegCounterEx(pDrvIns, &pThis->Stats.TotalBytesRead,       "TotalBytesRead",
@@ -2766,8 +2776,10 @@
     PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pThis->Stats.TotalSamplesRead);
     PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pThis->Stats.TotalSamplesWritten);
-    PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pThis->Stats.TotalSamplesMixed);
-    PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pThis->Stats.TotalSamplesLost);
-    PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pThis->Stats.TotalSamplesPlayed);
-    PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pThis->Stats.TotalSamplesCaptured);
+    PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pThis->Stats.TotalSamplesMixedIn);
+    PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pThis->Stats.TotalSamplesMixedOut);
+    PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pThis->Stats.TotalSamplesLostIn);
+    PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pThis->Stats.TotalSamplesLostOut);
+    PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pThis->Stats.TotalSamplesOut);
+    PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pThis->Stats.TotalSamplesIn);
     PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pThis->Stats.TotalBytesRead);
     PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pThis->Stats.TotalBytesWritten);
Index: /trunk/src/VBox/Devices/Audio/DrvAudio.h
===================================================================
--- /trunk/src/VBox/Devices/Audio/DrvAudio.h	(revision 65026)
+++ /trunk/src/VBox/Devices/Audio/DrvAudio.h	(revision 65027)
@@ -84,8 +84,10 @@
     STAMCOUNTER TotalSamplesRead;
     STAMCOUNTER TotalSamplesWritten;
-    STAMCOUNTER TotalSamplesMixed;
-    STAMCOUNTER TotalSamplesLost;
-    STAMCOUNTER TotalSamplesPlayed;
-    STAMCOUNTER TotalSamplesCaptured;
+    STAMCOUNTER TotalSamplesMixedIn;
+    STAMCOUNTER TotalSamplesMixedOut;
+    STAMCOUNTER TotalSamplesLostIn;
+    STAMCOUNTER TotalSamplesLostOut;
+    STAMCOUNTER TotalSamplesOut;
+    STAMCOUNTER TotalSamplesIn;
     STAMCOUNTER TotalBytesRead;
     STAMCOUNTER TotalBytesWritten;
