VirtualBox

Changeset 57827 in vbox for trunk/src/VBox/Devices/Audio


Ignore:
Timestamp:
Sep 18, 2015 12:53:31 PM (9 years ago)
Author:
vboxsync
Message:

Devices/Audio: actually consume samples in DrvHostNullAudio

File:
1 edited

Legend:

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

    r57451 r57827  
    5757    PDMAUDIOHSTSTRMOUT hw;
    5858    uint64_t u64TicksLast;
     59    uint64_t csPlayBuffer;
     60    uint8_t *pu8PlayBuffer;
    5961} NULLAUDIOSTREAMOUT;
    6062
     
    132134        NULLAUDIOSTREAMOUT *pNullStrmOut = (NULLAUDIOSTREAMOUT *)pHstStrmOut;
    133135        pNullStrmOut->u64TicksLast = 0;
    134         if (pcSamples)
    135             *pcSamples = _1K;
     136        pNullStrmOut->csPlayBuffer = _1K;
     137        pNullStrmOut->pu8PlayBuffer = (uint8_t *)RTMemAlloc(_1K << pHstStrmOut->Props.cShift);
     138        if (pNullStrmOut->pu8PlayBuffer)
     139        {
     140            if (pcSamples)
     141                *pcSamples = pNullStrmOut->csPlayBuffer;
     142        }
     143        else
     144        {
     145            rc = VERR_NO_MEMORY;
     146        }
    136147    }
    137148
     
    170181        cSamplesPlayed = csLive;
    171182
    172     AudioMixBufFinish(&pHstStrmOut->MixBuf, cSamplesPlayed);
     183    cSamplesPlayed = RT_MIN(cSamplesPlayed, pNullStrmOut->csPlayBuffer);
     184
     185    uint32_t csRead = 0;
     186    AudioMixBufReadCirc(&pHstStrmOut->MixBuf, pNullStrmOut->pu8PlayBuffer, cSamplesPlayed << pHstStrmOut->Props.cShift, &csRead);
     187    AudioMixBufFinish(&pHstStrmOut->MixBuf, csRead);
    173188
    174189    if (pcSamplesPlayed)
    175         *pcSamplesPlayed = cSamplesPlayed;
     190        *pcSamplesPlayed = csRead;
    176191
    177192    return VINF_SUCCESS;
     
    215230static DECLCALLBACK(int) drvHostNullAudioFiniOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut)
    216231{
     232    NULLAUDIOSTREAMOUT *pNullStrmOut = (NULLAUDIOSTREAMOUT *)pHstStrmOut;
     233    RTMemFree(pNullStrmOut->pu8PlayBuffer);
    217234    return VINF_SUCCESS;
    218235}
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