VirtualBox

Changeset 59029 in vbox for trunk/src/VBox/Devices/Audio


Ignore:
Timestamp:
Dec 7, 2015 4:11:22 PM (9 years ago)
Author:
vboxsync
Message:

Audio: DrvHostDSound.cpp: Also check return values when stopping playback/capturing, update fEnabledIn.

File:
1 edited

Legend:

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

    r58983 r59029  
    719719}
    720720
    721 static void directSoundPlayStop(PDRVHOSTDSOUND pThis, PDSOUNDSTREAMOUT pDSoundStrmOut)
    722 {
    723     AssertPtrReturnVoid(pThis);
    724     AssertPtrReturnVoid(pDSoundStrmOut);
     721static HRESULT directSoundPlayStop(PDRVHOSTDSOUND pThis, PDSOUNDSTREAMOUT pDSoundStrmOut)
     722{
     723    AssertPtrReturn(pThis, E_POINTER);
     724    AssertPtrReturn(pDSoundStrmOut, E_POINTER);
     725
     726    HRESULT hr;
    725727
    726728    if (pDSoundStrmOut->pDSB != NULL)
     
    731733        DSLOG(("DSound: Stopping playback\n"));
    732734
    733         /* @todo Wait until all data in the buffer has been played. */
    734         HRESULT hr = IDirectSoundBuffer8_Stop(pDSoundStrmOut->pDSB);
     735        /** @todo Wait until all data in the buffer has been played. */
     736        hr = IDirectSoundBuffer8_Stop(pDSoundStrmOut->pDSB);
    735737        if (SUCCEEDED(hr))
    736738            dsoundPlayClearSamples(pDSoundStrmOut);
     
    738740            DSLOGREL(("DSound: Stop playback %Rhrc\n", hr));
    739741    }
     742    else
     743        hr = E_UNEXPECTED;
     744
     745    return hr;
    740746}
    741747
     
    10131019}
    10141020
    1015 static void directSoundCaptureStop(PDSOUNDSTREAMIN pDSoundStrmIn)
    1016 {
    1017     AssertPtrReturnVoid(pDSoundStrmIn);
     1021static HRESULT directSoundCaptureStop(PDSOUNDSTREAMIN pDSoundStrmIn)
     1022{
     1023    AssertPtrReturn(pDSoundStrmIn, E_POINTER);
     1024
     1025    HRESULT hr;
    10181026
    10191027    if (pDSoundStrmIn->pDSCB)
     
    10211029        DSLOG(("DSound: Stopping capture\n"));
    10221030
    1023         HRESULT hr = IDirectSoundCaptureBuffer_Stop(pDSoundStrmIn->pDSCB);
     1031        hr = IDirectSoundCaptureBuffer_Stop(pDSoundStrmIn->pDSCB);
    10241032        if (FAILED(hr))
    10251033            DSLOGREL(("DSound: Capture buffer stop %Rhrc\n", hr));
    10261034    }
     1035    else
     1036        hr = E_UNEXPECTED;
     1037
     1038    return hr;
    10271039}
    10281040
     
    12211233
    12221234    int rc = VINF_SUCCESS;
     1235
     1236    HRESULT hr;
    12231237    switch (enmStreamCmd)
    12241238    {
     
    12271241            DSLOG(("DSound: Playback PDMAUDIOSTREAMCMD_ENABLE\n"));
    12281242            /* Try to start playback. If it fails, then reopen and try again. */
    1229             HRESULT hr = directSoundPlayStart(pDSoundStrmOut);
     1243            hr = directSoundPlayStart(pDSoundStrmOut);
    12301244            if (FAILED(hr))
    12311245            {
     
    12461260        {
    12471261            DSLOG(("DSound: Playback PDMAUDIOSTREAMCMD_DISABLE\n"));
    1248             directSoundPlayStop(pThis, pDSoundStrmOut);
     1262            hr = directSoundPlayStop(pThis, pDSoundStrmOut);
     1263            if (SUCCEEDED(hr))
     1264                pThis->fEnabledOut = false;
    12491265            break;
    12501266        }
     
    14661482    int rc = VINF_SUCCESS;
    14671483
     1484    HRESULT hr;
    14681485    switch (enmStreamCmd)
    14691486    {
     
    14711488        {
    14721489            /* Try to start capture. If it fails, then reopen and try again. */
    1473             HRESULT hr = directSoundCaptureStart(pThis, pDSoundStrmIn);
     1490            hr = directSoundCaptureStart(pThis, pDSoundStrmIn);
    14741491            if (FAILED(hr))
    14751492            {
     
    14891506        case PDMAUDIOSTREAMCMD_DISABLE:
    14901507        {
    1491             directSoundCaptureStop(pDSoundStrmIn);
     1508            hr = directSoundCaptureStop(pDSoundStrmIn);
     1509            if (SUCCEEDED(hr))
     1510                pThis->fEnabledIn = false;
    14921511            break;
    14931512        }
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