VirtualBox

Changeset 73581 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 9, 2018 9:27:19 AM (6 years ago)
Author:
vboxsync
Message:

Audio/Mixer: Skip handling input streams which currently are not marked as the recording source -- should save a few CPU cycles.

File:
1 edited

Legend:

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

    r73567 r73581  
    675675        return rc;
    676676
     677    /* Input sink and no recording source set? Bail out early. */
     678    if (   pSink->enmDir == AUDMIXSINKDIR_INPUT
     679        && pSink->In.pStreamRecSource == NULL)
     680    {
     681        int rc2 = RTCritSectLeave(&pSink->CritSect);
     682        AssertRC(rc2);
     683
     684        return rc;
     685    }
     686
    677687    PAUDMIXSTREAM pStream;
    678     RTListForEach(&pSink->lstStreams, pStream, AUDMIXSTREAM, Node)
    679     {
    680         int rc2 = audioMixerStreamCtlInternal(pStream, enmCmdStream, AUDMIXSTRMCTL_FLAG_NONE);
    681         if (RT_SUCCESS(rc))
    682             rc = rc2;
    683         /* Keep going. Flag? */
     688    if (   pSink->enmDir == AUDMIXSINKDIR_INPUT
     689        && pSink->In.pStreamRecSource) /* Any recording source set? */
     690    {
     691        RTListForEach(&pSink->lstStreams, pStream, AUDMIXSTREAM, Node)
     692        {
     693            if (pStream == pSink->In.pStreamRecSource)
     694            {
     695                int rc2 = audioMixerStreamCtlInternal(pStream, enmCmdStream, AUDMIXSTRMCTL_FLAG_NONE);
     696                if (RT_SUCCESS(rc))
     697                    rc = rc2;
     698                /* Keep going. Flag? */
     699            }
     700        }
     701    }
     702    else if (pSink->enmDir == AUDMIXSINKDIR_OUTPUT)
     703    {
     704        RTListForEach(&pSink->lstStreams, pStream, AUDMIXSTREAM, Node)
     705        {
     706            int rc2 = audioMixerStreamCtlInternal(pStream, enmCmdStream, AUDMIXSTRMCTL_FLAG_NONE);
     707            if (RT_SUCCESS(rc))
     708                rc = rc2;
     709            /* Keep going. Flag? */
     710        }
    684711    }
    685712
     
    15041531        return rc;
    15051532
     1533    /* Input sink and no recording source set? Bail out early. */
     1534    if (   pSink->enmDir == AUDMIXSINKDIR_INPUT
     1535        && pSink->In.pStreamRecSource == NULL)
     1536        return rc;
     1537
    15061538    /* Number of detected disabled streams of this sink. */
    15071539    uint8_t cStreamsDisabled = 0;
     
    15101542    RTListForEachSafe(&pSink->lstStreams, pMixStream, pMixStreamNext, AUDMIXSTREAM, Node)
    15111543    {
     1544        /* Input sink and not the recording source? Skip. */
     1545        if (   pSink->enmDir == AUDMIXSINKDIR_INPUT
     1546            && pSink->In.pStreamRecSource != pMixStream)
     1547            continue;
     1548
    15121549        PPDMAUDIOSTREAM pStream   = pMixStream->pStream;
    15131550        AssertPtr(pStream);
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