VirtualBox

Changeset 65144 in vbox


Ignore:
Timestamp:
Jan 5, 2017 11:41:38 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
112647
Message:

Audio/DrvHostPulseAudio.cpp: More checks for drvHostPulseAudioStreamGetStatus().

File:
1 edited

Legend:

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

    r65100 r65144  
    14711471    PPULSEAUDIOSTREAM  pStrm = (PPULSEAUDIOSTREAM)pStream;
    14721472
    1473     PDMAUDIOSTRMSTS strmSts  = PDMAUDIOSTRMSTS_FLAG_INITIALIZED
    1474                              | PDMAUDIOSTRMSTS_FLAG_ENABLED;
     1473    PDMAUDIOSTRMSTS strmSts  = PDMAUDIOSTRMSTS_FLAG_NONE;
     1474
     1475    /* Check PulseAudio's general status. */
     1476    if (   pThis->pContext
     1477        && PA_CONTEXT_IS_GOOD(pa_context_get_state(pThis->pContext)))
     1478    {
     1479       strmSts = PDMAUDIOSTRMSTS_FLAG_INITIALIZED
     1480               | PDMAUDIOSTRMSTS_FLAG_ENABLED;
     1481    }
    14751482
    14761483    pa_threaded_mainloop_lock(pThis->pMainLoop);
    14771484
    1478     /*pa_context_state_t ctxState = pa_context_get_state(pThis->pContext); - unused */
    1479 
    1480     if (   pa_context_get_state(pThis->pContext) == PA_CONTEXT_READY
    1481         && pa_stream_get_state(pStrm->pPAStream) == PA_STREAM_READY)
    1482     {
     1485    /* Check the PulseAudio stream. */
     1486    if (PA_STREAM_IS_GOOD(pa_stream_get_state(pStrm->pPAStream)))
     1487    {
     1488        size_t cbSize;
    14831489        if (pStream->enmDir == PDMAUDIODIR_IN)
    14841490        {
    1485             strmSts |= PDMAUDIOSTRMSTS_FLAG_DATA_READABLE;
    1486         }
    1487         else
    1488         {
    1489             size_t cbSize = pa_stream_writable_size(pStrm->pPAStream);
    1490             LogFlowFunc(("cbSize=%zu\n", cbSize));
     1491            cbSize = pa_stream_readable_size(pStrm->pPAStream);
     1492            Log3Func(("cbSize=%zu\n", cbSize));
     1493
     1494            if (cbSize)
     1495                strmSts |= PDMAUDIOSTRMSTS_FLAG_DATA_READABLE;
     1496        }
     1497        else if (pStream->enmDir == PDMAUDIODIR_OUT)
     1498        {
     1499            cbSize = pa_stream_writable_size(pStrm->pPAStream);
     1500            Log3Func(("cbSize=%zu, cbMinReq=%RU32\n", cbSize, pStrm->BufAttr.minreq));
    14911501
    14921502            if (cbSize >= pStrm->BufAttr.minreq)
    14931503                strmSts |= PDMAUDIOSTRMSTS_FLAG_DATA_WRITABLE;
    14941504        }
     1505        else
     1506            AssertFailed();
    14951507    }
    14961508
Note: See TracChangeset for help on using the changeset viewer.

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