Index: trunk/src/VBox/Devices/Audio/AudioMixer.cpp
===================================================================
--- trunk/src/VBox/Devices/Audio/AudioMixer.cpp	(revision 98455)
+++ trunk/src/VBox/Devices/Audio/AudioMixer.cpp	(revision 98456)
@@ -113,5 +113,4 @@
 static int audioMixerSinkRemoveStreamInternal(PAUDMIXSINK pSink, PAUDMIXSTREAM pStream);
 static void audioMixerSinkResetInternal(PAUDMIXSINK pSink);
-static int audioMixerSinkWaitForDrainedLocked(PAUDMIXSINK pSink, RTMSINTERVAL msTimeout);
 
 static int audioMixerStreamCtlInternal(PAUDMIXSTREAM pMixStream, PDMAUDIOSTREAMCMD enmCmd);
@@ -415,11 +414,10 @@
             /* AIO */
             AssertPtr(pDevIns);
-            pSink->AIO.pDevIns       = pDevIns;
-            pSink->AIO.hThread       = NIL_RTTHREAD;
-            pSink->AIO.hEvent        = NIL_RTSEMEVENT;
-            pSink->AIO.hEventDrained = NIL_RTSEMEVENT;
-            pSink->AIO.fStarted      = false;
-            pSink->AIO.fShutdown     = false;
-            pSink->AIO.cUpdateJobs   = 0;
+            pSink->AIO.pDevIns     = pDevIns;
+            pSink->AIO.hThread     = NIL_RTTHREAD;
+            pSink->AIO.hEvent      = NIL_RTSEMEVENT;
+            pSink->AIO.fStarted    = false;
+            pSink->AIO.fShutdown   = false;
+            pSink->AIO.cUpdateJobs = 0;
 
             /*
@@ -580,8 +578,6 @@
  *                      buffers that the update job has yet to transfer.  This
  *                      is ignored for input streams.
- * @param   msTimeout   Timeout to use for synchronously waiting for the draining / update jobs.
- *                      Set to 0 for running asynchronously.
- */
-int AudioMixerSinkDrainAndStopEx(PAUDMIXSINK pSink, uint32_t cbComming, RTMSINTERVAL msTimeout)
+ */
+int AudioMixerSinkDrainAndStop(PAUDMIXSINK pSink, uint32_t cbComming)
 {
     AssertPtrReturn(pSink, VERR_INVALID_POINTER);
@@ -624,16 +620,4 @@
                        status. (The device's DMA timer won't kick it any more, so we must.) */
                     AudioMixerSinkSignalUpdateJob(pSink);
-#ifdef LOG_ENABLED
-                    uint64_t const msStart = RTTimeMilliTS();
-                    Log3Func(("Waiting for %RU32 update jobs (msTimeout=%RU32)\n", pSink->AIO.cUpdateJobs, msTimeout));
-#endif
-                    if (   msTimeout
-                        && pSink->AIO.cUpdateJobs)
-                    {
-                        rc = audioMixerSinkWaitForDrainedLocked(pSink, msTimeout);
-#ifdef LOG_ENABLED
-                        Log3Func(("Waiting for update jobs done (rc=%Rrc, took %RU64ms)\n", rc, RTTimeMilliTS() - msStart));
-#endif
-                    }
                 }
                 else
@@ -678,23 +662,4 @@
 
 /**
- * Kicks off the draining and stopping playback/capture on the mixer sink.
- *
- * For input streams this causes an immediate stop, as draining only makes sense
- * to output stream in the VBox device context.
- *
- * @returns VBox status code.  Generally always VINF_SUCCESS unless the input
- *          is invalid.  Individual driver errors are suppressed and ignored.
- * @param   pSink       Mixer sink to control.
- * @param   cbComming   The number of bytes still left in the device's DMA
- *                      buffers that the update job has yet to transfer.  This
- *                      is ignored for input streams.
- */
-int AudioMixerSinkDrainAndStop(PAUDMIXSINK pSink, uint32_t cbComming)
-{
-    return AudioMixerSinkDrainAndStopEx(pSink, cbComming, 0 /* Don't wait */);
-}
-
-
-/**
  * Destroys and frees a mixer sink.
  *
@@ -755,9 +720,4 @@
     {
         int rc2 = RTSemEventSignal(pSink->AIO.hEvent);
-        AssertRC(rc2);
-    }
-    if (pSink->AIO.hEventDrained != NIL_RTSEMEVENT)
-    {
-        int rc2 = RTSemEventSignal(pSink->AIO.hEventDrained);
         AssertRC(rc2);
     }
@@ -774,10 +734,4 @@
         AssertRC(rc2);
         pSink->AIO.hEvent = NIL_RTSEMEVENT;
-    }
-    if (pSink->AIO.hEventDrained != NIL_RTSEMEVENT)
-    {
-        int rc2 = RTSemEventDestroy(pSink->AIO.hEventDrained);
-        AssertRC(rc2);
-        pSink->AIO.hEventDrained = NIL_RTSEMEVENT;
     }
 
@@ -1817,9 +1771,4 @@
      * The run loop.
      */
-    bool fDrainingFinished = false; /* Whether draining the stream is finished. */
-#ifdef LOG_ENABLED
-    char szStatus[AUDIOMIXERSINK_STATUS_STR_MAX];
-#endif
-
     LogFlowFunc(("%s: Entering run loop...\n", pSink->pszName));
     while (!pSink->AIO.fShutdown)
@@ -1828,13 +1777,6 @@
 
         RTCritSectEnter(&pSink->CritSect);
-
-#ifdef LOG_ENABLED
-        Log3Func(("%s: Running async I/O (fStatus=%s) ...\n", pSink->pszName,
-                  dbgAudioMixerSinkStatusToStr(pSink->fStatus, szStatus)));
-#endif
         if (pSink->fStatus & (AUDMIXSINK_STS_RUNNING | AUDMIXSINK_STS_DRAINING))
         {
-            uint32_t fStatusOld = pSink->fStatus;
-
             /*
              * Before doing jobs, always update input sinks.
@@ -1862,12 +1804,5 @@
              */
             if (!(pSink->fStatus & AUDMIXSINK_STS_DRAINING))
-            {
-                /* likely */
-                if (fStatusOld & AUDMIXSINK_STS_DRAINING)
-                {
-                    Log3Func(("%s: Started draining\n", pSink->pszName));
-                    fDrainingFinished = true;
-                }
-            }
+            { /* likely */ }
             else
             {
@@ -1877,21 +1812,6 @@
             }
 
-            fStatusOld = pSink->fStatus;
-
-            Log3Func(("%s: Running async I/O finished (fStatus=%s, cMsSleep=%RU32)\n",
-                      pSink->pszName, dbgAudioMixerSinkStatusToStr(pSink->fStatus, szStatus), cMsSleep));
         }
         RTCritSectLeave(&pSink->CritSect);
-
-        /*
-         * Signal waiters.
-         */
-        if (fDrainingFinished)
-        {
-            Log3Func(("%s: Finished draining\n", pSink->pszName));
-            int rc = RTSemEventSignal(pSink->AIO.hEventDrained);
-            AssertLogRelMsgReturn(RT_SUCCESS(rc), ("%s: RTSemEventSignal(hEventDrained) -> %Rrc\n", pSink->pszName, rc), rc);
-            fDrainingFinished = false;
-        }
 
         /*
@@ -1902,7 +1822,4 @@
             int rc = RTSemEventWait(pSink->AIO.hEvent, cMsSleep);
             AssertLogRelMsgReturn(RT_SUCCESS(rc) || rc == VERR_TIMEOUT, ("%s: RTSemEventWait -> %Rrc\n", pSink->pszName, rc), rc);
-#ifdef LOG_ENABLED
-            Log3Func(("%s: Got signalled (fStatus=%s)\n", pSink->pszName, dbgAudioMixerSinkStatusToStr(pSink->fStatus, szStatus)));
-#endif
         }
     }
@@ -1970,9 +1887,4 @@
         {
             rc = RTSemEventCreate(&pSink->AIO.hEvent);
-            AssertRCReturnStmt(rc, RTCritSectLeave(&pSink->CritSect), rc);
-        }
-        if (pSink->AIO.hEventDrained == NIL_RTSEMEVENT)
-        {
-            rc = RTSemEventCreate(&pSink->AIO.hEventDrained);
             AssertRCReturnStmt(rc, RTCritSectLeave(&pSink->CritSect), rc);
         }
@@ -2048,61 +1960,4 @@
 
 /**
- * Waits for the sink's draining to complete, internal version.
- *
- * @returns VBox status code.
- * @param   pSink       The mixer sink which AIO thread needs waiting on.
- * @param   msTimeout   Timeout (in ms) to use for waiting on draining to be finished.
- *
- * @note    Caller holds the sink's lock.
- */
-static int audioMixerSinkWaitForDrainedLocked(PAUDMIXSINK pSink, RTMSINTERVAL msTimeout)
-{
-    AssertReturn((pSink->fStatus & AUDMIXSINK_STS_DRAINING), VERR_WRONG_ORDER);
-
-    int rc;
-
-    if (pSink->AIO.cUpdateJobs)
-    {
-        rc = RTCritSectLeave(&pSink->CritSect);
-        AssertRCReturn(rc, rc);
-
-        rc = RTSemEventWait(pSink->AIO.hEventDrained, msTimeout);
-
-        int rc2 = RTCritSectEnter(&pSink->CritSect);
-        AssertRCReturn(rc2, rc2);
-
-    }
-    else
-        rc = VINF_SUCCESS;
-
-    return rc;
-}
-
-
-/**
- * Waits for the sink's draining to complete.
- *
- * @returns VBox status code.
- * @param   pSink       The mixer sink which AIO thread needs waiting on.
- * @param   msTimeout   Timeout (in ms) to use for waiting on draining to be finished.
- */
-int AudioMixerSinkWaitForDrained(PAUDMIXSINK pSink, RTMSINTERVAL msTimeout)
-{
-    AssertPtrReturn(pSink, VERR_INVALID_POINTER);
-    Assert(pSink->uMagic == AUDMIXSINK_MAGIC);
-
-    int rc = RTCritSectEnter(&pSink->CritSect);
-    AssertRCReturn(rc, rc);
-
-    rc = audioMixerSinkWaitForDrainedLocked(pSink, msTimeout);
-
-    int rc2 = RTCritSectLeave(&pSink->CritSect);
-    AssertRCReturn(rc2, rc2);
-
-    return rc;
-}
-
-
-/**
  * Writes data to a mixer output sink.
  *
@@ -2169,6 +2024,5 @@
               idStream, cbSinkWritable, cbCircBufReadable, cbToTransfer, offStream));
     AssertMsg(!(pSink->fStatus & AUDMIXSINK_STS_DRAINING) || cbCircBufReadable == pSink->cbDmaLeftToDrain,
-              ("idStream=%u: fStatus=%#x cbCircBufReadable=%#x cbDmaLeftToDrain=%#x\n",
-               idStream, pSink->fStatus, cbCircBufReadable, pSink->cbDmaLeftToDrain));
+              ("cbCircBufReadable=%#x cbDmaLeftToDrain=%#x\n", cbCircBufReadable, pSink->cbDmaLeftToDrain));
 
     /*
Index: trunk/src/VBox/Devices/Audio/AudioMixer.h
===================================================================
--- trunk/src/VBox/Devices/Audio/AudioMixer.h	(revision 98455)
+++ trunk/src/VBox/Devices/Audio/AudioMixer.h	(revision 98456)
@@ -244,6 +244,4 @@
         /** Event for letting the thread know there is some data to process. */
         RTSEMEVENT              hEvent;
-        /** Event for letting the waiters know that draining the sink is done. */
-        RTSEMEVENT              hEventDrained;
         /** The device instance (same for all update jobs). */
         PPDMDEVINS              pDevIns;
@@ -311,5 +309,4 @@
  * @{ */
 int         AudioMixerSinkStart(PAUDMIXSINK pSink);
-int         AudioMixerSinkDrainAndStopEx(PAUDMIXSINK pSink, uint32_t cbComming, RTMSINTERVAL msTimeout);
 int         AudioMixerSinkDrainAndStop(PAUDMIXSINK pSink, uint32_t cbComming);
 void        AudioMixerSinkDestroy(PAUDMIXSINK pSink, PPDMDEVINS pDevIns);
@@ -327,5 +324,4 @@
 int         AudioMixerSinkRemoveUpdateJob(PAUDMIXSINK pSink, PFNAUDMIXSINKUPDATE pfnUpdate, void *pvUser);
 int         AudioMixerSinkSignalUpdateJob(PAUDMIXSINK pSink);
-int         AudioMixerSinkWaitForDrained(PAUDMIXSINK pSink, RTMSINTERVAL msTimeout);
 uint64_t    AudioMixerSinkTransferFromCircBuf(PAUDMIXSINK pSink, PRTCIRCBUF pCircBuf, uint64_t offStream,
                                               uint32_t idStream, PAUDIOHLPFILE pDbgFile);
Index: trunk/src/VBox/Devices/Audio/DevHdaStream.cpp
===================================================================
--- trunk/src/VBox/Devices/Audio/DevHdaStream.cpp	(revision 98455)
+++ trunk/src/VBox/Devices/Audio/DevHdaStream.cpp	(revision 98456)
@@ -1059,7 +1059,6 @@
         }
         else
-            rc = AudioMixerSinkDrainAndStopEx(pSink,
-                                              pStreamR3->State.pCircBuf ? (uint32_t)RTCircBufUsed(pStreamR3->State.pCircBuf) : 0,
-                                              RT_MS_5SEC);
+            rc = AudioMixerSinkDrainAndStop(pSink,
+                                            pStreamR3->State.pCircBuf ? (uint32_t)RTCircBufUsed(pStreamR3->State.pCircBuf) : 0);
     }
     if (   RT_SUCCESS(rc)
Index: trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
===================================================================
--- trunk/src/VBox/Devices/Audio/DevIchAc97.cpp	(revision 98455)
+++ trunk/src/VBox/Devices/Audio/DevIchAc97.cpp	(revision 98456)
@@ -2348,7 +2348,5 @@
     else
     {
-        rc = AudioMixerSinkDrainAndStopEx(pSink,
-                                          pStreamCC->State.pCircBuf ? (uint32_t)RTCircBufUsed(pStreamCC->State.pCircBuf) : 0,
-                                          RT_MS_5SEC);
+        rc = AudioMixerSinkDrainAndStop(pSink, pStreamCC->State.pCircBuf ? (uint32_t)RTCircBufUsed(pStreamCC->State.pCircBuf) : 0);
         ichac97R3StreamTearDown(pStream);
     }
Index: trunk/src/VBox/Devices/Audio/DevSB16.cpp
===================================================================
--- trunk/src/VBox/Devices/Audio/DevSB16.cpp	(revision 98455)
+++ trunk/src/VBox/Devices/Audio/DevSB16.cpp	(revision 98456)
@@ -2012,6 +2012,5 @@
     else
     {
-        rc = AudioMixerSinkDrainAndStopEx(pSink, pStream->State.pCircBuf ? (uint32_t)RTCircBufUsed(pStream->State.pCircBuf) : 0,
-                                          RT_MS_5SEC);
+        rc = AudioMixerSinkDrainAndStop(pSink, pStream->State.pCircBuf ? (uint32_t)RTCircBufUsed(pStream->State.pCircBuf) : 0);
         AssertRCReturn(rc, rc);
     }
