VirtualBox

Changeset 108361 in vbox


Ignore:
Timestamp:
Feb 24, 2025 6:09:03 PM (8 weeks ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
167721
Message:

Audio/DrvHostAudioWasApi: Two bugfixes for bugref:10844

  • Check for the device status when looking for a cache hit and invalidate the entry if the device is not in active state (anymore)
  • If the default device has been changed, also take the device role into account.

See comments for details.

File:
1 edited

Legend:

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

    r108360 r108361  
    569569        if (    m_pDrvWas != NULL
    570570            && (   (enmFlow == eRender  && !m_pDrvWas->pwszOutputDevId)
    571                 || (enmFlow == eCapture && !m_pDrvWas->pwszInputDevId)))
     571                || (enmFlow == eCapture && !m_pDrvWas->pwszInputDevId))
     572            /* We only care for the multimedia role of a device here.
     573             * Devices can have multiple roles they expose interfaces for.
     574             *
     575             * Not having this check will result in several OnDefaultDeviceChanged calls
     576             * with the same device ID but with a different role. However, in our audio stack there is no concept
     577             * of a device role, so we try avoiding that by only caring about eMultimedia.
     578             *
     579             * See @bugref{10844} */
     580            && (enmRole == eMultimedia)
     581           )
    572582        {
    573583            pIEnumerator = m_pDrvWas->pIEnumerator;
     
    12831293                    && RTUtf16Cmp(pDevEntry->wszDevId, pwszDevId) == 0)
    12841294                {
     1295                    /* First, try retrieving the current device state here as a yet another messure for
     1296                     * AUDCLNT_E_DEVICE_INVALIDATED errors.  See @bugref{10844} */
     1297                    DWORD dwState;
     1298                    hrc = pIDevice->GetState(&dwState);
     1299                    if (SUCCEEDED(hrc))
     1300                    {
     1301                        if (dwState != DEVICE_STATE_ACTIVE)
     1302                            LOG_STALE_DEVICE_BREAK(("WasAPI: Cache hit for device '%ls': Non-active state (state %#x)\n",
     1303                                                    pDevEntry->wszDevId, drvHostAudioWasMMDeviceStateToString(dwState)));
     1304                    }
     1305                    else
     1306                        LOG_STALE_DEVICE_BREAK(("WasAPI: Cache hit for device '%ls': Unable to retrieve state (hr=%#x)\n",
     1307                                                pDevEntry->wszDevId, hrc));
     1308
    12851309                    /*
    12861310                     * Cache hit -- here we now need to also check if the device interface we want to look up
Note: See TracChangeset for help on using the changeset viewer.

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