VirtualBox

Changeset 88003 in vbox


Ignore:
Timestamp:
Mar 8, 2021 11:46:08 AM (4 years ago)
Author:
vboxsync
Message:

Audio: DrvAudioHlpCalcBitrate -> DrvAudioHlpGetBitrate. bugref:9098

Location:
trunk/src/VBox/Devices/Audio
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DrvAudio.h

    r88002 r88003  
    195195/** @name Audio calculation helper methods.
    196196 * @{ */
    197 void DrvAudioHlpClearBuf(PCPDMAUDIOPCMPROPS pPCMProps, void *pvBuf, size_t cbBuf, uint32_t cFrames);
     197void     DrvAudioHlpClearBuf(PCPDMAUDIOPCMPROPS pPCMProps, void *pvBuf, size_t cbBuf, uint32_t cFrames);
    198198uint32_t DrvAudioHlpCalcBitrate(uint8_t cBits, uint32_t uHz, uint8_t cChannels);
    199 uint32_t DrvAudioHlpCalcBitrate(PCPDMAUDIOPCMPROPS pProps);
     199uint32_t DrvAudioHlpGetBitrate(PCPDMAUDIOPCMPROPS pProps);
    200200uint32_t DrvAudioHlpBytesAlign(uint32_t cbSize, PCPDMAUDIOPCMPROPS pProps);
    201201bool     DrvAudioHlpBytesIsAligned(uint32_t cbSize, PCPDMAUDIOPCMPROPS pProps);
  • trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp

    r88002 r88003  
    11351135 * Divide the result by 8 to get the byte rate.
    11361136 *
    1137  * @returns The calculated bit rate.
     1137 * @returns Bitrate.
    11381138 * @param   cBits               Number of bits per sample.
    11391139 * @param   uHz                 Hz (Hertz) rate.
     
    11421142uint32_t DrvAudioHlpCalcBitrate(uint8_t cBits, uint32_t uHz, uint8_t cChannels)
    11431143{
    1144     return (cBits * uHz * cChannels);
    1145 }
    1146 
    1147 /**
    1148  * Calculates the audio bit rate out of a given audio stream configuration.
     1144    return cBits * uHz * cChannels;
     1145}
     1146
     1147/**
     1148 * Gets the bitrate.
    11491149 *
    11501150 * Divide the result by 8 to get the byte rate.
    11511151 *
    1152  * @returns The calculated bit rate.
     1152 * @returns Bit rate.
    11531153 * @param   pProps              PCM properties to calculate bitrate for.
    1154  *
    1155  * @remark
    1156  */
    1157 uint32_t DrvAudioHlpCalcBitrate(PCPDMAUDIOPCMPROPS pProps)
     1154 */
     1155uint32_t DrvAudioHlpGetBitrate(PCPDMAUDIOPCMPROPS pProps)
    11581156{
    11591157    return DrvAudioHlpCalcBitrate(pProps->cbSample * 8, pProps->uHz, pProps->cChannels);
     
    17161714            pData->Hdr.u16NumChannels   = pProps->cChannels;
    17171715            pData->Hdr.u32SampleRate    = pProps->uHz;
    1718             pData->Hdr.u32ByteRate      = DrvAudioHlpCalcBitrate(pProps) / 8;
     1716            pData->Hdr.u32ByteRate      = DrvAudioHlpGetBitrate(pProps) / 8;
    17191717            pData->Hdr.u16BlockAlign    = pProps->cChannels * pProps->cbSample;
    17201718            pData->Hdr.u16BitsPerSample = pProps->cbSample * 8;
  • trunk/src/VBox/Devices/Audio/testcase/tstAudioMixBuffer.cpp

    r88002 r88003  
    6161        /* a_fSwapEndian: */    false
    6262    );
     63
     64    RTTESTI_CHECK(DrvAudioHlpGetBitrate(&s_Cfg441StereoS16) == 44100*4*8);
     65    RTTESTI_CHECK(DrvAudioHlpGetBitrate(&s_Cfg441StereoU32) == 44100*8*8);
    6366
    6467    RTTESTI_CHECK_MSG(PDMAUDIOPCMPROPS_F2B(&s_Cfg441StereoS16, 1) == 4,
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