Changeset 107720 in vbox
- Timestamp:
- Jan 13, 2025 6:52:47 PM (2 months ago)
- svn:sync-xref-src-repo-rev:
- 166820
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r106061 r107720 1490 1490 * Release our stream reference. 1491 1491 */ 1492 uint32_t c Refs = drvAudioStreamReleaseInternal(pThis, pStreamEx, true /*fMayDestroy*/);1492 uint32_t const cRefs = drvAudioStreamReleaseInternal(pThis, pStreamEx, true /*fMayDestroy*/); 1493 1493 LogFlowFunc(("returns (fDestroyed=%d, cRefs=%u)\n", fDestroyed, cRefs)); RT_NOREF(cRefs); 1494 1494 } … … 2120 2120 * @param pStreamEx The stream to reference. 2121 2121 * @param fMayDestroy Whether the caller is allowed to implicitly destroy 2122 * the stream or not. 2122 * the stream or not. The reference count must _not_ 2123 * reach zero if this is false! 2123 2124 */ 2124 2125 static uint32_t drvAudioStreamReleaseInternal(PDRVAUDIO pThis, PDRVAUDIOSTREAM pStreamEx, bool fMayDestroy) … … 2156 2157 2157 2158 drvAudioStreamFree(pStreamEx); 2159 pStreamEx = NULL; 2158 2160 } 2159 2161 else … … 2169 2171 } 2170 2172 2171 Log12Func(("returns %u (%s)\n", cRefs, cRefs > 0 ? pStreamEx->Core.Cfg.szName : "destroyed")); 2173 Log12Func(("returns %u (%s)\n", cRefs, cRefs > 0 ? pStreamEx->Core.Cfg.szName : "destroyed")); /* Not 101% safe, but it's logging. */ 2172 2174 return cRefs; 2173 2175 } … … 2262 2264 LogFlowFunc(("Successfully cancelled pending pfnStreamInitAsync call (hReqInitAsync=%p).\n", 2263 2265 pStreamEx->hReqInitAsync)); 2264 drvAudioStreamReleaseInternal(pThis, pStreamEx, true /*fMayDestroy*/); 2266 uint32_t const cRefs = drvAudioStreamReleaseInternal(pThis, pStreamEx, true /*fMayDestroy*/); 2267 AssertStmt(cRefs > 0, pStreamEx = NULL); 2265 2268 } 2266 2269 else … … 2274 2277 RTCritSectLeave(&pStreamEx->Core.CritSect); 2275 2278 2276 /* 2277 * Now, if the backend requests asynchronous disabling and destruction 2278 * push the disabling and destroying over to a worker thread. 2279 * 2280 * This is a general offloading feature that all backends should make use of, 2281 * however it's rather precarious on macs where stopping an already draining 2282 * stream may take 8-10ms which naturally isn't something we should be doing 2283 * on an EMT. 2284 */ 2285 if (!(pThis->BackendCfg.fFlags & PDMAUDIOBACKEND_F_ASYNC_STREAM_DESTROY)) 2286 drvAudioStreamDestroyAsync(pThis, pStreamEx, fImmediate); 2287 else 2279 if (RT_LIKELY(pStreamEx != NULL)) /* paranoia^2 */ 2288 2280 { 2289 int rc2 = RTReqPoolCallEx(pThis->hReqPool, 0 /*cMillies*/, NULL /*phReq*/, 2290 RTREQFLAGS_VOID | RTREQFLAGS_NO_WAIT, 2291 (PFNRT)drvAudioStreamDestroyAsync, 3, pThis, pStreamEx, fImmediate); 2292 LogFlowFunc(("hReqInitAsync=%p rc2=%Rrc\n", pStreamEx->hReqInitAsync, rc2)); 2293 AssertRCStmt(rc2, drvAudioStreamDestroyAsync(pThis, pStreamEx, fImmediate)); 2281 /* 2282 * Now, if the backend requests asynchronous disabling and destruction 2283 * push the disabling and destroying over to a worker thread. 2284 * 2285 * This is a general offloading feature that all backends should make use of, 2286 * however it's rather precarious on macs where stopping an already draining 2287 * stream may take 8-10ms which naturally isn't something we should be doing 2288 * on an EMT. 2289 */ 2290 if (!(pThis->BackendCfg.fFlags & PDMAUDIOBACKEND_F_ASYNC_STREAM_DESTROY)) 2291 drvAudioStreamDestroyAsync(pThis, pStreamEx, fImmediate); 2292 else 2293 { 2294 int rc2 = RTReqPoolCallEx(pThis->hReqPool, 0 /*cMillies*/, NULL /*phReq*/, 2295 RTREQFLAGS_VOID | RTREQFLAGS_NO_WAIT, 2296 (PFNRT)drvAudioStreamDestroyAsync, 3, pThis, pStreamEx, fImmediate); 2297 LogFlowFunc(("hReqInitAsync=%p rc2=%Rrc\n", pStreamEx->hReqInitAsync, rc2)); 2298 AssertRCStmt(rc2, drvAudioStreamDestroyAsync(pThis, pStreamEx, fImmediate)); 2299 } 2294 2300 } 2295 2301 } … … 3950 3956 pIHostDrvAudio->pfnDoOnWorkerThread(pIHostDrvAudio, pStreamEx->pBackend, uUser, pvUser); 3951 3957 3952 drvAudioStreamReleaseInternal(pThis, pStreamEx, true /*fMayDestroy*/);3953 LogFlowFunc(("returns \n"));3958 uint32_t const cRefs = drvAudioStreamReleaseInternal(pThis, pStreamEx, true /*fMayDestroy*/); 3959 LogFlowFunc(("returns (cRefs=%u)\n", cRefs)); RT_NOREF(cRefs); 3954 3960 } 3955 3961
Note:
See TracChangeset
for help on using the changeset viewer.