Index: /trunk/src/VBox/Devices/Audio/DevHDA.cpp
===================================================================
--- /trunk/src/VBox/Devices/Audio/DevHDA.cpp	(revision 65021)
+++ /trunk/src/VBox/Devices/Audio/DevHDA.cpp	(revision 65022)
@@ -1065,4 +1065,5 @@
 static void          hdaTimerMaybeStart(PHDASTATE pThis);
 static void          hdaTimerMaybeStop(PHDASTATE pThis);
+static void          hdaTimerMain(PHDASTATE pThis);
 #endif
 /** @} */
@@ -3896,4 +3897,9 @@
 
 #ifndef VBOX_WITH_AUDIO_HDA_CALLBACKS
+/**
+ * Starts the internal audio device timer (if not started yet).
+ *
+ * @param   pThis               HDA state.
+ */
 static void hdaTimerMaybeStart(PHDASTATE pThis)
 {
@@ -3917,8 +3923,13 @@
 
         /* Start transfers. */
-        hdaDoTransfers(pThis);
-    }
-}
-
+        hdaTimerMain(pThis);
+    }
+}
+
+/**
+ * Stops the internal audio device timer (if not stopped yet).
+ *
+ * @param   pThis               HDA state.
+ */
 static void hdaTimerStop(PHDASTATE pThis)
 {
@@ -3943,5 +3954,11 @@
 }
 
-static void hdaDoTransfers(PHDASTATE pThis)
+/**
+ * Main routine for the device timer.
+ *
+ * @returns IPRT status code.
+ * @param   pThis               HDA state.
+ */
+static void hdaTimerMain(PHDASTATE pThis)
 {
     AssertPtrReturnVoid(pThis);
@@ -3960,34 +3977,5 @@
     bool fKickTimer = false;
 
-    PHDASTREAM pStreamLineIn  = hdaSinkGetStream(pThis, &pThis->SinkLineIn);
-#ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
-    PHDASTREAM pStreamMicIn   = hdaSinkGetStream(pThis, &pThis->SinkMicIn);
-#endif
-    PHDASTREAM pStreamFront   = hdaSinkGetStream(pThis, &pThis->SinkFront);
-#ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
-    /** @todo See note below. */
-#endif
-
-    hdaStreamUpdate(pThis, pStreamLineIn);
-#ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
-    hdaStreamUpdate(pThis, pStreamMicIn);
-#endif
-    hdaStreamUpdate(pThis, pStreamFront);
-
-
-#ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
-    int rc2 = AudioMixerSinkUpdate(pThis->SinkCenterLFE.pMixSink);
-    AssertRC(rc2);
-
-    rc2 = AudioMixerSinkUpdate(pThis->SinkRear.pMixSink);
-    AssertRC(rc2);
-    /** @todo Check for stream interleaving and only call hdaStreamDoDMA() if required! */
-
-    /*
-     * Only call hdaTransfer if CenterLFE and/or Rear are on different SDs,
-     * otherwise we have to use the interleaved streams support for getting the data
-     * out of the Front sink (depending on the mapping layout).
-     */
-#endif
+    hdaDoTransfers(pThis);
 
     /* Do we need to kick the timer again? */
@@ -4022,4 +4010,11 @@
 }
 
+/**
+ * Timer callback which handles the audio data transfers on a periodic basis.
+ *
+ * @param   pDevIns             Device instance.
+ * @param   pTimer              Timer which was used when calling this.
+ * @param   pvUser              User argument as PHDASTATE.
+ */
 static DECLCALLBACK(void) hdaTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
 {
@@ -4030,5 +4025,5 @@
     AssertPtr(pThis);
 
-    hdaDoTransfers(pThis);
+    hdaTimerMain(pThis);
 }
 
@@ -4082,4 +4077,44 @@
 }
 #endif /* VBOX_WITH_AUDIO_HDA_CALLBACKS */
+
+/**
+ * Main routine to perform the actual audio data transfers from the HDA streams
+ * to the backend(s) and vice versa.
+ *
+ * @param   pThis               HDA state.
+ */
+static void hdaDoTransfers(PHDASTATE pThis)
+{
+    PHDASTREAM pStreamLineIn  = hdaSinkGetStream(pThis, &pThis->SinkLineIn);
+#ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
+    PHDASTREAM pStreamMicIn   = hdaSinkGetStream(pThis, &pThis->SinkMicIn);
+#endif
+    PHDASTREAM pStreamFront   = hdaSinkGetStream(pThis, &pThis->SinkFront);
+#ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
+    /** @todo See note below. */
+#endif
+
+    hdaStreamUpdate(pThis, pStreamLineIn);
+#ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
+    hdaStreamUpdate(pThis, pStreamMicIn);
+#endif
+    hdaStreamUpdate(pThis, pStreamFront);
+
+
+#ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
+    int rc2 = AudioMixerSinkUpdate(pThis->SinkCenterLFE.pMixSink);
+    AssertRC(rc2);
+
+    rc2 = AudioMixerSinkUpdate(pThis->SinkRear.pMixSink);
+    AssertRC(rc2);
+    /** @todo Check for stream interleaving and only call hdaStreamDoDMA() if required! */
+
+    /*
+     * Only call hdaTransfer if CenterLFE and/or Rear are on different SDs,
+     * otherwise we have to use the interleaved streams support for getting the data
+     * out of the Front sink (depending on the mapping layout).
+     */
+#endif
+}
 
 #ifdef DEBUG_andy
@@ -4763,4 +4798,5 @@
             RTCircBufReleaseReadBlock(pCircBuf, cbDMA);
 
+            /* All DMA transfers done for now? */
             if (!cbDMA)
                 fDone = true;
