VirtualBox

Changeset 73570 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 8, 2018 3:28:35 PM (6 years ago)
Author:
vboxsync
Message:

Audio/DrvAudio: Also make use of VERR_AUDIO_STREAM_NOT_READY for playback stuff.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DrvAudio.cpp

    r73569 r73570  
    863863               pStream->szName, pStream->enmDir));
    864864
     865    AssertMsg(DrvAudioHlpBytesIsAligned(cbBuf, &pStream->Guest.Cfg.Props),
     866              ("Writing audio data (%RU32 bytes) to stream '%s' is not properly aligned\n", cbBuf, pStream->szName));
     867
    865868    uint32_t cbWrittenTotal = 0;
    866869
     
    874877
    875878#ifdef LOG_ENABLED
    876     char *pszStreamSts = NULL;
     879    char *pszStreamSts = dbgAudioStreamStatusToStr(pStream->fStatus);
     880    AssertPtr(pszStreamSts);
    877881#endif
    878882
    879883    do
    880884    {
    881         if (!pThis->Out.fEnabled)
    882         {
    883             cbWrittenTotal = cbBuf;
     885        if (   !pThis->Out.fEnabled
     886            || !DrvAudioHlpStreamStatusIsReady(pStream->fStatus))
     887        {
     888            rc = VERR_AUDIO_STREAM_NOT_READY;
    884889            break;
    885890        }
     
    889894            && pThis->pHostDrvAudio->pfnGetStatus(pThis->pHostDrvAudio, PDMAUDIODIR_OUT) != PDMAUDIOBACKENDSTS_RUNNING)
    890895        {
    891             rc = VERR_NOT_AVAILABLE;
    892             break;
    893         }
    894 
    895         AssertMsg(DrvAudioHlpBytesIsAligned(cbBuf, &pStream->Guest.Cfg.Props),
    896                   ("Writing audio data (%RU32 bytes) to stream '%s' is not properly aligned\n", cbBuf, pStream->szName));
    897 
    898 #ifdef LOG_ENABLED
    899         pszStreamSts = dbgAudioStreamStatusToStr(pStream->fStatus);
    900         AssertPtr(pszStreamSts);
    901 #endif
    902         if (!(pStream->fStatus & PDMAUDIOSTREAMSTS_FLAG_ENABLED))
    903         {
    904             Log3Func(("[%s] Writing to disabled guest output stream not possible (status is %s)\n",
    905                       pStream->szName, pszStreamSts));
    906 #ifdef DEBUG_andy
    907             AssertFailed();
    908 #endif
    909             rc = VERR_NOT_AVAILABLE;
     896            rc = VERR_AUDIO_STREAM_NOT_READY;
    910897            break;
    911898        }
     
    921908
    922909        if (!cbToWrite)
     910        {
     911            rc = VERR_BUFFER_OVERFLOW;
    923912            break;
     913        }
    924914
    925915        /* We use the guest side mixing buffer as an intermediate buffer to do some
     
    987977    } while (0);
    988978
    989     Log3Func(("[%s] fEnabled=%RTbool, cbWrittenTotal=%RU32, rc=%Rrc\n",
    990               pStream->szName, pThis->Out.fEnabled, cbWrittenTotal, rc));
     979    Log3Func(("[%s] cbWrittenTotal=%RU32, rc=%Rrc\n", pStream->szName, cbWrittenTotal, rc));
    991980
    992981#ifdef LOG_ENABLED
     
    14031392    uint32_t cfPlayedTotal = 0;
    14041393
    1405     if (!pThis->pHostDrvAudio)
    1406         return VINF_SUCCESS;
    1407 
    14081394    PDMAUDIOSTREAMSTS stsStream = pStream->fStatus;
    14091395#ifdef LOG_ENABLED
     
    14151401    do
    14161402    {
    1417         /*
    1418          * Check if the backend is ready to operate.
    1419          */
    1420         if (!(stsStream & PDMAUDIOSTREAMSTS_FLAG_ENABLED)) /* Stream disabled? Bail out. */
     1403        if (!pThis->pHostDrvAudio)
     1404        {
     1405            rc = VERR_AUDIO_STREAM_NOT_READY;
    14211406            break;
    1422 
     1407        }
     1408
     1409        if (   !pThis->Out.fEnabled
     1410            || !DrvAudioHlpStreamStatusIsReady(stsStream))
     1411        {
     1412            rc = VERR_AUDIO_STREAM_NOT_READY;
     1413            break;
     1414        }
    14231415              uint32_t cfLive       = AudioMixBufLive(&pStream->Host.MixBuf);
    14241416        const uint8_t  uLivePercent = (100 * cfLive) / AudioMixBufSize(&pStream->Host.MixBuf);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette