VirtualBox

Changeset 61187 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 25, 2016 8:42:18 AM (9 years ago)
Author:
vboxsync
Message:

Audio/AudioMixBuffer.cpp: Fixes for testcase.

File:
1 edited

Legend:

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

    r61157 r61187  
    17411741    }
    17421742
     1743    PPDMAUDIOMIXBUF pParent = pMixBuf->pParent;
     1744
    17431745    AUDMIXBUF_LOG(("%s: enmFmt=%ld, pvBuf=%p, cbBuf=%RU32 (%RU32 samples)\n",
    17441746                   pMixBuf->pszName, enmFmt, pvBuf, cbBuf, AUDIOMIXBUF_B2S(pMixBuf, cbBuf)));
     1747
     1748    if (   pParent
     1749        && pParent->cSamples <= pMixBuf->cMixed)
     1750    {
     1751        if (pcWritten)
     1752            *pcWritten = 0;
     1753
     1754        AUDMIXBUF_LOG(("%s: Parent buffer %s is full\n",
     1755                       pMixBuf->pszName, pMixBuf->pParent->pszName));
     1756
     1757        return VINF_BUFFER_OVERFLOW;
     1758    }
    17451759
    17461760    PPDMAUDMIXBUF_FN_CONVFROM pCnvFrm;
     
    17931807#endif
    17941808
    1795     uint32_t cWritten;
     1809    uint32_t cWrittenTotal = 0;
    17961810
    17971811    PDMAUDMIXBUF_CONVOPTS convOpts;
     
    18021816    {
    18031817        convOpts.cSamples = cLenDst1;
    1804         cWritten = pCnvFrm(pSamplesDst1, pvBuf, cbBuf, &convOpts);
    1805         Assert(cWritten == cLenDst1);
     1818        cWrittenTotal = pCnvFrm(pSamplesDst1, pvBuf, cbBuf, &convOpts);
     1819        Assert(cWrittenTotal == cLenDst1);
    18061820
    18071821#ifdef AUDIOMIXBUF_DEBUG_DUMP_PCM_DATA
    1808         RTFileWrite(fh, pSamplesDst1, cWritten * sizeof(PDMAUDIOSAMPLE), NULL);
     1822        RTFileWrite(fh, pvBuf, cbBuf, NULL);
    18091823#endif
    18101824    }
     
    18171831
    18181832        convOpts.cSamples = cLenDst2;
    1819         cWritten = pCnvFrm(pSamplesDst2, (uint8_t *)pvBuf + AUDIOMIXBUF_S2B(pMixBuf, cLenDst1), cbBuf, &convOpts);
    1820         Assert(cWritten == cLenDst2);
     1833        cWrittenTotal += pCnvFrm(pSamplesDst2, (uint8_t *)pvBuf + AUDIOMIXBUF_S2B(pMixBuf, cLenDst1), cbBuf, &convOpts);
     1834        Assert(cWrittenTotal == (cLenDst1 + cLenDst2));
    18211835
    18221836#ifdef AUDIOMIXBUF_DEBUG_DUMP_PCM_DATA
    1823         RTFileWrite(fh, pSamplesDst2, cWritten * sizeof(PDMAUDIOSAMPLE), NULL);
     1837        RTFileWrite(fh, (uint8_t *)pvBuf + AUDIOMIXBUF_S2B(pMixBuf, cLenDst1), cbBuf, NULL);
    18241838#endif
    18251839    }
     
    18321846    {
    18331847        pMixBuf->offReadWrite = cOffWrite % pMixBuf->cSamples;
     1848        pMixBuf->cProcessed   = RT_MIN(pMixBuf->cProcessed + cLenDst1 + cLenDst2,
     1849                                       pMixBuf->cSamples /* Max */);
    18341850
    18351851        uint32_t cProcessedTotal = pMixBuf->cProcessed + cLenDst1 + cLenDst2;
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