VirtualBox

Changeset 88723 in vbox


Ignore:
Timestamp:
Apr 27, 2021 10:03:19 AM (4 years ago)
Author:
vboxsync
Message:

Audio: The audio device (i.e. AudioMixer.cpp) is now responsible for initiating stream re-initialzation on backend device changes, as it needs to update the peek state with its mixer buffer. bugref:9890

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/pdmaudioifs.h

    r88720 r88723  
    910910 *  that this is an enabled stream! */
    911911#define PDMAUDIOSTREAMSTS_FLAGS_PAUSED          RT_BIT_32(2)
    912 /** Whether this stream was marked as being disabled
     912/** Indicates that the stream is draining (output only).
     913 *  Whether this stream was marked as being disabled
    913914 *  but there are still associated guest output streams
    914915 *  which rely on its data. */
    915916#define PDMAUDIOSTREAMSTS_FLAGS_PENDING_DISABLE RT_BIT_32(3)
    916 /** Whether this stream is in re-initialization phase.
    917  *  All other bits remain untouched to be able to restore
    918  *  the stream's state after the re-initialization bas been
    919  *  finished. */
    920 #define PDMAUDIOSTREAMSTS_FLAGS_PENDING_REINIT  RT_BIT_32(4)
     917/** Whether this stream is in re-initialization phase and requires the device
     918 *  to call pfnStreamReInit.
     919 *
     920 *  All other bits remain untouched to be able to restore the stream's state
     921 *  after the re-initialization has been completed. */
     922#define PDMAUDIOSTREAMSTS_FLAGS_NEED_REINIT     RT_BIT_32(4)
    921923/** Validation mask. */
    922924#define PDMAUDIOSTREAMSTS_VALID_MASK            UINT32_C(0x0000001F)
     
    10801082                                                PPDMAUDIOSTREAMCFG pCfgGuest, PPDMAUDIOSTREAM *ppStream));
    10811083
     1084
    10821085    /**
    10831086     * Destroys an audio stream.
     
    10871090     */
    10881091    DECLR3CALLBACKMEMBER(int, pfnStreamDestroy, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOSTREAM pStream));
     1092
     1093    /**
     1094     * Re-initializes the stream in response to PDMAUDIOSTREAMSTS_FLAGS_NEED_REINIT.
     1095     *
     1096     * @returns VBox status code.
     1097     * @param   pInterface      Pointer to this interface.
     1098     * @param   pStream         The audio stream needing re-initialization.
     1099     */
     1100    DECLR3CALLBACKMEMBER(int, pfnStreamReInit, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOSTREAM pStream));
    10891101
    10901102    /**
     
    12041216
    12051217/** PDMIAUDIOCONNECTOR interface ID. */
    1206 #define PDMIAUDIOCONNECTOR_IID                  "00ee6f8e-16ab-4e9a-977c-d506c163be77"
     1218#define PDMIAUDIOCONNECTOR_IID                  "ff6788cc-1a4d-4d4b-a2e0-9f56fce9b397"
    12071219
    12081220
  • trunk/include/VBox/vmm/pdmaudioinline.h

    r88626 r88723  
    435435                       | PDMAUDIOSTREAMSTS_FLAGS_ENABLED
    436436                       | PDMAUDIOSTREAMSTS_FLAGS_PAUSED
    437                        | PDMAUDIOSTREAMSTS_FLAGS_PENDING_REINIT ))
     437                       | PDMAUDIOSTREAMSTS_FLAGS_NEED_REINIT ))
    438438        == (  PDMAUDIOSTREAMSTS_FLAGS_INITIALIZED
    439439            | PDMAUDIOSTREAMSTS_FLAGS_ENABLED);
     
    459459                       | PDMAUDIOSTREAMSTS_FLAGS_PAUSED
    460460                       | PDMAUDIOSTREAMSTS_FLAGS_PENDING_DISABLE
    461                        | PDMAUDIOSTREAMSTS_FLAGS_PENDING_REINIT))
     461                       | PDMAUDIOSTREAMSTS_FLAGS_NEED_REINIT))
    462462        == (  PDMAUDIOSTREAMSTS_FLAGS_INITIALIZED
    463463            | PDMAUDIOSTREAMSTS_FLAGS_ENABLED);
     
    479479    return (fStatus & (  PDMAUDIOSTREAMSTS_FLAGS_INITIALIZED
    480480                       | PDMAUDIOSTREAMSTS_FLAGS_ENABLED
    481                        | PDMAUDIOSTREAMSTS_FLAGS_PENDING_REINIT))
     481                       | PDMAUDIOSTREAMSTS_FLAGS_NEED_REINIT))
    482482        == (  PDMAUDIOSTREAMSTS_FLAGS_INITIALIZED
    483483            | PDMAUDIOSTREAMSTS_FLAGS_ENABLED);
  • trunk/src/VBox/Devices/Audio/AudioMixer.cpp

    r88720 r88723  
    20862086static int audioMixerStreamUpdateStatus(PAUDMIXSTREAM pMixStream)
    20872087{
     2088    /*
     2089     * Reset the mixer status to start with.
     2090     */
    20882091    pMixStream->fStatus = AUDMIXSTREAM_STATUS_NONE;
    20892092
    2090     if (pMixStream->pConn) /* Audio connector available? */
    2091     {
    2092         const uint32_t fStreamStatus = pMixStream->pConn->pfnStreamGetStatus(pMixStream->pConn, pMixStream->pStream);
    2093 
     2093    PPDMIAUDIOCONNECTOR const pConn = pMixStream->pConn;
     2094    if (pConn) /* Audio connector available? */
     2095    {
     2096        PPDMAUDIOSTREAM const pStream = pMixStream->pStream;
     2097        PAUDMIXSINK const     pSink   = pMixStream->pSink;
     2098        AssertPtr(pSink);
     2099
     2100        /*
     2101         * Get the stream status.
     2102         * Do re-init if needed and fetch the status again afterwards.
     2103         */
     2104        uint32_t fStreamStatus = pConn->pfnStreamGetStatus(pConn, pStream);
     2105        if (!(fStreamStatus & PDMAUDIOSTREAMSTS_FLAGS_NEED_REINIT))
     2106        { /* likely */ }
     2107        else
     2108        {
     2109            LogFunc(("[%s] needs re-init...\n", pMixStream->pszName));
     2110            int rc = pConn->pfnStreamReInit(pConn, pStream);
     2111            fStreamStatus = pConn->pfnStreamGetStatus(pConn, pStream);
     2112            LogFunc(("[%s] re-init returns %Rrc and %#x.\n", pMixStream->pszName, rc, fStreamStatus)); RT_NOREF(rc);
     2113            if (pSink->enmDir == AUDMIXSINKDIR_OUTPUT)
     2114            {
     2115                rc = AudioMixBufInitPeekState(&pSink->MixBuf, &pMixStream->PeekState, &pStream->Props);
     2116                /** @todo we need to remember this, don't we? */
     2117                AssertRCReturn(rc, VINF_SUCCESS);
     2118            }
     2119        }
     2120
     2121        /*
     2122         * Translate the status to mixer speak.
     2123         */
    20942124        if (PDMAudioStrmStatusIsReady(fStreamStatus))
    20952125            pMixStream->fStatus |= AUDMIXSTREAM_STATUS_ENABLED;
    20962126
    2097         AssertPtr(pMixStream->pSink);
    2098         switch (pMixStream->pSink->enmDir)
     2127        switch (pSink->enmDir)
    20992128        {
    21002129            case AUDMIXSINKDIR_INPUT:
  • trunk/src/VBox/Devices/Audio/DrvAudio.cpp

    r88720 r88723  
    308308static int drvAudioStreamControlInternalBackend(PDRVAUDIO pThis, PDRVAUDIOSTREAM pStreamEx, PDMAUDIOSTREAMCMD enmStreamCmd);
    309309static int drvAudioStreamControlInternal(PDRVAUDIO pThis, PDRVAUDIOSTREAM pStreamEx, PDMAUDIOSTREAMCMD enmStreamCmd);
    310 static int drvAudioStreamCreateInternalBackend(PDRVAUDIO pThis, PDRVAUDIOSTREAM pStreamEx, PPDMAUDIOSTREAMCFG pCfgReq, PPDMAUDIOSTREAMCFG pCfgAcq);
    311 static int drvAudioStreamDestroyInternalBackend(PDRVAUDIO pThis, PDRVAUDIOSTREAM pStreamEx);
    312310static int drvAudioStreamUninitInternal(PDRVAUDIO pThis, PDRVAUDIOSTREAM pStreamEx);
    313311static int drvAudioStreamIterateInternal(PDRVAUDIO pThis, PDRVAUDIOSTREAM pStreamEx);
     
    341339        { RT_STR_TUPLE("PAUSED "),          PDMAUDIOSTREAMSTS_FLAGS_PAUSED          },
    342340        { RT_STR_TUPLE("PENDING_DISABLE "), PDMAUDIOSTREAMSTS_FLAGS_PENDING_DISABLE },
    343         { RT_STR_TUPLE("PENDING_REINIT "),  PDMAUDIOSTREAMSTS_FLAGS_PENDING_REINIT  },
     341        { RT_STR_TUPLE("NEED_REINIT "),     PDMAUDIOSTREAMSTS_FLAGS_NEED_REINIT     },
    344342    };
    345343    if (!fStatus)
     
    418416
    419417
    420 #ifdef VBOX_WITH_AUDIO_CALLBACKS
    421 /**
    422  * Schedules a re-initialization of all current audio streams.
    423  * The actual re-initialization will happen at some later point in time.
    424  *
    425  * @param   pThis               Pointer to driver instance.
    426  */
    427 static void drvAudioScheduleReInitInternal(PDRVAUDIO pThis)
    428 {
    429     LogFunc(("\n"));
    430 
    431     /* Mark all host streams to re-initialize. */
    432     PDRVAUDIOSTREAM pStreamEx;
    433     RTListForEach(&pThis->lstStreams, pStreamEx, DRVAUDIOSTREAM, ListEntry)
    434     {
    435         pStreamEx->Core.fStatus |= PDMAUDIOSTREAMSTS_FLAGS_PENDING_REINIT;
    436         pStreamEx->cTriesReInit  = 0;
    437         pStreamEx->nsLastReInit  = 0;
    438     }
    439 
    440 # ifdef VBOX_WITH_AUDIO_ENUM
    441     /* Re-enumerate all host devices as soon as possible. */
    442     pThis->fEnumerateDevices = true;
    443 # endif
    444 }
    445 #endif /* VBOX_WITH_AUDIO_CALLBACKS */
    446 
    447 
    448 /**
    449  * Re-initializes an audio stream with its existing host and guest stream
    450  * configuration.
    451  *
    452  * This might be the case if the backend told us we need to re-initialize
    453  * because something on the host side has changed.
    454  *
    455  * @note    Does not touch the stream's status flags.
    456  *
    457  * @returns VBox status code.
    458  * @param   pThis       Pointer to driver instance.
    459  * @param   pStreamEx   Stream to re-initialize.
    460  */
    461 static int drvAudioStreamReInitInternal(PDRVAUDIO pThis, PDRVAUDIOSTREAM pStreamEx)
    462 {
    463     AssertPtr(pThis);
    464     AssertPtr(pStreamEx);
    465 
    466     LogFlowFunc(("[%s]\n", pStreamEx->Core.szName));
    467 
    468     /*
    469      * Gather current stream status.
    470      */
    471     const bool fIsEnabled = RT_BOOL(pStreamEx->Core.fStatus & PDMAUDIOSTREAMSTS_FLAGS_ENABLED); /* Stream is enabled? */
    472 
    473     /*
    474      * Destroy and re-create stream on backend side.
    475      */
    476     int rc = drvAudioStreamControlInternalBackend(pThis, pStreamEx, PDMAUDIOSTREAMCMD_DISABLE);
    477     if (RT_SUCCESS(rc))
    478     {
    479         rc = drvAudioStreamDestroyInternalBackend(pThis, pStreamEx);
    480         if (RT_SUCCESS(rc))
    481         {
    482             PDMAUDIOSTREAMCFG CfgHostAcq;
    483             rc = drvAudioStreamCreateInternalBackend(pThis, pStreamEx, &pStreamEx->Host.Cfg, &CfgHostAcq);
    484             /** @todo Validate (re-)acquired configuration with pStreamEx->Core.Host.Cfg? */
    485             if (RT_SUCCESS(rc))
    486             {
    487 #ifdef LOG_ENABLED
    488                 LogFunc(("[%s] Acquired host format:\n",  pStreamEx->Core.szName));
    489                 PDMAudioStrmCfgLog(&CfgHostAcq);
    490 #endif
    491             }
    492         }
    493     }
    494 
    495     /* Drop all old data. */
    496     drvAudioStreamDropInternal(pThis, pStreamEx);
    497 
    498     /*
    499      * Restore previous stream state.
    500      */
    501     if (fIsEnabled)
    502         rc = drvAudioStreamControlInternalBackend(pThis, pStreamEx, PDMAUDIOSTREAMCMD_ENABLE);
    503 
    504     if (RT_FAILURE(rc))
    505         LogRel(("Audio: Re-initializing stream '%s' failed with %Rrc\n", pStreamEx->Core.szName, rc));
    506 
    507     LogFunc(("[%s] Returning %Rrc\n", pStreamEx->Core.szName, rc));
    508     return rc;
    509 }
    510 
    511 
    512418/**
    513419 * Resets the given audio stream.
     
    541447        AssertFailed();
    542448#endif
    543 }
    544 
    545 
    546 /**
    547  * Re-initializes the given stream if it is scheduled for this operation.
    548  *
    549  * @note This caller must have entered the critical section of the driver instance,
    550  *       needed for the host device (re-)enumeration.
    551  *
    552  * @param   pThis       Pointer to driver instance.
    553  * @param   pStreamEx   Stream to check and maybe re-initialize.
    554  */
    555 static void drvAudioStreamMaybeReInit(PDRVAUDIO pThis, PDRVAUDIOSTREAM pStreamEx)
    556 {
    557     if (pStreamEx->Core.fStatus & PDMAUDIOSTREAMSTS_FLAGS_PENDING_REINIT)
    558     {
    559         const unsigned cMaxTries = 3; /** @todo Make this configurable? */
    560         const uint64_t tsNowNs   = RTTimeNanoTS();
    561 
    562         /* Throttle re-initializing streams on failure. */
    563         if (   pStreamEx->cTriesReInit < cMaxTries
    564             && tsNowNs - pStreamEx->nsLastReInit >= RT_NS_1SEC * pStreamEx->cTriesReInit) /** @todo Ditto. */
    565         {
    566 #ifdef VBOX_WITH_AUDIO_ENUM
    567             if (pThis->fEnumerateDevices)
    568             {
    569                 /* Make sure to leave the driver's critical section before enumerating host stuff. */
    570                 int rc2 = RTCritSectLeave(&pThis->CritSect);
    571                 AssertRC(rc2);
    572 
    573                 /* Re-enumerate all host devices. */
    574                 drvAudioDevicesEnumerateInternal(pThis, true /* fLog */, NULL /* pDevEnum */);
    575 
    576                 /* Re-enter the critical section again. */
    577                 rc2 = RTCritSectEnter(&pThis->CritSect);
    578                 AssertRC(rc2);
    579 
    580                 pThis->fEnumerateDevices = false;
    581             }
    582 #endif /* VBOX_WITH_AUDIO_ENUM */
    583 
    584             int rc = drvAudioStreamReInitInternal(pThis, pStreamEx);
    585             if (RT_FAILURE(rc))
    586             {
    587                 pStreamEx->cTriesReInit++;
    588                 pStreamEx->nsLastReInit = tsNowNs;
    589             }
    590             else
    591             {
    592                 /* Remove the pending re-init flag on success. */
    593                 pStreamEx->Core.fStatus &= ~PDMAUDIOSTREAMSTS_FLAGS_PENDING_REINIT;
    594             }
    595         }
    596         else
    597         {
    598             /* Did we exceed our tries re-initializing the stream?
    599              * Then this one is dead-in-the-water, so disable it for further use. */
    600             if (pStreamEx->cTriesReInit == cMaxTries)
    601             {
    602                 LogRel(("Audio: Re-initializing stream '%s' exceeded maximum retries (%u), leaving as disabled\n",
    603                         pStreamEx->Core.szName, cMaxTries));
    604 
    605                 /* Don't try to re-initialize anymore and mark as disabled. */
    606                 pStreamEx->Core.fStatus &= ~(PDMAUDIOSTREAMSTS_FLAGS_PENDING_REINIT | PDMAUDIOSTREAMSTS_FLAGS_ENABLED);
    607 
    608                 /* Note: Further writes to this stream go to / will be read from the bit bucket (/dev/null) from now on. */
    609             }
    610         }
    611 
    612 #ifdef LOG_ENABLED
    613         char szStreamSts[DRVAUDIO_STATUS_STR_MAX];
    614 #endif
    615         Log3Func(("[%s] fStatus=%s\n", pStreamEx->Core.szName, dbgAudioStreamStatusToStr(szStreamSts, pStreamEx->Core.fStatus)));
    616     }
    617449}
    618450
     
    18071639
    18081640/**
     1641 * Re-initializes an audio stream with its existing host and guest stream
     1642 * configuration.
     1643 *
     1644 * This might be the case if the backend told us we need to re-initialize
     1645 * because something on the host side has changed.
     1646 *
     1647 * @note    Does not touch the stream's status flags.
     1648 *
     1649 * @returns VBox status code.
     1650 * @param   pThis       Pointer to driver instance.
     1651 * @param   pStreamEx   Stream to re-initialize.
     1652 */
     1653static int drvAudioStreamReInitInternal(PDRVAUDIO pThis, PDRVAUDIOSTREAM pStreamEx)
     1654{
     1655    AssertPtr(pThis);
     1656    AssertPtr(pStreamEx);
     1657
     1658    LogFlowFunc(("[%s]\n", pStreamEx->Core.szName));
     1659
     1660    /*
     1661     * Gather current stream status.
     1662     */
     1663    const bool fIsEnabled = RT_BOOL(pStreamEx->Core.fStatus & PDMAUDIOSTREAMSTS_FLAGS_ENABLED); /* Stream is enabled? */
     1664
     1665    /*
     1666     * Destroy and re-create stream on backend side.
     1667     */
     1668    int rc = drvAudioStreamControlInternalBackend(pThis, pStreamEx, PDMAUDIOSTREAMCMD_DISABLE);
     1669    if (RT_SUCCESS(rc))
     1670    {
     1671        rc = drvAudioStreamDestroyInternalBackend(pThis, pStreamEx);
     1672        if (RT_SUCCESS(rc))
     1673        {
     1674            PDMAUDIOSTREAMCFG CfgHostAcq;
     1675            rc = drvAudioStreamCreateInternalBackend(pThis, pStreamEx, &pStreamEx->Host.Cfg, &CfgHostAcq);
     1676            /** @todo Validate (re-)acquired configuration with pStreamEx->Core.Host.Cfg? */
     1677            if (RT_SUCCESS(rc))
     1678            {
     1679#ifdef LOG_ENABLED
     1680                LogFunc(("[%s] Acquired host format:\n",  pStreamEx->Core.szName));
     1681                PDMAudioStrmCfgLog(&CfgHostAcq);
     1682#endif
     1683            }
     1684        }
     1685    }
     1686
     1687    /* Drop all old data. */
     1688    drvAudioStreamDropInternal(pThis, pStreamEx);
     1689
     1690    /*
     1691     * Restore previous stream state.
     1692     */
     1693    if (fIsEnabled)
     1694        rc = drvAudioStreamControlInternalBackend(pThis, pStreamEx, PDMAUDIOSTREAMCMD_ENABLE);
     1695
     1696    if (RT_FAILURE(rc))
     1697        LogRel(("Audio: Re-initializing stream '%s' failed with %Rrc\n", pStreamEx->Core.szName, rc));
     1698
     1699    LogFunc(("[%s] Returning %Rrc\n", pStreamEx->Core.szName, rc));
     1700    return rc;
     1701}
     1702
     1703
     1704/**
     1705 * @interface_method_impl{PDMIAUDIOCONNECTOR,pfnStreamReInit}
     1706 */
     1707static DECLCALLBACK(int) drvAudioStreamReInit(PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOSTREAM pStream)
     1708{
     1709    PDRVAUDIO pThis = RT_FROM_MEMBER(pInterface, DRVAUDIO, IAudioConnector);
     1710    PDRVAUDIOSTREAM pStreamEx = (PDRVAUDIOSTREAM)pStream;
     1711    AssertPtrReturn(pStreamEx, VERR_INVALID_POINTER);
     1712    AssertReturn(pStreamEx->Core.uMagic == PDMAUDIOSTREAM_MAGIC, VERR_INVALID_MAGIC);
     1713    AssertReturn(pStreamEx->uMagic == DRVAUDIOSTREAM_MAGIC, VERR_INVALID_MAGIC);
     1714    AssertReturn(pStreamEx->Core.fStatus & PDMAUDIOSTREAMSTS_FLAGS_NEED_REINIT, VERR_INVALID_STATE);
     1715    LogFlowFunc(("\n"));
     1716
     1717    int rc = RTCritSectEnter(&pThis->CritSect);
     1718    AssertRCReturn(rc, rc);
     1719
     1720    if (pStreamEx->Core.fStatus & PDMAUDIOSTREAMSTS_FLAGS_NEED_REINIT)
     1721    {
     1722        const unsigned cMaxTries = 3; /** @todo Make this configurable? */
     1723        const uint64_t tsNowNs   = RTTimeNanoTS();
     1724
     1725        /* Throttle re-initializing streams on failure. */
     1726        if (   pStreamEx->cTriesReInit < cMaxTries
     1727            && tsNowNs - pStreamEx->nsLastReInit >= RT_NS_1SEC * pStreamEx->cTriesReInit) /** @todo Ditto. */
     1728        {
     1729#ifdef VBOX_WITH_AUDIO_ENUM
     1730            if (pThis->fEnumerateDevices)
     1731            {
     1732                /* Make sure to leave the driver's critical section before enumerating host stuff. */
     1733                int rc2 = RTCritSectLeave(&pThis->CritSect);
     1734                AssertRC(rc2);
     1735
     1736                /* Re-enumerate all host devices. */
     1737                drvAudioDevicesEnumerateInternal(pThis, true /* fLog */, NULL /* pDevEnum */);
     1738
     1739                /* Re-enter the critical section again. */
     1740                rc2 = RTCritSectEnter(&pThis->CritSect);
     1741                AssertRC(rc2);
     1742
     1743                pThis->fEnumerateDevices = false;
     1744            }
     1745#endif /* VBOX_WITH_AUDIO_ENUM */
     1746
     1747            rc = drvAudioStreamReInitInternal(pThis, pStreamEx);
     1748            if (RT_SUCCESS(rc))
     1749            {
     1750                /* Remove the pending re-init flag on success. */
     1751                pStreamEx->Core.fStatus &= ~PDMAUDIOSTREAMSTS_FLAGS_NEED_REINIT;
     1752            }
     1753            else
     1754            {
     1755                pStreamEx->cTriesReInit++;
     1756                pStreamEx->nsLastReInit = tsNowNs;
     1757            }
     1758        }
     1759        else
     1760        {
     1761            /* Did we exceed our tries re-initializing the stream?
     1762             * Then this one is dead-in-the-water, so disable it for further use. */
     1763            if (pStreamEx->cTriesReInit == cMaxTries)
     1764            {
     1765                LogRel(("Audio: Re-initializing stream '%s' exceeded maximum retries (%u), leaving as disabled\n",
     1766                        pStreamEx->Core.szName, cMaxTries));
     1767
     1768                /* Don't try to re-initialize anymore and mark as disabled. */
     1769                pStreamEx->Core.fStatus &= ~(PDMAUDIOSTREAMSTS_FLAGS_NEED_REINIT | PDMAUDIOSTREAMSTS_FLAGS_ENABLED);
     1770
     1771                /* Note: Further writes to this stream go to / will be read from the bit bucket (/dev/null) from now on. */
     1772            }
     1773        }
     1774
     1775#ifdef LOG_ENABLED
     1776        char szStreamSts[DRVAUDIO_STATUS_STR_MAX];
     1777#endif
     1778        Log3Func(("[%s] fStatus=%s\n", pStreamEx->Core.szName, dbgAudioStreamStatusToStr(szStreamSts, pStreamEx->Core.fStatus)));
     1779    }
     1780    else
     1781    {
     1782        AssertFailed();
     1783        rc = VERR_INVALID_STATE;
     1784    }
     1785
     1786    RTCritSectLeave(&pThis->CritSect);
     1787    LogFlowFuncLeaveRC(rc);
     1788    return rc;
     1789}
     1790
     1791
     1792/**
    18091793 * @interface_method_impl{PDMIAUDIOCONNECTOR,pfnStreamRetain}
    18101794 */
     
    22872271    if (!pThis->pHostDrvAudio)
    22882272        return VINF_SUCCESS;
    2289 
    2290     /* Is the stream scheduled for re-initialization? Do so now. */
    2291     drvAudioStreamMaybeReInit(pThis, pStreamEx);
    22922273
    22932274#ifdef LOG_ENABLED
     
    23632344                     * Okay, disable it.
    23642345                     */
    2365                     LogFunc(("[%s] Closing pending stream\n", pStreamEx->Core.szName));
     2346                    LogFunc(("[%s] Disabling pending stream\n", pStreamEx->Core.szName));
    23662347                    rc = drvAudioStreamControlInternalBackend(pThis, pStreamEx, PDMAUDIOSTREAMCMD_DISABLE);
    23672348                    if (RT_SUCCESS(rc))
     
    25812562    AssertRCReturn(rc, PDMAUDIOSTREAMSTS_FLAGS_NONE);
    25822563
    2583     /* Is the stream scheduled for re-initialization? Do so now. */
    2584     drvAudioStreamMaybeReInit(pThis, pStreamEx);
    2585 
    25862564    PDMAUDIOSTREAMSTS fStrmStatus = pStreamEx->Core.fStatus;
    25872565
     
    30543032*********************************************************************************************************************************/
    30553033#ifdef VBOX_WITH_AUDIO_CALLBACKS
     3034
     3035/**
     3036 * Schedules a re-initialization of all current audio streams.
     3037 * The actual re-initialization will happen at some later point in time.
     3038 *
     3039 * @param   pThis               Pointer to driver instance.
     3040 */
     3041static void drvAudioScheduleReInitInternal(PDRVAUDIO pThis)
     3042{
     3043    LogFunc(("\n"));
     3044
     3045    /* Mark all host streams to re-initialize. */
     3046    PDRVAUDIOSTREAM pStreamEx;
     3047    RTListForEach(&pThis->lstStreams, pStreamEx, DRVAUDIOSTREAM, ListEntry)
     3048    {
     3049        pStreamEx->Core.fStatus |= PDMAUDIOSTREAMSTS_FLAGS_NEED_REINIT;
     3050        pStreamEx->cTriesReInit  = 0;
     3051        pStreamEx->nsLastReInit  = 0;
     3052    }
     3053
     3054# ifdef VBOX_WITH_AUDIO_ENUM
     3055    /* Re-enumerate all host devices as soon as possible. */
     3056    pThis->fEnumerateDevices = true;
     3057# endif
     3058}
     3059
     3060
    30563061/**
    30573062 * @interface_method_impl{PDMIAUDIONOTIFYFROMHOST,pfnNotifyDevicesChanged}
     
    35423547    pThis->IAudioConnector.pfnStreamCreate      = drvAudioStreamCreate;
    35433548    pThis->IAudioConnector.pfnStreamDestroy     = drvAudioStreamDestroy;
     3549    pThis->IAudioConnector.pfnStreamReInit      = drvAudioStreamReInit;
    35443550    pThis->IAudioConnector.pfnStreamRetain      = drvAudioStreamRetain;
    35453551    pThis->IAudioConnector.pfnStreamRelease     = drvAudioStreamRelease;
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