Changeset 100874 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Aug 14, 2023 4:56:27 PM (19 months ago)
- svn:sync-xref-src-repo-rev:
- 158791
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvHostAudioWasApi.cpp
r99828 r100874 812 812 } 813 813 814 /** 815 * Invalidates device cache entry configurations. 816 * 817 * @param pThis The WASAPI host audio driver instance data. 818 * @param pDevEntry The device entry to invalidate. 819 */ 820 static void drvHostAudioWasCacheInvalidateDevEntryConfig(PDRVHOSTAUDIOWAS pThis, PDRVHOSTAUDIOWASCACHEDEV pDevEntry) 821 { 822 RT_NOREF(pThis); 823 824 Log8Func(("Invalidating cache entry configurations: %p - '%ls'\n", pDevEntry, pDevEntry->wszDevId)); 825 826 PDRVHOSTAUDIOWASCACHEDEVCFG pDevCfg, pDevCfgNext; 827 RTListForEachSafe(&pDevEntry->ConfigList, pDevCfg, pDevCfgNext, DRVHOSTAUDIOWASCACHEDEVCFG, ListEntry) 828 pDevCfg->pIAudioClient = NULL; 829 } 814 830 815 831 /** … … 1224 1240 * The cache has two levels, so first the device entry. 1225 1241 */ 1226 PDRVHOSTAUDIOWASCACHEDEV pDevEntry ;1242 PDRVHOSTAUDIOWASCACHEDEV pDevEntry, pDevEntryNext; 1227 1243 RTCritSectEnter(&pThis->CritSectCache); 1228 RTListForEach (&pThis->CacheHead, pDevEntry, DRVHOSTAUDIOWASCACHEDEV, ListEntry)1244 RTListForEachSafe(&pThis->CacheHead, pDevEntry, pDevEntryNext, DRVHOSTAUDIOWASCACHEDEV, ListEntry) 1229 1245 { 1230 1246 if ( pDevEntry->cwcDevId == cwcDevId … … 1232 1248 && RTUtf16Cmp(pDevEntry->wszDevId, pwszDevId) == 0) 1233 1249 { 1250 /* 1251 * Cache hit -- here we now need to also check if the device interface we want to look up 1252 * actually matches the one we have in the cache entry. 1253 * 1254 * If it doesn't, invalidate + remove the cache entry from the cache and bail out. 1255 * Add a new device entry to the cache with the new interface below then. 1256 * 1257 * This is needed when switching audio interfaces and the device interface becomes invalid via 1258 * AUDCLNT_E_DEVICE_INVALIDATED. See @bugref{10503} 1259 */ 1260 if (pIDevice != pDevEntry->pIDevice) 1261 { 1262 Log2Func(("Cache hit for device '%ls': Stale interface (new: %p, old: %p)\n", 1263 pDevEntry->wszDevId, pIDevice, pDevEntry->pIDevice)); 1264 1265 drvHostAudioWasCacheInvalidateDevEntryConfig(pThis, pDevEntry); 1266 RTListNodeRemove(&pDevEntry->ListEntry); 1267 drvHostAudioWasCacheDestroyDevEntry(pThis, pDevEntry); 1268 pDevEntry = NULL; 1269 break; 1270 } 1271 1234 1272 CoTaskMemFree(pwszDevId); 1235 1273 Log8Func(("Cache hit for device '%ls': %p\n", pDevEntry->wszDevId, pDevEntry)); … … 1238 1276 } 1239 1277 RTCritSectLeave(&pThis->CritSectCache); 1278 1279 Log8Func(("Cache miss for device '%ls': %p\n", pDevEntry->wszDevId, pDevEntry)); 1240 1280 1241 1281 /*
Note:
See TracChangeset
for help on using the changeset viewer.