VirtualBox

Changeset 76686 in vbox


Ignore:
Timestamp:
Jan 7, 2019 4:45:48 PM (6 years ago)
Author:
vboxsync
Message:

Audio/DrvAudio: Added drvAudioStreamDropInternal() to distinguish from drvAudioStreamReset() better.

File:
1 edited

Legend:

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

    r76553 r76686  
    5555static int drvAudioStreamIterateInternal(PDRVAUDIO pThis, PPDMAUDIOSTREAM pStream);
    5656static int drvAudioStreamReInitInternal(PDRVAUDIO pThis, PPDMAUDIOSTREAM pStream);
     57static void drvAudioStreamDropInternal(PDRVAUDIO pThis, PPDMAUDIOSTREAM pStream);
    5758static void drvAudioStreamResetInternal(PDRVAUDIO pThis, PPDMAUDIOSTREAM pStream);
    5859
     
    376377                    rc = drvAudioStreamControlInternalBackend(pThis, pStream, PDMAUDIOSTREAMCMD_DISABLE);
    377378                    if (RT_SUCCESS(rc))
    378                         pStream->fStatus &= ~PDMAUDIOSTREAMSTS_FLAG_ENABLED;
     379                        drvAudioStreamResetInternal(pThis, pStream);
    379380                }
    380381            }
     
    409410            if (RT_SUCCESS(rc))
    410411            {
    411                 drvAudioStreamResetInternal(pThis, pStream);
     412                drvAudioStreamDropInternal(pThis, pStream);
    412413            }
    413414            break;
     
    464465        {
    465466            if (pStream->fStatus & PDMAUDIOSTREAMSTS_FLAG_ENABLED)
    466             {
    467467                rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pStream->pvBackend, PDMAUDIOSTREAMCMD_DISABLE);
    468                 if (RT_SUCCESS(rc))
    469                     AudioMixBufReset(&pStream->Host.MixBuf);
    470             }
    471468            break;
    472469        }
     
    812809    }
    813810
    814     /* Do the internal reset. */
    815     drvAudioStreamResetInternal(pThis, pStream);
     811    /* Drop all old data. */
     812    drvAudioStreamDropInternal(pThis, pStream);
    816813
    817814    /*
     
    828825}
    829826
    830 static void drvAudioStreamResetInternal(PDRVAUDIO pThis, PPDMAUDIOSTREAM pStream)
     827/**
     828 * Drops all audio data (and associated state) of a stream.
     829 *
     830 * @param   pThis               Pointer to driver instance.
     831 * @param   pStream             Stream to drop data for.
     832 */
     833static void drvAudioStreamDropInternal(PDRVAUDIO pThis, PPDMAUDIOSTREAM pStream)
    831834{
    832835    RT_NOREF(pThis);
     836
     837    LogFunc(("[%s]\n", pStream->szName));
    833838
    834839    AudioMixBufReset(&pStream->Guest.MixBuf);
    835840    AudioMixBufReset(&pStream->Host.MixBuf);
     841
     842    pStream->tsLastIteratedNs       = 0;
     843    pStream->tsLastPlayedCapturedNs = 0;
     844    pStream->tsLastReadWrittenNs    = 0;
     845
     846    pStream->fThresholdReached = false;
     847}
     848
     849/**
     850 * Resets a given audio stream.
     851 *
     852 * @param   pThis               Pointer to driver instance.
     853 * @param   pStream             Stream to reset.
     854 */
     855static void drvAudioStreamResetInternal(PDRVAUDIO pThis, PPDMAUDIOSTREAM pStream)
     856{
     857    drvAudioStreamDropInternal(pThis, pStream);
     858
     859    LogFunc(("[%s]\n", pStream->szName));
     860
     861    pStream->fStatus = PDMAUDIOSTREAMSTS_FLAG_INITIALIZED;
    836862
    837863#ifdef VBOX_WITH_STATISTICS
     
    11681194                    {
    11691195                        pStream->fStatus &= ~(PDMAUDIOSTREAMSTS_FLAG_ENABLED | PDMAUDIOSTREAMSTS_FLAG_PENDING_DISABLE);
     1196                        drvAudioStreamDropInternal(pThis, pStream);
    11701197                    }
    11711198                    else
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