VirtualBox

Changeset 67827 in vbox


Ignore:
Timestamp:
Jul 6, 2017 2:15:02 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
116759
Message:

Audio/AudioMixer.cpp: The host sets the pace.

File:
1 edited

Legend:

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

    r67693 r67827  
    876876        return 0;
    877877
    878     uint32_t cbWritable = 0;
     878    uint32_t cbWritable = UINT32_MAX;
    879879
    880880    if (    (pSink->fStatus & AUDMIXSINK_STS_RUNNING)
     
    897897            const uint32_t cbWritableStream = pMixStream->pConn->pfnStreamGetWritable(pMixStream->pConn, pMixStream->pStream);
    898898
    899             if (cbWritable < cbWritableStream)
     899            if (cbWritableStream < cbWritable)
    900900                cbWritable = cbWritableStream;
    901 
    902             break; /** @todo For now the first stream sets the pace. */
    903901        }
    904902#endif
    905903    }
     904
     905    if (cbWritable == UINT32_MAX)
     906        cbWritable = 0;
    906907
    907908    Log3Func(("[%s] cbWritable=%RU32\n", pSink->pszName, cbWritable));
     
    10531054int AudioMixerSinkRead(PAUDMIXSINK pSink, AUDMIXOP enmOp, void *pvBuf, uint32_t cbBuf, uint32_t *pcbRead)
    10541055{
     1056    AssertPtrReturn(pSink, VERR_INVALID_POINTER);
    10551057    RT_NOREF(enmOp);
    1056     AssertPtrReturn(pSink, VERR_INVALID_POINTER);
    10571058    AssertPtrReturn(pvBuf, VERR_INVALID_POINTER);
    10581059    AssertReturn(cbBuf,    VERR_INVALID_PARAMETER);
     
    15921593int AudioMixerSinkWrite(PAUDMIXSINK pSink, AUDMIXOP enmOp, const void *pvBuf, uint32_t cbBuf, uint32_t *pcbWritten)
    15931594{
     1595    AssertPtrReturn(pSink, VERR_INVALID_POINTER);
    15941596    RT_NOREF(enmOp);
    1595     AssertPtrReturn(pSink, VERR_INVALID_POINTER);
     1597    AssertPtrReturn(pvBuf, VERR_INVALID_POINTER);
     1598    AssertReturn   (cbBuf, VERR_INVALID_PARAMETER);
    15961599    /* pcbWritten is optional. */
    1597 
    1598     if (!pvBuf || !cbBuf)
    1599     {
    1600         if (pcbWritten)
    1601             *pcbWritten = 0;
    1602         return VINF_SUCCESS;
    1603     }
    16041600
    16051601    int rc = RTCritSectEnter(&pSink->CritSect);
     
    16141610    Log3Func(("[%s] enmOp=%d, cbBuf=%RU32\n", pSink->pszName, enmOp, cbBuf));
    16151611
    1616     uint32_t cbWritten = 0;
     1612    uint32_t cbWritten = UINT32_MAX;
    16171613
    16181614    PAUDMIXSTREAM pMixStream;
     
    16301626            LogFunc(("[%s] Failed writing to stream '%s': %Rrc\n", pSink->pszName, pMixStream->pszName, rc2));
    16311627
    1632         if (cbProcessed < cbBuf)
    1633             LogFunc(("[%s] Only written %RU32/%RU32 bytes for stream '%s', rc=%Rrc\n",
    1634                      pSink->pszName, cbProcessed, cbBuf, pMixStream->pszName, rc2));
     1628        Log3Func(("[%s] Written %RU32 to '%s'\n", pSink->pszName, cbProcessed, pMixStream->pszName));
    16351629
    16361630        if (cbProcessed)
     
    16381632            /* Set dirty bit. */
    16391633            pSink->fStatus |= AUDMIXSINK_STS_DIRTY;
    1640         }
    1641 
    1642         Log3Func(("\t%s: cbProcessed=%RU32\n", pMixStream->pszName, cbProcessed));
    1643 
    1644         /*
    1645          * Return the maximum bytes processed by all connected streams.
    1646          * Streams which have processed less than the current maximum have to deal with
    1647          * this themselves.
    1648          */
    1649         cbWritten = RT_MAX(cbWritten, cbProcessed);
    1650     }
     1634
     1635            /*
     1636             * Return the minimum bytes processed by all connected streams.
     1637             * The host sets the pace, so all backends have to behave accordingly.
     1638             */
     1639            if (cbWritten > cbProcessed)
     1640                cbWritten = cbProcessed;
     1641        }
     1642    }
     1643
     1644    if (cbWritten == UINT32_MAX)
     1645        cbWritten = 0;
     1646
     1647    Log3Func(("[%s] cbWritten=%RU32\n", pSink->pszName, cbWritten));
    16511648
    16521649    if (pcbWritten)
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