VirtualBox

Ignore:
Timestamp:
May 31, 2016 8:43:19 AM (9 years ago)
Author:
vboxsync
Message:

Audio: Update.

File:
1 edited

Legend:

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

    r61178 r61320  
    405405    }
    406406
     407    RTStrPrintf(CfgSink.szName, sizeof(CfgSink.szName), "%s", pCfg->szName);
     408
    407409    /* Always use the sink's PCM audio format as the host side when creating a stream for it. */
    408410    PPDMAUDIOSTREAM pStream;
     
    583585    /** @todo Handle mixing operation enmOp! */
    584586
     587    AssertMsg(pSink->enmDir == AUDMIXSINKDIR_INPUT,
     588              ("Can't read from a sink which is not an input sink\n"));
     589
    585590    uint8_t *pvMixBuf = (uint8_t *)RTMemAlloc(cbBuf);
    586591    if (!pvMixBuf)
     
    797802    int rc = VINF_SUCCESS;
    798803
     804    Log3Func(("[%s]\n", pSink->pszName));
     805
    799806    PAUDMIXSTREAM pMixStream;
    800807    RTListForEach(&pSink->lstStreams, pMixStream, AUDMIXSTREAM, Node)
     
    803810        AssertPtr(pStream);
    804811
    805         uint32_t cSamplesAvail;
    806         uint32_t cSamplesProcessed = 0;
    807 
    808         rc = pMixStream->pConn->pfnStreamGetData(pMixStream->pConn, pStream, &cSamplesAvail);
    809         if (   RT_SUCCESS(rc)
    810             && cSamplesAvail)
     812        uint32_t cPlayed = 0;
     813
     814        rc = pMixStream->pConn->pfnStreamIterate(pMixStream->pConn, pStream);
     815        if (RT_SUCCESS(rc))
    811816        {
    812817            if (pStream->enmDir == PDMAUDIODIR_IN)
    813818            {
    814819                /** @todo Implement this! */
    815             //  rc = pStream->pConn->pfnCapture(pStream->pConn, NULL /* pcSamplesCaptured */);
     820#if 0
     821                rc = pStream->pConn->pfnStreamCapture(pStream->pConn, NULL /* pcSamplesCaptured */);
     822#endif
    816823            }
    817824            else
    818825            {
    819                 rc = pMixStream->pConn->pfnStreamPlay(pMixStream->pConn, pStream, &cSamplesProcessed);
     826                rc = pMixStream->pConn->pfnStreamPlay(pMixStream->pConn, pMixStream->pStream, &cPlayed);
     827                if (RT_FAILURE(rc))
     828                    LogFlowFunc(("%s: Failed playing stream '%s': %Rrc\n", pSink->pszName, pMixStream->pStream->szName, rc));
    820829            }
    821 
    822             pSink->fFlags |= AUDMIXSINK_FLAG_DIRTY;
    823830        }
    824         else if (!cSamplesAvail)
    825             pSink->fFlags &= ~AUDMIXSINK_FLAG_DIRTY;
    826 
    827         Log3Func(("[%s]: fFlags=0x%x, %RU32/%RU32 samples, rc=%Rrc\n",
    828                   pSink->pszName, pSink->fFlags, cSamplesProcessed, cSamplesAvail, rc));
     831
     832        Log3Func(("\t%s: cPlayed=%RU32, rc=%Rrc\n", pMixStream->pStream->szName, cPlayed, rc));
    829833    }
    830834
     
    884888    }
    885889
    886     uint32_t cbProcessed = 0;
     890    AssertMsg(pSink->enmDir == AUDMIXSINKDIR_OUTPUT,
     891              ("Can't write to a sink which is not an output sink\n"));
     892
     893    LogFlowFunc(("%s: enmOp=%ld, cbBuf=%RU32\n", pSink->pszName, enmOp, cbBuf));
     894
     895    uint32_t cPlayed;
     896    uint32_t cbProcessed;
    887897
    888898    PAUDMIXSTREAM pMixStream;
     
    893903
    894904        int rc2 = pMixStream->pConn->pfnStreamWrite(pMixStream->pConn, pMixStream->pStream, pvBuf, cbBuf, &cbProcessed);
    895         if (   RT_FAILURE(rc2)
    896             || cbProcessed < cbBuf)
    897         {
    898             LogFlowFunc(("rc=%Rrc, cbBuf=%RU32, cbProcessed=%RU32\n", rc2, cbBuf, cbProcessed));
    899         }
    900     }
     905        if (RT_FAILURE(rc2))
     906            LogFlowFunc(("%s: Failed writing to stream '%s': %Rrc\n", pSink->pszName, pMixStream->pStream->szName, rc2));
     907
     908        if (cbProcessed < cbBuf)
     909            LogFlowFunc(("%s: Only written %RU32/%RU32 bytes\n", pSink->pszName, pMixStream->pStream->szName, cbProcessed, cbBuf));
     910    }
     911
     912    /* Set dirty bit. */
     913    pSink->fFlags |= AUDMIXSINK_FLAG_DIRTY;
    901914
    902915    if (pcbWritten)
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