Changeset 63671 in vbox for trunk/src/VBox/Devices/Audio
- Timestamp:
- Aug 31, 2016 9:32:01 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r63624 r63671 44 44 static int drvAudioStreamControlInternalBackend(PDRVAUDIO pThis, PPDMAUDIOSTREAM pStream, PDMAUDIOSTREAMCMD enmStreamCmd); 45 45 static int drvAudioStreamControlInternal(PDRVAUDIO pThis, PPDMAUDIOSTREAM pStream, PDMAUDIOSTREAMCMD enmStreamCmd); 46 static int drvAudioStreamDestroyIn ternalBackend(PDRVAUDIO pThis, PPDMAUDIOSTREAM pHstStream);47 static int drvAudioStream DestroyInternal(PDRVAUDIO pThis, PPDMAUDIOSTREAM pStream);46 static int drvAudioStreamDestroyInBackendInternal(PDRVAUDIO pThis, PPDMAUDIOSTREAM pHstStream); 47 static int drvAudioStreamUninitInternal(PDRVAUDIO pThis, PPDMAUDIOSTREAM pStream); 48 48 static int drvAudioStreamInitInternal(PDRVAUDIO pThis, PPDMAUDIOSTREAM pStream, PPDMAUDIOSTREAMCFG pCfgHost, PPDMAUDIOSTREAMCFG pCfgGuest); 49 49 static int drvAudioStreamIterateInternal(PDRVAUDIO pThis, PPDMAUDIOSTREAM pStream); … … 150 150 if (pHstStream) 151 151 { 152 Assert(pHstStream->enmCtx == PDMAUDIOSTREAMCTX_HOST); 152 AssertReleaseMsg(pHstStream->enmCtx == PDMAUDIOSTREAMCTX_HOST, 153 ("Stream '%s' resolved as host part is not marked as such (enmCtx=%RU32)\n", 154 pHstStream->szName, pHstStream->enmCtx)); 155 156 AssertReleaseMsg(pHstStream->pPair != NULL, 157 ("Stream '%s' resolved as host part has no guest part (anymore)\n", pHstStream->szName)); 153 158 } 154 159 else 155 LogFlowFunc(("%s: Warning: Does not have a host stream (anymore)\n", pStream->szName)); 160 AssertReleaseMsgFailed(("Stream '%s' does not have a host pair (anymore)\n", 161 pStream->szName)); 156 162 157 163 return pHstStream; … … 528 534 DrvAudioHlpStreamCfgPrint(pCfgHost); 529 535 #else 536 LogRel2(("Audio: Creating stream '%s'\n", pStream->szName)); 530 537 LogRel2(("Audio: Requested %s host format for '%s': %RU32Hz, %s, %RU8 %s\n", 531 pCfgGuest->enmDir == PDMAUDIODIR_IN ? "recording" : "playback", 538 pCfgGuest->enmDir == PDMAUDIODIR_IN ? "recording" : "playback", pStream->szName, 532 539 pCfgHost->uHz, DrvAudioHlpAudFmtToStr(pCfgHost->enmFormat), 533 540 pCfgHost->cChannels, pCfgHost->cChannels == 0 ? "Channel" : "Channels")); … … 538 545 if (RT_FAILURE(rc)) 539 546 { 540 Log FlowFunc(("[%s] Initializing stream in host backend failed with rc=%Rrc\n", pStream->szName, rc));547 LogRel2(("Audio: Creating stream '%s' in backend failed with %Rrc\n", pStream->szName, rc)); 541 548 return rc; 542 549 } … … 639 646 /* Make a copy of the host stream configuration. */ 640 647 memcpy(&pGstStream->Cfg, pCfgGuest, sizeof(PDMAUDIOSTREAMCFG)); 648 649 if (RT_FAILURE(rc)) 650 LogRel2(("Audio: Creating stream '%s' failed with %Rrc\n", pStream->szName, rc)); 641 651 642 652 LogFlowFunc(("[%s] Returning %Rrc\n", pStream->szName, rc)); … … 1445 1455 AssertPtrReturn(pDrvIns, VERR_INVALID_POINTER); 1446 1456 1457 LogRel2(("Audio: Verbose logging enabled\n")); 1458 1447 1459 PDRVAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIO); 1448 1460 LogFlowFunc(("pThis=%p, pDrvIns=%p\n", pThis, pDrvIns)); … … 1687 1699 if (pGstStrm) 1688 1700 { 1689 drvAudioStreamDestroyInternal(pThis, pGstStrm); 1690 pGstStrm = NULL; 1701 int rc2 = drvAudioStreamUninitInternal(pThis, pGstStrm); 1702 if (RT_SUCCESS(rc2)) 1703 { 1704 RTMemFree(pGstStrm); 1705 pGstStrm = NULL; 1706 } 1691 1707 } 1692 1708 1693 1709 if (pHstStrm) 1694 1710 { 1695 drvAudioStreamDestroyInternal(pThis, pHstStrm); 1696 pHstStrm = NULL; 1711 int rc2 = drvAudioStreamUninitInternal(pThis, pHstStrm); 1712 if (RT_SUCCESS(rc2)) 1713 { 1714 RTMemFree(pHstStrm); 1715 pHstStrm = NULL; 1716 } 1697 1717 } 1698 1718 } … … 1946 1966 PPDMAUDIOSTREAM pGstStream = pHstStream ? pHstStream->pPair : pStream; 1947 1967 1948 LogFlowFunc(("\tHost : %s\n", pHstStream ? pHstStream->szName : "<None>")); 1949 LogFlowFunc(("\tGuest: %s\n", pGstStream ? pGstStream->szName : "<None>")); 1968 LogRel2(("Audio: Destroying host stream '%s' (guest stream '%s')\n", 1969 pHstStream ? pHstStream->szName : "<None>", 1970 pGstStream ? pGstStream->szName : "<None>")); 1950 1971 1951 1972 /* Should prevent double frees. */ … … 1954 1975 if (pHstStream) 1955 1976 { 1956 pHstStream->pPair = NULL; 1957 RTListNodeRemove(&pHstStream->Node); 1958 } 1959 1960 if (pGstStream) 1961 { 1962 pGstStream->pPair = NULL; 1963 RTListNodeRemove(&pGstStream->Node); 1964 } 1965 1966 if (pHstStream) 1967 { 1968 rc = drvAudioStreamDestroyInternal(pThis, pHstStream); 1969 AssertRC(rc); 1970 1971 pHstStream = NULL; 1972 } 1973 1974 if (pGstStream) 1975 { 1976 rc = drvAudioStreamDestroyInternal(pThis, pGstStream); 1977 AssertRC(rc); 1978 1979 pGstStream = NULL; 1977 rc = drvAudioStreamUninitInternal(pThis, pHstStream); 1978 if (RT_SUCCESS(rc)) 1979 { 1980 RTListNodeRemove(&pHstStream->Node); 1981 1982 RTMemFree(pHstStream); 1983 pHstStream = NULL; 1984 } 1985 else 1986 LogRel2(("Audio: Uninitializing host stream '%s' failed with %Rrc\n", pHstStream->szName, rc)); 1987 } 1988 1989 if ( RT_SUCCESS(rc) 1990 && pGstStream) 1991 { 1992 rc = drvAudioStreamUninitInternal(pThis, pGstStream); 1993 if (RT_SUCCESS(rc)) 1994 { 1995 RTListNodeRemove(&pGstStream->Node); 1996 1997 RTMemFree(pGstStream); 1998 pGstStream = NULL; 1999 } 2000 else 2001 LogRel2(("Audio: Uninitializing guest stream '%s' failed with %Rrc\n", pGstStream->szName, rc)); 1980 2002 } 1981 2003 } … … 2008 2030 * @param pHstStream Host audio stream to call the backend destruction for. 2009 2031 */ 2010 static int drvAudioStreamDestroyIn ternalBackend(PDRVAUDIO pThis, PPDMAUDIOSTREAM pHstStream)2032 static int drvAudioStreamDestroyInBackendInternal(PDRVAUDIO pThis, PPDMAUDIOSTREAM pHstStream) 2011 2033 { 2012 2034 AssertPtrReturn(pThis, VERR_INVALID_POINTER); … … 2035 2057 2036 2058 /** 2037 * Destroys an audio stream.2059 * Uninitializes an audio stream. 2038 2060 * 2039 2061 * @returns IPRT status code. 2040 2062 * @param pThis Pointer to driver instance. 2041 * @param pStream Pointer to audio stream to destroy. 2042 * That pointer will be invalid after successful destruction. 2043 */ 2044 static int drvAudioStreamDestroyInternal(PDRVAUDIO pThis, PPDMAUDIOSTREAM pStream) 2063 * @param pStream Pointer to audio stream to uninitialize. 2064 */ 2065 static int drvAudioStreamUninitInternal(PDRVAUDIO pThis, PPDMAUDIOSTREAM pStream) 2045 2066 { 2046 2067 AssertPtrReturn(pThis, VERR_INVALID_POINTER); … … 2080 2101 else if (pStream->enmCtx == PDMAUDIOSTREAMCTX_HOST) 2081 2102 { 2082 rc = drvAudioStreamDestroyIn ternalBackend(pThis, pStream);2103 rc = drvAudioStreamDestroyInBackendInternal(pThis, pStream); 2083 2104 2084 2105 if (pStream->enmDir == PDMAUDIODIR_IN) … … 2100 2121 if (RT_SUCCESS(rc)) 2101 2122 { 2123 /* Make sure that the pair (if any) knows that we're not valid anymore. */ 2124 if (pStream->pPair) 2125 pStream->pPair->pPair = NULL; 2126 2127 /* Reset status. */ 2128 pStream->fStatus = PDMAUDIOSTRMSTS_FLAG_NONE; 2129 2130 /* Clear name. */ 2131 pStream->szName[0] = '\0'; 2132 2102 2133 /* Destroy mixing buffer. */ 2103 2134 AudioMixBufDestroy(&pStream->MixBuf); 2104 2105 if (pStream)2106 {2107 RTMemFree(pStream);2108 pStream = NULL;2109 }2110 2135 } 2111 2136 … … 2148 2173 PPDMAUDIOSTREAM pStream; 2149 2174 RTListForEach(&pThis->lstHstStreams, pStream, PDMAUDIOSTREAM, Node) 2150 drvAudioStreamDestroyIn ternalBackend(pThis, pStream);2175 drvAudioStreamDestroyInBackendInternal(pThis, pStream); 2151 2176 2152 2177 /* … … 2283 2308 PPDMAUDIOSTREAM pStream, pStreamNext; 2284 2309 RTListForEachSafe(&pThis->lstHstStreams, pStream, pStreamNext, PDMAUDIOSTREAM, Node) 2285 drvAudioStreamDestroyInternal(pThis, pStream); 2310 { 2311 rc2 = drvAudioStreamUninitInternal(pThis, pStream); 2312 if (RT_SUCCESS(rc2)) 2313 { 2314 RTListNodeRemove(&pStream->Node); 2315 2316 RTMemFree(pStream); 2317 pStream = NULL; 2318 } 2319 } 2320 2321 /* Sanity. */ 2322 Assert(RTListIsEmpty(&pThis->lstHstStreams)); 2286 2323 2287 2324 RTListForEachSafe(&pThis->lstGstStreams, pStream, pStreamNext, PDMAUDIOSTREAM, Node) 2288 drvAudioStreamDestroyInternal(pThis, pStream); 2325 { 2326 rc2 = drvAudioStreamUninitInternal(pThis, pStream); 2327 if (RT_SUCCESS(rc2)) 2328 { 2329 RTListNodeRemove(&pStream->Node); 2330 2331 RTMemFree(pStream); 2332 pStream = NULL; 2333 } 2334 } 2335 2336 /* Sanity. */ 2337 Assert(RTListIsEmpty(&pThis->lstGstStreams)); 2289 2338 2290 2339 #ifdef VBOX_WITH_AUDIO_CALLBACKS
Note:
See TracChangeset
for help on using the changeset viewer.