VirtualBox

Changeset 88486 in vbox for trunk/include


Ignore:
Timestamp:
Apr 13, 2021 9:36:47 AM (4 years ago)
Author:
vboxsync
Message:

DrvAudioHostPulseAudio: Mostly done cleaning up stream creation. bugref:9890

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/pdmaudioinline.h

    r88452 r88486  
    276276    AssertPtrReturn(pCfg, false);
    277277    return PDMAudioPropsAreEqual(pProps, &pCfg->Props);
     278}
     279
     280/**
     281 * Checks whether two stream configuration matches.
     282 *
     283 * @returns @c true if equal, @c false if not.
     284 * @param   pCfg1   The first stream configuration.
     285 * @param   pCfg2   The second stream configuration.
     286 */
     287DECLINLINE(bool) PDMAudioStrmCfgEquals(PCPDMAUDIOSTREAMCFG pCfg1, PCPDMAUDIOSTREAMCFG pCfg2)
     288{
     289    if (!pCfg1 || !pCfg2)
     290        return false;
     291    if (pCfg1 == pCfg2)
     292        return pCfg1 != NULL;
     293    if (PDMAudioPropsAreEqual(&pCfg1->Props, &pCfg2->Props))
     294        return pCfg1->enmDir    == pCfg2->enmDir
     295            && pCfg1->u.enmDst  == pCfg2->u.enmDst
     296            && pCfg1->enmLayout == pCfg2->enmLayout
     297            && pCfg1->Device.cMsSchedulingHint == pCfg2->Device.cMsSchedulingHint
     298            && pCfg1->Backend.cFramesPeriod == pCfg2->Backend.cFramesPeriod
     299            && pCfg1->Backend.cFramesBufferSize == pCfg2->Backend.cFramesBufferSize
     300            && pCfg1->Backend.cFramesPreBuffering == pCfg2->Backend.cFramesPreBuffering
     301            && strcmp(pCfg1->szName, pCfg2->szName) == 0;
     302    return false;
    278303}
    279304
     
    818843
    819844/**
     845 * Converts frames to microseconds.
     846 *
     847 * @returns microseconds.
     848 * @param   pProps      The PCM properties to use.
     849 * @param   cFrames     Number of audio frames to convert.
     850 * @note    No rounding here, result is floored.
     851 */
     852DECLINLINE(uint64_t) PDMAudioPropsFramesToMicro(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames)
     853{
     854    AssertPtrReturn(pProps, 0);
     855
     856    /* Check input to prevent division by chainsaw: */
     857    uint32_t const uHz = pProps->uHz;
     858    if (uHz)
     859        return ASMMultU32ByU32DivByU32(cFrames, RT_US_1SEC, uHz);
     860    return 0;
     861}
     862
     863/**
    820864 * Converts frames to nanoseconds.
    821865 *
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