VirtualBox

忽略:
時間撮記:
2021-5-3 下午10:12:53 (4 年 以前)
作者:
vboxsync
svn:sync-xref-src-repo-rev:
144185
訊息:

DrvAudio,DrvHostAudioWasApi: Made WAS API device re-init work (i.e. when needing pfnStreamInitAsync). bugref:9890

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Devices/Audio/DrvAudio.cpp

    r88825 r88851  
    353353static int drvAudioStreamControlInternal(PDRVAUDIO pThis, PDRVAUDIOSTREAM pStreamEx, PDMAUDIOSTREAMCMD enmStreamCmd);
    354354static int drvAudioStreamUninitInternal(PDRVAUDIO pThis, PDRVAUDIOSTREAM pStreamEx);
     355static uint32_t drvAudioStreamRetainInternal(PDRVAUDIOSTREAM pStreamEx);
    355356static uint32_t drvAudioStreamReleaseInternal(PDRVAUDIO pThis, PDRVAUDIOSTREAM pStreamEx, bool fMayDestroy);
    356357static int drvAudioStreamIterateInternal(PDRVAUDIO pThis, PDRVAUDIOSTREAM pStreamEx);
    357358
    358 /** Buffer size for dbgAudioStreamStatusToStr.  */
     359/** Buffer size for drvAudioStreamStatusToStr.  */
    359360# define DRVAUDIO_STATUS_STR_MAX sizeof("INITIALIZED ENABLED PAUSED PENDING_DISABLED NEED_REINIT BACKEND_READY PREPARING_SWITCH 0x12345678")
    360361
     
    367368 * @param   fStatus     Stream status flags to convert.
    368369 */
    369 static const char *dbgAudioStreamStatusToStr(char pszDst[DRVAUDIO_STATUS_STR_MAX], uint32_t fStatus)
     370static const char *drvAudioStreamStatusToStr(char pszDst[DRVAUDIO_STATUS_STR_MAX], uint32_t fStatus)
    370371{
    371372    static const struct
     
    969970
    970971/**
     972 * Common worker for synchronizing the ENABLED and PAUSED status bits with the
     973 * backend after it becomes ready.
     974 *
     975 * Used by async init and re-init.
     976 */
     977static int drvAudioStreamUpdateBackendOnStatus(PDRVAUDIO pThis, PDRVAUDIOSTREAM pStreamEx, const char *pszWhen)
     978{
     979    int rc = VINF_SUCCESS;
     980    if (pStreamEx->fStatus & PDMAUDIOSTREAM_STS_ENABLED)
     981    {
     982        rc = drvAudioStreamControlInternalBackend(pThis, pStreamEx, PDMAUDIOSTREAMCMD_ENABLE);
     983        if (RT_SUCCESS(rc))
     984        {
     985            if (pStreamEx->fStatus & PDMAUDIOSTREAM_STS_PAUSED)
     986            {
     987                rc = drvAudioStreamControlInternalBackend(pThis, pStreamEx, PDMAUDIOSTREAMCMD_PAUSE);
     988                if (RT_FAILURE(rc))
     989                    LogRelMax(64, ("Audio: Failed to pause stream '%s' after %s: %Rrc\n", pStreamEx->Core.szName, pszWhen, rc));
     990            }
     991        }
     992        else
     993            LogRelMax(64, ("Audio: Failed to enable stream '%s' after %s: %Rrc\n", pStreamEx->Core.szName, pszWhen, rc));
     994    }
     995    return rc;
     996}
     997
     998
     999/**
    9711000 * For performing PDMIHOSTAUDIO::pfnStreamInitAsync on a worker thread.
    9721001 *
     
    10141043        pStreamEx->fStatus |= PDMAUDIOSTREAM_STS_BACKEND_READY; /* before the backend control call! */
    10151044
    1016         if (pStreamEx->fStatus & PDMAUDIOSTREAM_STS_ENABLED)
    1017         {
    1018             rc = drvAudioStreamControlInternalBackend(pThis, pStreamEx, PDMAUDIOSTREAMCMD_ENABLE);
    1019             if (RT_SUCCESS(rc))
    1020             {
    1021                 if (pStreamEx->fStatus & PDMAUDIOSTREAM_STS_PAUSED)
    1022                 {
    1023                     rc = drvAudioStreamControlInternalBackend(pThis, pStreamEx, PDMAUDIOSTREAMCMD_PAUSE);
    1024                     if (RT_FAILURE(rc))
    1025                         LogRelMax(64, ("Audio: Failed to pause stream '%s' after initialization completed: %Rrc\n",
    1026                                        pStreamEx->Core.szName, rc));
    1027                 }
    1028             }
    1029             else
    1030                 LogRelMax(64, ("Audio: Failed to enable stream '%s' after initialization completed: %Rrc\n",
    1031                                pStreamEx->Core.szName, rc));
    1032         }
     1045        rc = drvAudioStreamUpdateBackendOnStatus(pThis, pStreamEx, "asynchronous initialization completed");
    10331046
    10341047        /*
     
    16621675    char szStreamSts[DRVAUDIO_STATUS_STR_MAX];
    16631676#endif
    1664     LogFunc(("[%s] fStatus=%s\n", pStreamEx->Core.szName, dbgAudioStreamStatusToStr(szStreamSts, pStreamEx->fStatus)));
     1677    LogFunc(("[%s] fStatus=%s\n", pStreamEx->Core.szName, drvAudioStreamStatusToStr(szStreamSts, pStreamEx->fStatus)));
    16651678
    16661679    if (pStreamEx->fStatus & PDMAUDIOSTREAM_STS_INITIALIZED)
     
    17291742            char szStreamSts[DRVAUDIO_STATUS_STR_MAX];
    17301743            LogFunc(("[%s] Warning: Still has %s set when uninitializing\n",
    1731                      pStreamEx->Core.szName, dbgAudioStreamStatusToStr(szStreamSts, pStreamEx->fStatus)));
     1744                     pStreamEx->Core.szName, drvAudioStreamStatusToStr(szStreamSts, pStreamEx->fStatus)));
    17321745        }
    17331746#endif
     
    18591872            char szStatus[DRVAUDIO_STATUS_STR_MAX], szBackendStatus[DRVAUDIO_STATUS_STR_MAX];
    18601873            LogRel2(("Audio: Destroying stream '%s': cRefs=%u; status: %s; backend: %s; hReqInitAsync=%p\n",
    1861                      pStreamEx->Core.szName, pStreamEx->cRefs, dbgAudioStreamStatusToStr(szStatus, pStreamEx->fStatus),
    1862                      dbgAudioStreamStatusToStr(szBackendStatus, drvAudioStreamGetBackendStatus(pThis, pStreamEx)),
     1874                     pStreamEx->Core.szName, pStreamEx->cRefs, drvAudioStreamStatusToStr(szStatus, pStreamEx->fStatus),
     1875                     drvAudioStreamStatusToStr(szBackendStatus, drvAudioStreamGetBackendStatus(pThis, pStreamEx)),
    18631876                     pStreamEx->hReqInitAsync));
    18641877
     
    19071920 * Drops all audio data (and associated state) of a stream.
    19081921 *
    1909  * Used by drvAudioStreamIterateInternal(), drvAudioStreamResetInternal(), and
     1922 * Used by drvAudioStreamIterateInternal(), drvAudioStreamResetOnDisable(), and
    19101923 * drvAudioStreamReInitInternal().
    19111924 *
    19121925 * @param   pStreamEx   Stream to drop data for.
    19131926 */
    1914 static void drvAudioStreamDropInternal(PDRVAUDIOSTREAM pStreamEx)
     1927static void drvAudioStreamResetInternal(PDRVAUDIOSTREAM pStreamEx)
    19151928{
    19161929    LogFunc(("[%s]\n", pStreamEx->Core.szName));
     
    19301943        pStreamEx->Out.offPreBuf     = 0;
    19311944        pStreamEx->Out.enmPlayState  = pStreamEx->Out.cbPreBufThreshold > 0
    1932                                       ? DRVAUDIOPLAYSTATE_PREBUF : DRVAUDIOPLAYSTATE_PLAY;
     1945                                     ? DRVAUDIOPLAYSTATE_PREBUF : DRVAUDIOPLAYSTATE_PLAY;
    19331946    }
    19341947}
     
    19501963static int drvAudioStreamReInitInternal(PDRVAUDIO pThis, PDRVAUDIOSTREAM pStreamEx)
    19511964{
    1952     AssertPtr(pThis);
    1953     AssertPtr(pStreamEx);
    1954 
    1955     LogFlowFunc(("[%s]\n", pStreamEx->Core.szName));
    1956 
    1957     /*
    1958      * Gather current stream status.
    1959      */
    1960     const bool fIsEnabled = RT_BOOL(pStreamEx->fStatus & PDMAUDIOSTREAM_STS_ENABLED); /* Stream is enabled? */
    1961 
    1962 /** @todo r=bird: this is retried a bit too indiscriminately for my taste ... */
     1965    char szTmp[RT_MAX(PDMAUDIOSTRMCFGTOSTRING_MAX, DRVAUDIO_STATUS_STR_MAX)];
     1966    LogFlowFunc(("[%s] status: %s\n", pStreamEx->Core.szName, drvAudioStreamStatusToStr(szTmp, pStreamEx->fStatus) ));
     1967
    19631968    /*
    19641969     * Destroy and re-create stream on backend side.
    19651970     */
    1966     int rc = drvAudioStreamControlInternalBackend(pThis, pStreamEx, PDMAUDIOSTREAMCMD_DISABLE);
    1967     if (RT_SUCCESS(rc))
    1968     {
    1969         rc = drvAudioStreamDestroyInternalBackend(pThis, pStreamEx);
     1971    if (   (pStreamEx->fStatus & (PDMAUDIOSTREAM_STS_ENABLED | PDMAUDIOSTREAM_STS_INITIALIZED | PDMAUDIOSTREAM_STS_BACKEND_READY))
     1972        ==                       (PDMAUDIOSTREAM_STS_ENABLED | PDMAUDIOSTREAM_STS_INITIALIZED | PDMAUDIOSTREAM_STS_BACKEND_READY))
     1973        drvAudioStreamControlInternalBackend(pThis, pStreamEx, PDMAUDIOSTREAMCMD_DISABLE);
     1974
     1975    if (pStreamEx->fStatus & PDMAUDIOSTREAM_STS_INITIALIZED)
     1976        drvAudioStreamDestroyInternalBackend(pThis, pStreamEx);
     1977
     1978    int rc = VERR_AUDIO_STREAM_NOT_READY;
     1979    if (!(pStreamEx->fStatus & PDMAUDIOSTREAM_STS_INITIALIZED))
     1980    {
     1981        drvAudioStreamResetInternal(pStreamEx);
     1982
     1983        PDMAUDIOSTREAMCFG CfgHostAcq;
     1984        rc = drvAudioStreamCreateInternalBackend(pThis, pStreamEx, &pStreamEx->Host.Cfg, &CfgHostAcq);
    19701985        if (RT_SUCCESS(rc))
    19711986        {
    1972             PDMAUDIOSTREAMCFG CfgHostAcq;
    1973             rc = drvAudioStreamCreateInternalBackend(pThis, pStreamEx, &pStreamEx->Host.Cfg, &CfgHostAcq);
    1974             /** @todo Validate (re-)acquired configuration with pStreamEx->Core.Host.Cfg? */
    1975             if (RT_SUCCESS(rc))
     1987            LogFunc(("[%s] Acquired host format:\n", pStreamEx->Core.szName,
     1988                     PDMAudioStrmCfgToString(&CfgHostAcq, szTmp, sizeof(szTmp)) ));
     1989            if (true) /** @todo Validate (re-)acquired configuration with pStreamEx->Core.Host.Cfg? */
    19761990            {
    1977 #ifdef LOG_ENABLED
    1978                 LogFunc(("[%s] Acquired host format:\n",  pStreamEx->Core.szName));
    1979                 PDMAudioStrmCfgLog(&CfgHostAcq);
    1980 #endif
     1991                /*
     1992                 * Kick off the asynchronous init.
     1993                 */
     1994                if (!pStreamEx->fNeedAsyncInit)
     1995                {
     1996                    pStreamEx->fStatus |= PDMAUDIOSTREAM_STS_BACKEND_READY;
     1997                    PDMAUDIOSTREAM_STS_ASSERT_VALID(pStreamEx->fStatus);
     1998                }
     1999                else
     2000                {
     2001                    drvAudioStreamRetainInternal(pStreamEx);
     2002                    int rc2 = RTReqPoolCallEx(pThis->hReqPool, 0 /*cMillies*/, &pStreamEx->hReqInitAsync,
     2003                                              RTREQFLAGS_VOID | RTREQFLAGS_NO_WAIT,
     2004                                              (PFNRT)drvAudioStreamInitAsync, 2, pThis, pStreamEx);
     2005                    LogFlowFunc(("hReqInitAsync=%p rc2=%Rrc\n", pStreamEx->hReqInitAsync, rc2));
     2006                    AssertRCStmt(rc2, drvAudioStreamInitAsync(pThis, pStreamEx));
     2007                }
     2008
     2009                /*
     2010                 * Update the backend on the stream state if it's ready, otherwise
     2011                 * let the worker thread do it after the async init has completed.
     2012                 */
     2013                if (   (pStreamEx->fStatus & (PDMAUDIOSTREAM_STS_BACKEND_READY | PDMAUDIOSTREAM_STS_INITIALIZED))
     2014                    ==                       (PDMAUDIOSTREAM_STS_BACKEND_READY | PDMAUDIOSTREAM_STS_INITIALIZED))
     2015                {
     2016                    rc = drvAudioStreamUpdateBackendOnStatus(pThis, pStreamEx, "re-initializing");
     2017                    /** @todo not sure if we really need to care about this status code...   */
     2018                }
     2019                else if (pStreamEx->fStatus & PDMAUDIOSTREAM_STS_INITIALIZED)
     2020                {
     2021                    Assert(pStreamEx->hReqInitAsync != NIL_RTREQ);
     2022                    LogFunc(("Asynchronous stream init (%p) ...\n", pStreamEx->hReqInitAsync));
     2023                }
     2024                else
     2025                {
     2026                    LogRel(("Audio: Re-initializing stream '%s' somehow failed, status: %s\n", pStreamEx->Core.szName,
     2027                            drvAudioStreamStatusToStr(szTmp, pStreamEx->fStatus) ));
     2028                    AssertFailed();
     2029                    rc = VERR_AUDIO_STREAM_COULD_NOT_CREATE;
     2030                }
    19812031            }
    19822032        }
    1983     }
    1984 
    1985 /** @todo r=bird: Why do we do the dropping and re-enabling of the stream
    1986  *        regardless of how the above went?  It'll overwrite any above
    1987  *        failures for starters... */
    1988     /* Drop all old data. */
    1989     drvAudioStreamDropInternal(pStreamEx);
    1990 
    1991     /*
    1992      * Restore previous stream state.
    1993      */
    1994     /** @todo this isn't taking PAUSED or PENDING_DISABLE into consideration.   */
    1995     if (fIsEnabled)
    1996         rc = drvAudioStreamControlInternalBackend(pThis, pStreamEx, PDMAUDIOSTREAMCMD_ENABLE);
    1997 
    1998     if (RT_FAILURE(rc))
    1999         LogRel(("Audio: Re-initializing stream '%s' failed with %Rrc\n", pStreamEx->Core.szName, rc));
     2033        else
     2034            LogRel(("Audio: Re-initializing stream '%s' failed with %Rrc\n", pStreamEx->Core.szName, rc));
     2035    }
     2036    else
     2037    {
     2038        LogRel(("Audio: Re-initializing stream '%s' failed to destroy previous backend.\n", pStreamEx->Core.szName));
     2039        AssertFailed();
     2040    }
    20002041
    20012042    LogFunc(("[%s] Returning %Rrc\n", pStreamEx->Core.szName, rc));
     
    20222063    if (pStreamEx->fStatus & PDMAUDIOSTREAM_STS_NEED_REINIT)
    20232064    {
    2024         const unsigned cMaxTries = 3; /** @todo Make this configurable? */
    2025         const uint64_t tsNowNs   = RTTimeNanoTS();
    2026 
    2027 /** @todo r=bird: Must postpone if hReqInitAsync isn't NIL or cancellable. */
     2065        const unsigned cMaxTries = 5;
     2066        const uint64_t nsNow   = RTTimeNanoTS();
    20282067
    20292068        /* Throttle re-initializing streams on failure. */
    20302069        if (   pStreamEx->cTriesReInit < cMaxTries
     2070            && pStreamEx->hReqInitAsync == NIL_RTREQ
    20312071            && (   pStreamEx->nsLastReInit == 0
    2032                 || tsNowNs - pStreamEx->nsLastReInit >= RT_NS_1SEC * pStreamEx->cTriesReInit)) /** @todo Ditto. */
    2033         {
    2034 #ifdef VBOX_WITH_AUDIO_ENUM
    2035 /** @todo do this elsewhere.  */
    2036             if (pThis->fEnumerateDevices)
    2037             {
    2038                 /* Make sure to leave the driver's critical section before enumerating host stuff. */
    2039                 int rc2 = RTCritSectLeave(&pThis->CritSect);
    2040                 AssertRC(rc2);
    2041 
    2042                 /* Re-enumerate all host devices. */
    2043                 drvAudioDevicesEnumerateInternal(pThis, true /* fLog */, NULL /* pDevEnum */);
    2044 
    2045                 /* Re-enter the critical section again. */
    2046                 rc2 = RTCritSectEnter(&pThis->CritSect);
    2047                 AssertRC(rc2);
    2048 
    2049                 pThis->fEnumerateDevices = false;
    2050             }
    2051 #endif /* VBOX_WITH_AUDIO_ENUM */
    2052 
     2072                || nsNow - pStreamEx->nsLastReInit >= RT_NS_1SEC * pStreamEx->cTriesReInit))
     2073        {
    20532074            rc = drvAudioStreamReInitInternal(pThis, pStreamEx);
    20542075            if (RT_SUCCESS(rc))
     
    20602081            else
    20612082            {
     2083                pStreamEx->nsLastReInit = nsNow;
    20622084                pStreamEx->cTriesReInit++;
    2063                 pStreamEx->nsLastReInit = tsNowNs;
     2085
     2086                /* Did we exceed our tries re-initializing the stream?
     2087                 * Then this one is dead-in-the-water, so disable it for further use. */
     2088                if (pStreamEx->cTriesReInit >= cMaxTries)
     2089                {
     2090                    LogRel(("Audio: Re-initializing stream '%s' exceeded maximum retries (%u), leaving as disabled\n",
     2091                            pStreamEx->Core.szName, cMaxTries));
     2092
     2093                    /* Don't try to re-initialize anymore and mark as disabled. */
     2094                    /** @todo should mark it as not-initialized too, shouldn't we?   */
     2095                    pStreamEx->fStatus &= ~(PDMAUDIOSTREAM_STS_NEED_REINIT | PDMAUDIOSTREAM_STS_ENABLED);
     2096                    PDMAUDIOSTREAM_STS_ASSERT_VALID(pStreamEx->fStatus);
     2097
     2098                    /* Note: Further writes to this stream go to / will be read from the bit bucket (/dev/null) from now on. */
     2099                }
    20642100            }
    20652101        }
    20662102        else
    2067         {
    2068             /* Did we exceed our tries re-initializing the stream?
    2069              * Then this one is dead-in-the-water, so disable it for further use. */
    2070 /** @todo r=bird: This should be done above when drvAudioStreamReInitInternal fails! Duh^2! */
    2071             if (pStreamEx->cTriesReInit == cMaxTries)
    2072             {
    2073                 LogRel(("Audio: Re-initializing stream '%s' exceeded maximum retries (%u), leaving as disabled\n",
    2074                         pStreamEx->Core.szName, cMaxTries));
    2075 
    2076                 /* Don't try to re-initialize anymore and mark as disabled. */
    2077                 /** @todo should mark it as not-initialized too, shouldn't we?   */
    2078                 pStreamEx->fStatus &= ~(PDMAUDIOSTREAM_STS_NEED_REINIT | PDMAUDIOSTREAM_STS_ENABLED);
    2079                 PDMAUDIOSTREAM_STS_ASSERT_VALID(pStreamEx->fStatus);
    2080 
    2081                 /* Note: Further writes to this stream go to / will be read from the bit bucket (/dev/null) from now on. */
    2082             }
    2083         }
     2103            Log8Func(("cTriesReInit=%d hReqInitAsync=%p nsLast=%RU64 nsNow=%RU64 nsDelta=%RU64\n", pStreamEx->cTriesReInit,
     2104                      pStreamEx->hReqInitAsync, pStreamEx->nsLastReInit, nsNow, nsNow - pStreamEx->nsLastReInit));
    20842105
    20852106#ifdef LOG_ENABLED
    20862107        char szStreamSts[DRVAUDIO_STATUS_STR_MAX];
    20872108#endif
    2088         Log3Func(("[%s] fStatus=%s\n", pStreamEx->Core.szName, dbgAudioStreamStatusToStr(szStreamSts, pStreamEx->fStatus)));
     2109        Log3Func(("[%s] fStatus=%s\n", pStreamEx->Core.szName, drvAudioStreamStatusToStr(szStreamSts, pStreamEx->fStatus)));
    20892110    }
    20902111    else
     
    20942115    }
    20952116
     2117#ifdef VBOX_WITH_AUDIO_ENUM
     2118/** @todo do this elsewhere.  What if stuff changes when there are no open
     2119 *        streams to re-init? */
     2120    if (pThis->fEnumerateDevices)
     2121    {
     2122        /* Make sure to leave the driver's critical section before enumerating host stuff. */
     2123        int rc2 = RTCritSectLeave(&pThis->CritSect);
     2124        AssertRC(rc2);
     2125
     2126        /* Re-enumerate all host devices. */
     2127        drvAudioDevicesEnumerateInternal(pThis, true /* fLog */, NULL /* pDevEnum */);
     2128
     2129        /* Re-enter the critical section again. */
     2130        rc2 = RTCritSectEnter(&pThis->CritSect);
     2131        AssertRC(rc2);
     2132
     2133        pThis->fEnumerateDevices = false;
     2134    }
     2135#endif /* VBOX_WITH_AUDIO_ENUM */
     2136
    20962137    RTCritSectLeave(&pThis->CritSect);
     2138
    20972139    LogFlowFuncLeaveRC(rc);
    20982140    return rc;
     
    21772219    LogRel2(("Audio: %s stream '%s' backend (%s is %s; status: %s; backend-status: %s)\n",
    21782220             PDMAudioStrmCmdGetName(enmStreamCmd), pStreamEx->Core.szName, PDMAudioDirGetName(pStreamEx->Core.enmDir),
    2179              fDirEnabled ? "enabled" : "disabled",  dbgAudioStreamStatusToStr(szStreamSts, pStreamEx->fStatus),
    2180              dbgAudioStreamStatusToStr(szBackendStreamSts, fBackendStatus) ));
     2221             fDirEnabled ? "enabled" : "disabled",  drvAudioStreamStatusToStr(szStreamSts, pStreamEx->fStatus),
     2222             drvAudioStreamStatusToStr(szBackendStreamSts, fBackendStatus) ));
    21812223
    21822224    if (fDirEnabled)
     
    22382280 * @param   pStreamEx   Stream to reset.
    22392281 */
    2240 static void drvAudioStreamResetInternal(PDRVAUDIOSTREAM pStreamEx)
    2241 {
    2242     drvAudioStreamDropInternal(pStreamEx);
     2282static void drvAudioStreamResetOnDisable(PDRVAUDIOSTREAM pStreamEx)
     2283{
     2284    drvAudioStreamResetInternal(pStreamEx);
    22432285
    22442286    LogFunc(("[%s]\n", pStreamEx->Core.szName));
     
    23272369#endif
    23282370    LogFunc(("[%s] enmStreamCmd=%s fStatus=%s\n", pStreamEx->Core.szName, PDMAudioStrmCmdGetName(enmStreamCmd),
    2329              dbgAudioStreamStatusToStr(szStreamSts, pStreamEx->fStatus)));
     2371             drvAudioStreamStatusToStr(szStreamSts, pStreamEx->fStatus)));
    23302372
    23312373    int rc = VINF_SUCCESS;
     
    24012443                    rc = drvAudioStreamControlInternalBackend(pThis, pStreamEx, PDMAUDIOSTREAMCMD_DISABLE);
    24022444                    if (RT_SUCCESS(rc))
    2403                         drvAudioStreamResetInternal(pStreamEx);
     2445                        drvAudioStreamResetOnDisable(pStreamEx);
    24042446                }
    24052447            }
     
    27042746                 pStreamEx->offInternal, pStreamEx->Core.szName, pStreamEx->Out.cbPreBuffered - cbLeft,
    27052747                 pStreamEx->Out.cbPreBuffered, cbBuf, rc, *pcbWritten, drvAudioPlayStateName(pStreamEx->Out.enmPlayState) ));
    2706         AssertMsg(pStreamEx->Out.enmPlayState == DRVAUDIOPLAYSTATE_PREBUF_COMMITTING || RT_FAILURE(rc),
    2707                   ("Buggy host driver buffer reporting? cbLeft=%#x cbPreBuffered=%#x\n", cbLeft, pStreamEx->Out.cbPreBuffered));
     2748        AssertMsg(   pStreamEx->Out.enmPlayState == DRVAUDIOPLAYSTATE_PREBUF_COMMITTING
     2749                  || pStreamEx->Out.enmPlayState == DRVAUDIOPLAYSTATE_PREBUF
     2750                  || RT_FAILURE(rc),
     2751                  ("Buggy host driver buffer reporting? cbLeft=%#x cbPreBuffered=%#x enmPlayState=%s\n",
     2752                   cbLeft, pStreamEx->Out.cbPreBuffered, drvAudioPlayStateName(pStreamEx->Out.enmPlayState) ));
    27082753
    27092754        pStreamEx->Out.cbPreBuffered = cbLeft;
     
    27332778    char szStreamSts[DRVAUDIO_STATUS_STR_MAX];
    27342779#endif
    2735     Log3Func(("[%s] fStatus=%s\n", pStreamEx->Core.szName, dbgAudioStreamStatusToStr(szStreamSts, pStreamEx->fStatus)));
     2780    Log3Func(("[%s] fStatus=%s\n", pStreamEx->Core.szName, drvAudioStreamStatusToStr(szStreamSts, pStreamEx->fStatus)));
    27362781
    27372782    /* Not enabled or paused? Skip iteration. */
     
    28322877                        pStreamEx->fStatus &= ~(PDMAUDIOSTREAM_STS_ENABLED | PDMAUDIOSTREAM_STS_PENDING_DISABLE);
    28332878                        PDMAUDIOSTREAM_STS_ASSERT_VALID(pStreamEx->fStatus);
    2834                         drvAudioStreamDropInternal(pStreamEx); /* Not a DROP command, just a stream reset. */
     2879                        drvAudioStreamResetInternal(pStreamEx);
    28352880                    }
    28362881                    /** @todo r=bird: This log entry sounds a rather fishy to be honest...  Any
     
    30873132    char szStreamSts[DRVAUDIO_STATUS_STR_MAX];
    30883133#endif
    3089     Log3Func(("[%s] %s\n", pStreamEx->Core.szName, dbgAudioStreamStatusToStr(szStreamSts, fStrmStatus)));
     3134    Log3Func(("[%s] %s\n", pStreamEx->Core.szName, drvAudioStreamStatusToStr(szStreamSts, fStrmStatus)));
    30903135    return fStrmStatus;
    30913136}
     
    33293374                    if (cbBuf + pStreamEx->Out.cbPreBuffered < pStreamEx->Out.cbPreBufThreshold)
    33303375                        rc = drvAudioStreamPlayToPreBuffer(pStreamEx, pvBuf, cbBuf, pStreamEx->Out.cbPreBufThreshold, pcbWritten);
    3331                     else if (fBackendStatus & PDMAUDIOSTREAM_STS_INITIALIZED)
     3376                    else if (   (fBackendStatus & PDMAUDIOSTREAM_STS_INITIALIZED)
     3377                             && (pStreamEx->fStatus & PDMAUDIOSTREAM_STS_BACKEND_READY))
    33323378                    {
    33333379                        Log3Func(("[%s] Pre-buffering completing: cbBuf=%#x cbPreBuffered=%#x => %#x vs cbPreBufThreshold=%#x\n",
     
    33473393
    33483394                case DRVAUDIOPLAYSTATE_PREBUF_OVERDUE:
    3349                     Assert(!(pStreamEx->fStatus & PDMAUDIOSTREAM_STS_BACKEND_READY));
    3350                     Assert(!(fBackendStatus & PDMAUDIOSTREAM_STS_INITIALIZED));
     3395                    Assert(   !(pStreamEx->fStatus & PDMAUDIOSTREAM_STS_BACKEND_READY)
     3396                           || !(fBackendStatus & PDMAUDIOSTREAM_STS_INITIALIZED));
    33513397                    RT_FALL_THRU();
    33523398                case DRVAUDIOPLAYSTATE_PREBUF_SWITCHING:
     
    33643410                    pStreamEx->offInternal += cbBuf;
    33653411                    Log3Func(("[%s] Discarding the data, backend state: %s\n", pStreamEx->Core.szName,
    3366                               dbgAudioStreamStatusToStr(szState, fBackendStatus) ));
     3412                              drvAudioStreamStatusToStr(szState, fBackendStatus) ));
    33673413                    break;
    33683414
     
    36993745    char szStreamSts[DRVAUDIO_STATUS_STR_MAX];
    37003746#endif
    3701     Log3Func(("[%s] fStatus=%s\n", pStreamEx->Core.szName, dbgAudioStreamStatusToStr(szStreamSts, pStreamEx->fStatus)));
     3747    Log3Func(("[%s] fStatus=%s\n", pStreamEx->Core.szName, drvAudioStreamStatusToStr(szStreamSts, pStreamEx->fStatus)));
    37023748
    37033749    /*
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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