Changeset 88724 in vbox for trunk/src/VBox/Devices/Audio/DrvAudio.cpp
- Timestamp:
- Apr 27, 2021 10:24:18 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r88723 r88724 326 326 * @param fStatus Stream status flags to convert. 327 327 */ 328 static const char *dbgAudioStreamStatusToStr(char pszDst[DRVAUDIO_STATUS_STR_MAX], PDMAUDIOSTREAMSTSfStatus)328 static const char *dbgAudioStreamStatusToStr(char pszDst[DRVAUDIO_STATUS_STR_MAX], uint32_t fStatus) 329 329 { 330 330 static const struct … … 332 332 const char *pszMnemonic; 333 333 uint32_t cchMnemnonic; 334 PDMAUDIOSTREAMSTSfFlag;334 uint32_t fFlag; 335 335 } s_aFlags[] = 336 336 { 337 { RT_STR_TUPLE("INITIALIZED "), PDMAUDIOSTREAM STS_FLAGS_INITIALIZED },338 { RT_STR_TUPLE("ENABLED "), PDMAUDIOSTREAM STS_FLAGS_ENABLED },339 { RT_STR_TUPLE("PAUSED "), PDMAUDIOSTREAM STS_FLAGS_PAUSED },340 { RT_STR_TUPLE("PENDING_DISABLE "), PDMAUDIOSTREAM STS_FLAGS_PENDING_DISABLE },341 { RT_STR_TUPLE("NEED_REINIT "), PDMAUDIOSTREAM STS_FLAGS_NEED_REINIT },337 { RT_STR_TUPLE("INITIALIZED "), PDMAUDIOSTREAM_STS_INITIALIZED }, 338 { RT_STR_TUPLE("ENABLED "), PDMAUDIOSTREAM_STS_ENABLED }, 339 { RT_STR_TUPLE("PAUSED "), PDMAUDIOSTREAM_STS_PAUSED }, 340 { RT_STR_TUPLE("PENDING_DISABLE "), PDMAUDIOSTREAM_STS_PENDING_DISABLE }, 341 { RT_STR_TUPLE("NEED_REINIT "), PDMAUDIOSTREAM_STS_NEED_REINIT }, 342 342 }; 343 343 if (!fStatus) … … 428 428 LogFunc(("[%s]\n", pStreamEx->Core.szName)); 429 429 430 pStreamEx->Core.fStatus = PDMAUDIOSTREAM STS_FLAGS_INITIALIZED;430 pStreamEx->Core.fStatus = PDMAUDIOSTREAM_STS_INITIALIZED; 431 431 pStreamEx->Core.fWarningsShown = PDMAUDIOSTREAM_WARN_FLAGS_NONE; 432 432 … … 469 469 && pStreamEx->Core.cRefs >= 1) 470 470 { 471 if (pStreamEx->Core.fStatus & PDMAUDIOSTREAM STS_FLAGS_PENDING_DISABLE)471 if (pStreamEx->Core.fStatus & PDMAUDIOSTREAM_STS_PENDING_DISABLE) 472 472 { 473 473 drvAudioStreamIterateInternal(pThis, pStreamEx); 474 474 475 if (pStreamEx->Core.fStatus & PDMAUDIOSTREAM STS_FLAGS_PENDING_DISABLE)475 if (pStreamEx->Core.fStatus & PDMAUDIOSTREAM_STS_PENDING_DISABLE) 476 476 cMilliesToNext = 10; 477 477 } … … 995 995 PPDMAUDIOSTREAMCFG pCfgReq, PPDMAUDIOSTREAMCFG pCfgAcq) 996 996 { 997 AssertMsg((pStreamEx->Core.fStatus & PDMAUDIOSTREAM STS_FLAGS_INITIALIZED) == 0,997 AssertMsg((pStreamEx->Core.fStatus & PDMAUDIOSTREAM_STS_INITIALIZED) == 0, 998 998 ("Stream '%s' already initialized in backend\n", pStreamEx->Core.szName)); 999 999 … … 1083 1083 VERR_INVALID_PARAMETER); 1084 1084 1085 pStreamEx->Core.fStatus |= PDMAUDIOSTREAM STS_FLAGS_INITIALIZED;1085 pStreamEx->Core.fStatus |= PDMAUDIOSTREAM_STS_INITIALIZED; 1086 1086 1087 1087 return VINF_SUCCESS; … … 1487 1487 LogFunc(("[%s] fStatus=%s\n", pStreamEx->Core.szName, dbgAudioStreamStatusToStr(szStreamSts, pStreamEx->Core.fStatus))); 1488 1488 1489 if (pStreamEx->Core.fStatus & PDMAUDIOSTREAM STS_FLAGS_INITIALIZED)1489 if (pStreamEx->Core.fStatus & PDMAUDIOSTREAM_STS_INITIALIZED) 1490 1490 { 1491 1491 AssertPtr(pStreamEx->pBackend); … … 1496 1496 rc = pThis->pHostDrvAudio->pfnStreamDestroy(pThis->pHostDrvAudio, pStreamEx->pBackend); 1497 1497 1498 pStreamEx->Core.fStatus &= ~PDMAUDIOSTREAM STS_FLAGS_INITIALIZED;1498 pStreamEx->Core.fStatus &= ~PDMAUDIOSTREAM_STS_INITIALIZED; 1499 1499 } 1500 1500 … … 1546 1546 { 1547 1547 #ifdef LOG_ENABLED 1548 if (pStreamEx->Core.fStatus != PDMAUDIOSTREAM STS_FLAGS_NONE)1548 if (pStreamEx->Core.fStatus != PDMAUDIOSTREAM_STS_NONE) 1549 1549 { 1550 1550 char szStreamSts[DRVAUDIO_STATUS_STR_MAX]; … … 1553 1553 } 1554 1554 #endif 1555 pStreamEx->Core.fStatus = PDMAUDIOSTREAM STS_FLAGS_NONE;1555 pStreamEx->Core.fStatus = PDMAUDIOSTREAM_STS_NONE; 1556 1556 } 1557 1557 … … 1661 1661 * Gather current stream status. 1662 1662 */ 1663 const bool fIsEnabled = RT_BOOL(pStreamEx->Core.fStatus & PDMAUDIOSTREAM STS_FLAGS_ENABLED); /* Stream is enabled? */1663 const bool fIsEnabled = RT_BOOL(pStreamEx->Core.fStatus & PDMAUDIOSTREAM_STS_ENABLED); /* Stream is enabled? */ 1664 1664 1665 1665 /* … … 1712 1712 AssertReturn(pStreamEx->Core.uMagic == PDMAUDIOSTREAM_MAGIC, VERR_INVALID_MAGIC); 1713 1713 AssertReturn(pStreamEx->uMagic == DRVAUDIOSTREAM_MAGIC, VERR_INVALID_MAGIC); 1714 AssertReturn(pStreamEx->Core.fStatus & PDMAUDIOSTREAM STS_FLAGS_NEED_REINIT, VERR_INVALID_STATE);1714 AssertReturn(pStreamEx->Core.fStatus & PDMAUDIOSTREAM_STS_NEED_REINIT, VERR_INVALID_STATE); 1715 1715 LogFlowFunc(("\n")); 1716 1716 … … 1718 1718 AssertRCReturn(rc, rc); 1719 1719 1720 if (pStreamEx->Core.fStatus & PDMAUDIOSTREAM STS_FLAGS_NEED_REINIT)1720 if (pStreamEx->Core.fStatus & PDMAUDIOSTREAM_STS_NEED_REINIT) 1721 1721 { 1722 1722 const unsigned cMaxTries = 3; /** @todo Make this configurable? */ … … 1749 1749 { 1750 1750 /* Remove the pending re-init flag on success. */ 1751 pStreamEx->Core.fStatus &= ~PDMAUDIOSTREAM STS_FLAGS_NEED_REINIT;1751 pStreamEx->Core.fStatus &= ~PDMAUDIOSTREAM_STS_NEED_REINIT; 1752 1752 } 1753 1753 else … … 1767 1767 1768 1768 /* Don't try to re-initialize anymore and mark as disabled. */ 1769 pStreamEx->Core.fStatus &= ~(PDMAUDIOSTREAM STS_FLAGS_NEED_REINIT | PDMAUDIOSTREAMSTS_FLAGS_ENABLED);1769 pStreamEx->Core.fStatus &= ~(PDMAUDIOSTREAM_STS_NEED_REINIT | PDMAUDIOSTREAM_STS_ENABLED); 1770 1770 1771 1771 /* Note: Further writes to this stream go to / will be read from the bit bucket (/dev/null) from now on. */ … … 1955 1955 case PDMAUDIOSTREAMCMD_ENABLE: 1956 1956 { 1957 if (!(pStreamEx->Core.fStatus & PDMAUDIOSTREAM STS_FLAGS_ENABLED))1957 if (!(pStreamEx->Core.fStatus & PDMAUDIOSTREAM_STS_ENABLED)) 1958 1958 { 1959 1959 /* Is a pending disable outstanding? Then disable first. */ 1960 if (pStreamEx->Core.fStatus & PDMAUDIOSTREAM STS_FLAGS_PENDING_DISABLE)1960 if (pStreamEx->Core.fStatus & PDMAUDIOSTREAM_STS_PENDING_DISABLE) 1961 1961 rc = drvAudioStreamControlInternalBackend(pThis, pStreamEx, PDMAUDIOSTREAMCMD_DISABLE); 1962 1962 … … 1965 1965 1966 1966 if (RT_SUCCESS(rc)) 1967 pStreamEx->Core.fStatus |= PDMAUDIOSTREAM STS_FLAGS_ENABLED;1967 pStreamEx->Core.fStatus |= PDMAUDIOSTREAM_STS_ENABLED; 1968 1968 } 1969 1969 break; … … 1972 1972 case PDMAUDIOSTREAMCMD_DISABLE: 1973 1973 { 1974 if (pStreamEx->Core.fStatus & PDMAUDIOSTREAM STS_FLAGS_ENABLED)1974 if (pStreamEx->Core.fStatus & PDMAUDIOSTREAM_STS_ENABLED) 1975 1975 { 1976 1976 /* … … 1982 1982 { 1983 1983 LogFunc(("[%s] Pending disable/pause\n", pStreamEx->Core.szName)); 1984 pStreamEx->Core.fStatus |= PDMAUDIOSTREAM STS_FLAGS_PENDING_DISABLE;1984 pStreamEx->Core.fStatus |= PDMAUDIOSTREAM_STS_PENDING_DISABLE; 1985 1985 1986 1986 /* Schedule a follow up timer to the pending-disable state. We cannot rely … … 1998 1998 1999 1999 /* Can we close the host stream as well (not in pending disable mode)? */ 2000 if (!(pStreamEx->Core.fStatus & PDMAUDIOSTREAM STS_FLAGS_PENDING_DISABLE))2000 if (!(pStreamEx->Core.fStatus & PDMAUDIOSTREAM_STS_PENDING_DISABLE)) 2001 2001 { 2002 2002 rc = drvAudioStreamControlInternalBackend(pThis, pStreamEx, PDMAUDIOSTREAMCMD_DISABLE); … … 2010 2010 case PDMAUDIOSTREAMCMD_PAUSE: 2011 2011 { 2012 if (!(pStreamEx->Core.fStatus & PDMAUDIOSTREAM STS_FLAGS_PAUSED))2012 if (!(pStreamEx->Core.fStatus & PDMAUDIOSTREAM_STS_PAUSED)) 2013 2013 { 2014 2014 rc = drvAudioStreamControlInternalBackend(pThis, pStreamEx, PDMAUDIOSTREAMCMD_PAUSE); 2015 2015 if (RT_SUCCESS(rc)) 2016 pStreamEx->Core.fStatus |= PDMAUDIOSTREAM STS_FLAGS_PAUSED;2016 pStreamEx->Core.fStatus |= PDMAUDIOSTREAM_STS_PAUSED; 2017 2017 } 2018 2018 break; … … 2021 2021 case PDMAUDIOSTREAMCMD_RESUME: 2022 2022 { 2023 if (pStreamEx->Core.fStatus & PDMAUDIOSTREAM STS_FLAGS_PAUSED)2023 if (pStreamEx->Core.fStatus & PDMAUDIOSTREAM_STS_PAUSED) 2024 2024 { 2025 2025 rc = drvAudioStreamControlInternalBackend(pThis, pStreamEx, PDMAUDIOSTREAMCMD_RESUME); 2026 2026 if (RT_SUCCESS(rc)) 2027 pStreamEx->Core.fStatus &= ~PDMAUDIOSTREAM STS_FLAGS_PAUSED;2027 pStreamEx->Core.fStatus &= ~PDMAUDIOSTREAM_STS_PAUSED; 2028 2028 } 2029 2029 break; … … 2146 2146 * Try play "Windows Navigation Start.wav" on Windows 7 (2824 samples). 2147 2147 */ 2148 else if ( (pStreamEx->Core.fStatus & PDMAUDIOSTREAM STS_FLAGS_PENDING_DISABLE)2148 else if ( (pStreamEx->Core.fStatus & PDMAUDIOSTREAM_STS_PENDING_DISABLE) 2149 2149 && pStreamEx->Out.cbPreBuffered > 0) 2150 2150 { … … 2278 2278 2279 2279 /* Not enabled or paused? Skip iteration. */ 2280 if ( !(pStreamEx->Core.fStatus & PDMAUDIOSTREAM STS_FLAGS_ENABLED)2281 || (pStreamEx->Core.fStatus & PDMAUDIOSTREAM STS_FLAGS_PAUSED))2280 if ( !(pStreamEx->Core.fStatus & PDMAUDIOSTREAM_STS_ENABLED) 2281 || (pStreamEx->Core.fStatus & PDMAUDIOSTREAM_STS_PAUSED)) 2282 2282 { 2283 2283 return VINF_SUCCESS; … … 2288 2288 */ 2289 2289 int rc = VINF_SUCCESS; 2290 if (!(pStreamEx->Core.fStatus & PDMAUDIOSTREAM STS_FLAGS_PENDING_DISABLE))2290 if (!(pStreamEx->Core.fStatus & PDMAUDIOSTREAM_STS_PENDING_DISABLE)) 2291 2291 { /* likely until we get to the end of the stream at least. */ } 2292 2292 else … … 2348 2348 if (RT_SUCCESS(rc)) 2349 2349 { 2350 pStreamEx->Core.fStatus &= ~(PDMAUDIOSTREAM STS_FLAGS_ENABLED | PDMAUDIOSTREAMSTS_FLAGS_PENDING_DISABLE);2350 pStreamEx->Core.fStatus &= ~(PDMAUDIOSTREAM_STS_ENABLED | PDMAUDIOSTREAM_STS_PENDING_DISABLE); 2351 2351 drvAudioStreamDropInternal(pThis, pStreamEx); /* Not a DROP command, just a stream reset. */ 2352 2352 } … … 2441 2441 * Reading the actual data from a stream then will return silence then. 2442 2442 */ 2443 PDMAUDIOSTREAMSTS fStatus = PDMAUDIOSTREAMSTS_FLAGS_NONE;2443 uint32_t fStatus = PDMAUDIOSTREAM_STS_NONE; 2444 2444 if (pThis->pHostDrvAudio->pfnStreamGetStatus) 2445 2445 fStatus = pThis->pHostDrvAudio->pfnStreamGetStatus(pThis->pHostDrvAudio, pStreamEx->pBackend); … … 2545 2545 * @interface_method_impl{PDMIAUDIOCONNECTOR,pfnStreamGetStatus} 2546 2546 */ 2547 static DECLCALLBACK( PDMAUDIOSTREAMSTS) drvAudioStreamGetStatus(PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOSTREAM pStream)2547 static DECLCALLBACK(uint32_t) drvAudioStreamGetStatus(PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOSTREAM pStream) 2548 2548 { 2549 2549 PDRVAUDIO pThis = RT_FROM_MEMBER(pInterface, DRVAUDIO, IAudioConnector); … … 2553 2553 * this necessary? */ 2554 2554 if (!pStream) 2555 return PDMAUDIOSTREAM STS_FLAGS_NONE;2555 return PDMAUDIOSTREAM_STS_NONE; 2556 2556 PDRVAUDIOSTREAM pStreamEx = (PDRVAUDIOSTREAM)pStream; 2557 AssertPtrReturn(pStreamEx, PDMAUDIOSTREAM STS_FLAGS_NONE);2558 AssertReturn(pStreamEx->Core.uMagic == PDMAUDIOSTREAM_MAGIC, PDMAUDIOSTREAM STS_FLAGS_NONE);2559 AssertReturn(pStreamEx->uMagic == DRVAUDIOSTREAM_MAGIC, PDMAUDIOSTREAM STS_FLAGS_NONE);2557 AssertPtrReturn(pStreamEx, PDMAUDIOSTREAM_STS_NONE); 2558 AssertReturn(pStreamEx->Core.uMagic == PDMAUDIOSTREAM_MAGIC, PDMAUDIOSTREAM_STS_NONE); 2559 AssertReturn(pStreamEx->uMagic == DRVAUDIOSTREAM_MAGIC, PDMAUDIOSTREAM_STS_NONE); 2560 2560 2561 2561 int rc = RTCritSectEnter(&pThis->CritSect); 2562 AssertRCReturn(rc, PDMAUDIOSTREAM STS_FLAGS_NONE);2563 2564 PDMAUDIOSTREAMSTSfStrmStatus = pStreamEx->Core.fStatus;2562 AssertRCReturn(rc, PDMAUDIOSTREAM_STS_NONE); 2563 2564 uint32_t fStrmStatus = pStreamEx->Core.fStatus; 2565 2565 2566 2566 RTCritSectLeave(&pThis->CritSect); … … 3047 3047 RTListForEach(&pThis->lstStreams, pStreamEx, DRVAUDIOSTREAM, ListEntry) 3048 3048 { 3049 pStreamEx->Core.fStatus |= PDMAUDIOSTREAM STS_FLAGS_NEED_REINIT;3049 pStreamEx->Core.fStatus |= PDMAUDIOSTREAM_STS_NEED_REINIT; 3050 3050 pStreamEx->cTriesReInit = 0; 3051 3051 pStreamEx->nsLastReInit = 0;
Note:
See TracChangeset
for help on using the changeset viewer.