Index: /trunk/src/VBox/Devices/Audio/DrvAudio.cpp
===================================================================
--- /trunk/src/VBox/Devices/Audio/DrvAudio.cpp	(revision 73569)
+++ /trunk/src/VBox/Devices/Audio/DrvAudio.cpp	(revision 73570)
@@ -863,4 +863,7 @@
                pStream->szName, pStream->enmDir));
 
+    AssertMsg(DrvAudioHlpBytesIsAligned(cbBuf, &pStream->Guest.Cfg.Props),
+              ("Writing audio data (%RU32 bytes) to stream '%s' is not properly aligned\n", cbBuf, pStream->szName));
+
     uint32_t cbWrittenTotal = 0;
 
@@ -874,12 +877,14 @@
 
 #ifdef LOG_ENABLED
-    char *pszStreamSts = NULL;
+    char *pszStreamSts = dbgAudioStreamStatusToStr(pStream->fStatus);
+    AssertPtr(pszStreamSts);
 #endif
 
     do
     {
-        if (!pThis->Out.fEnabled)
-        {
-            cbWrittenTotal = cbBuf;
+        if (   !pThis->Out.fEnabled
+            || !DrvAudioHlpStreamStatusIsReady(pStream->fStatus))
+        {
+            rc = VERR_AUDIO_STREAM_NOT_READY;
             break;
         }
@@ -889,23 +894,5 @@
             && pThis->pHostDrvAudio->pfnGetStatus(pThis->pHostDrvAudio, PDMAUDIODIR_OUT) != PDMAUDIOBACKENDSTS_RUNNING)
         {
-            rc = VERR_NOT_AVAILABLE;
-            break;
-        }
-
-        AssertMsg(DrvAudioHlpBytesIsAligned(cbBuf, &pStream->Guest.Cfg.Props),
-                  ("Writing audio data (%RU32 bytes) to stream '%s' is not properly aligned\n", cbBuf, pStream->szName));
-
-#ifdef LOG_ENABLED
-        pszStreamSts = dbgAudioStreamStatusToStr(pStream->fStatus);
-        AssertPtr(pszStreamSts);
-#endif
-        if (!(pStream->fStatus & PDMAUDIOSTREAMSTS_FLAG_ENABLED))
-        {
-            Log3Func(("[%s] Writing to disabled guest output stream not possible (status is %s)\n",
-                      pStream->szName, pszStreamSts));
-#ifdef DEBUG_andy
-            AssertFailed();
-#endif
-            rc = VERR_NOT_AVAILABLE;
+            rc = VERR_AUDIO_STREAM_NOT_READY;
             break;
         }
@@ -921,5 +908,8 @@
 
         if (!cbToWrite)
+        {
+            rc = VERR_BUFFER_OVERFLOW;
             break;
+        }
 
         /* We use the guest side mixing buffer as an intermediate buffer to do some
@@ -987,6 +977,5 @@
     } while (0);
 
-    Log3Func(("[%s] fEnabled=%RTbool, cbWrittenTotal=%RU32, rc=%Rrc\n",
-              pStream->szName, pThis->Out.fEnabled, cbWrittenTotal, rc));
+    Log3Func(("[%s] cbWrittenTotal=%RU32, rc=%Rrc\n", pStream->szName, cbWrittenTotal, rc));
 
 #ifdef LOG_ENABLED
@@ -1403,7 +1392,4 @@
     uint32_t cfPlayedTotal = 0;
 
-    if (!pThis->pHostDrvAudio)
-        return VINF_SUCCESS;
-
     PDMAUDIOSTREAMSTS stsStream = pStream->fStatus;
 #ifdef LOG_ENABLED
@@ -1415,10 +1401,16 @@
     do
     {
-        /*
-         * Check if the backend is ready to operate.
-         */
-        if (!(stsStream & PDMAUDIOSTREAMSTS_FLAG_ENABLED)) /* Stream disabled? Bail out. */
+        if (!pThis->pHostDrvAudio)
+        {
+            rc = VERR_AUDIO_STREAM_NOT_READY;
             break;
-
+        }
+
+        if (   !pThis->Out.fEnabled
+            || !DrvAudioHlpStreamStatusIsReady(stsStream))
+        {
+            rc = VERR_AUDIO_STREAM_NOT_READY;
+            break;
+        }
               uint32_t cfLive       = AudioMixBufLive(&pStream->Host.MixBuf);
         const uint8_t  uLivePercent = (100 * cfLive) / AudioMixBufSize(&pStream->Host.MixBuf);
