VirtualBox

Changeset 88007 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Mar 8, 2021 12:12:40 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
143130
Message:

Audio: Switched parameters for DrvAudioHlpBytesToFrames. bugref:9890

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

Legend:

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

    r88006 r88007  
    195195/** @name Audio calculation helper methods.
    196196 * @{ */
     197uint32_t DrvAudioHlpCalcBitrate(uint8_t cBits, uint32_t uHz, uint8_t cChannels);
     198/** @} */
     199
     200/** @name Audio PCM properties helper methods.
     201 * @{ */
    197202void     DrvAudioHlpClearBuf(PCPDMAUDIOPCMPROPS pPCMProps, void *pvBuf, size_t cbBuf, uint32_t cFrames);
    198 uint32_t DrvAudioHlpCalcBitrate(uint8_t cBits, uint32_t uHz, uint8_t cChannels);
    199203uint32_t DrvAudioHlpGetBitrate(PCPDMAUDIOPCMPROPS pProps);
    200204uint32_t DrvAudioHlpFloorBytesToFrame(PCPDMAUDIOPCMPROPS pProps, uint32_t cb);
    201205bool     DrvAudioHlpIsBytesAligned(PCPDMAUDIOPCMPROPS pProps, uint32_t cb);
    202 uint32_t DrvAudioHlpBytesToFrames(uint32_t cbBytes, PCPDMAUDIOPCMPROPS pProps);
     206uint32_t DrvAudioHlpBytesToFrames(PCPDMAUDIOPCMPROPS pProps, uint32_t cb);
    203207uint64_t DrvAudioHlpBytesToMilli(PCPDMAUDIOPCMPROPS pProps, uint32_t cb);
    204208uint64_t DrvAudioHlpBytesToMicro(PCPDMAUDIOPCMPROPS pProps, uint32_t cb);
     
    211215uint32_t DrvAudioHlpMilliToFrames(PCPDMAUDIOPCMPROPS pProps, uint64_t cMs);
    212216uint32_t DrvAudioHlpNanoToFrames(PCPDMAUDIOPCMPROPS pProps, uint64_t cNs);
    213 /** @}  */
    214 
    215 /** @name Audio PCM properties helper methods.
    216  * @{ */
    217 bool DrvAudioHlpPCMPropsAreEqual(PCPDMAUDIOPCMPROPS pPCMProps1, PCPDMAUDIOPCMPROPS pPCMProps2);
    218 bool DrvAudioHlpPCMPropsAreEqual(PCPDMAUDIOPCMPROPS pPCMProps, PCPDMAUDIOSTREAMCFG pCfg);
    219 bool DrvAudioHlpPCMPropsAreValid(PCPDMAUDIOPCMPROPS pProps);
     217
     218bool     DrvAudioHlpPCMPropsAreEqual(PCPDMAUDIOPCMPROPS pPCMProps1, PCPDMAUDIOPCMPROPS pPCMProps2);
     219bool     DrvAudioHlpPCMPropsAreEqual(PCPDMAUDIOPCMPROPS pPCMProps, PCPDMAUDIOSTREAMCFG pCfg);
     220bool     DrvAudioHlpPCMPropsAreValid(PCPDMAUDIOPCMPROPS pProps);
    220221uint32_t DrvAudioHlpPCMPropsBytesPerFrame(PCPDMAUDIOPCMPROPS pProps);
    221 void DrvAudioHlpPCMPropsPrint(PCPDMAUDIOPCMPROPS pProps);
    222 int DrvAudioHlpPCMPropsToStreamCfg(PCPDMAUDIOPCMPROPS pPCMProps, PPDMAUDIOSTREAMCFG pCfg);
     222void     DrvAudioHlpPCMPropsPrint(PCPDMAUDIOPCMPROPS pProps);
     223int      DrvAudioHlpPCMPropsToStreamCfg(PCPDMAUDIOPCMPROPS pPCMProps, PPDMAUDIOSTREAMCFG pCfg);
    223224/** @}  */
    224225
  • trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp

    r88006 r88007  
    11981198
    11991199/**
    1200  * Returns the number of audio frames for a given amount of bytes.
    1201  *
    1202  * @return Calculated audio frames for given bytes.
    1203  * @param  cbBytes              Bytes to convert to audio frames.
    1204  * @param  pProps               PCM properties to calulate frames for.
    1205  */
    1206 uint32_t DrvAudioHlpBytesToFrames(uint32_t cbBytes, PCPDMAUDIOPCMPROPS pProps)
     1200 * Converts bytes to frames (rounding down of course).
     1201 *
     1202 * @returns Number of frames.
     1203 * @param   pProps      PCM properties to use.
     1204 * @param   cb          The number of bytes to convert.
     1205 */
     1206uint32_t DrvAudioHlpBytesToFrames(PCPDMAUDIOPCMPROPS pProps, uint32_t cb)
    12071207{
    12081208    AssertPtrReturn(pProps, 0);
    1209 
    1210     return PDMAUDIOPCMPROPS_B2F(pProps, cbBytes);
     1209    return PDMAUDIOPCMPROPS_B2F(pProps, cb);
    12111210}
    12121211
  • trunk/src/VBox/Devices/Audio/testcase/tstAudioMixBuffer.cpp

    r88006 r88007  
    101101                      ("cb=%RU32\n", u32));
    102102
    103     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpBytesToFrames(4, &s_Cfg441StereoS16)) == 1,
    104                       ("cb=%RU32\n", u32));
    105     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpBytesToFrames(4, &s_Cfg441StereoU16)) == 1,
    106                       ("cb=%RU32\n", u32));
    107     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpBytesToFrames(8, &s_Cfg441StereoU32)) == 1,
    108                       ("cb=%RU32\n", u32));
     103    RTTESTI_CHECK_MSG((u32 = DrvAudioHlpBytesToFrames(&s_Cfg441StereoS16, 4)) == 1, ("cb=%RU32\n", u32));
     104    RTTESTI_CHECK_MSG((u32 = DrvAudioHlpBytesToFrames(&s_Cfg441StereoU16, 4)) == 1, ("cb=%RU32\n", u32));
     105    RTTESTI_CHECK_MSG((u32 = DrvAudioHlpBytesToFrames(&s_Cfg441StereoU32, 8)) == 1, ("cb=%RU32\n", u32));
    109106
    110107    uint64_t u64;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette