VirtualBox

Changeset 73566 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 8, 2018 2:58:40 PM (6 years ago)
Author:
vboxsync
Message:

Audio/Mixer: Disable the old recording source (if any) in audioMixerSinkSetRecSourceInternal() before setting a new one -- should save a few CPU cycles.

File:
1 edited

Legend:

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

    r73561 r73566  
    13901390    AssertMsg(pSink->enmDir == AUDMIXSINKDIR_INPUT, ("Specified sink is not an input sink\n"));
    13911391
    1392     if (pStream) /* Can be NULL if un-setting. */
    1393     {
    1394         AssertPtr(pStream->pStream);
    1395         AssertMsg(pStream->pStream->enmDir == PDMAUDIODIR_IN, ("Specified stream is not an input stream\n"));
    1396     }
    1397 
    1398     pSink->In.pStreamRecSource = pStream;
    1399 
    1400     LogFunc(("[%s] Recording source is now '%s'\n",
    1401              pSink->pszName, pSink->In.pStreamRecSource ? pSink->In.pStreamRecSource->pszName : "<None>"));
    1402     return VINF_SUCCESS;
     1392    int rc;
     1393
     1394    if (pSink->In.pStreamRecSource) /* Disable old recording source, if any set. */
     1395    {
     1396        const PPDMIAUDIOCONNECTOR pConn = pSink->In.pStreamRecSource->pConn;
     1397        AssertPtr(pConn);
     1398        rc = pConn->pfnEnable(pConn, PDMAUDIODIR_IN, false /* Disable */);
     1399    }
     1400    else
     1401        rc = VINF_SUCCESS;
     1402
     1403    if (RT_SUCCESS(rc))
     1404    {
     1405        if (pStream) /* Can be NULL if un-setting. */
     1406        {
     1407            AssertPtr(pStream->pStream);
     1408            AssertMsg(pStream->pStream->enmDir == PDMAUDIODIR_IN, ("Specified stream is not an input stream\n"));
     1409        }
     1410
     1411        pSink->In.pStreamRecSource = pStream;
     1412
     1413        if (pSink->In.pStreamRecSource)
     1414        {
     1415            const PPDMIAUDIOCONNECTOR pConn = pSink->In.pStreamRecSource->pConn;
     1416            AssertPtr(pConn);
     1417            rc = pConn->pfnEnable(pConn, PDMAUDIODIR_IN, true /* Enable */);
     1418        }
     1419    }
     1420
     1421    LogFunc(("[%s] Recording source is now '%s', rc=%Rrc\n",
     1422             pSink->pszName, pSink->In.pStreamRecSource ? pSink->In.pStreamRecSource->pszName : "<None>", rc));
     1423
     1424    return rc;
    14031425}
    14041426
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