VirtualBox

Changeset 102638 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Dec 18, 2023 6:29:29 PM (13 months ago)
Author:
vboxsync
Message:

Audio/WAS: Attempt to fix crashes when invalidating the cached audio interfaces of the device entry configurations. This is needed when the audio interface becomes invalid on a host device switch.

This patch modifies the original one so that we don't remove the current device entry from the cache, but just create a new cached entry with the new audio interface instead. The former approach apparently caused crashes when putting back a stale cache entry back to the cache when completing the device switch.

bugref:10503

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DrvHostAudioWasApi.cpp

    r102612 r102638  
    812812}
    813813
    814 /**
    815  * Invalidates device cache entry configurations.
    816  *
    817  * This is needed in order to not run into deadlocks when trying to release a stale device interface
    818  * via Release().
    819  *
    820  * @param   pThis       The WASAPI host audio driver instance data.
    821  * @param   pDevEntry   The device entry to invalidate.
    822  */
    823 static void drvHostAudioWasCacheInvalidateDevEntryConfig(PDRVHOSTAUDIOWAS pThis, PDRVHOSTAUDIOWASCACHEDEV pDevEntry)
    824 {
    825     RT_NOREF(pThis);
    826 
    827     Log8Func(("Invalidating cache entry configurations: %p - '%ls'\n", pDevEntry, pDevEntry->wszDevId));
    828 
    829     PDRVHOSTAUDIOWASCACHEDEVCFG pDevCfg, pDevCfgNext;
    830     RTListForEachSafe(&pDevEntry->ConfigList, pDevCfg, pDevCfgNext, DRVHOSTAUDIOWASCACHEDEVCFG, ListEntry)
    831         pDevCfg->pIAudioClient = NULL;
    832 }
    833814
    834815/**
     
    12551236                 * actually matches the one we have in the cache entry.
    12561237                 *
    1257                  * If it doesn't, invalidate + remove the cache entry from the cache and bail out.
    1258                  * Add a new device entry to the cache with the new interface below then.
     1238                 * If it doesn't, bail out and add a new device entry to the cache with the new interface below then.
    12591239                 *
    12601240                 * This is needed when switching audio interfaces and the device interface becomes invalid via
    12611241                 * AUDCLNT_E_DEVICE_INVALIDATED.  See @bugref{10503}
    12621242                 */
    1263                 if (pIDevice != pDevEntry->pIDevice)
     1243                if (pDevEntry->pIDevice != pIDevice)
    12641244                {
    12651245                    LogRel2(("WasAPI: Cache hit for device '%ls': Stale interface (new: %p, old: %p)\n",
    12661246                              pDevEntry->wszDevId, pIDevice, pDevEntry->pIDevice));
    12671247
    1268                     LogRel(("WasAPI: Stale audio interface '%ls' detected! Invalidating audio interface ...\n",
    1269                             pDevEntry->wszDevId));
    1270 
    1271                     drvHostAudioWasCacheInvalidateDevEntryConfig(pThis, pDevEntry);
    1272                     RTListNodeRemove(&pDevEntry->ListEntry);
    1273                     drvHostAudioWasCacheDestroyDevEntry(pThis, pDevEntry);
    1274                     pDevEntry = NULL;
     1248                    LogRel(("WasAPI: Stale audio interface '%ls' detected!\n", pDevEntry->wszDevId));
    12751249                    break;
    12761250                }
Note: See TracChangeset for help on using the changeset viewer.

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