Changeset 71113 in vbox
- Timestamp:
- Feb 23, 2018 9:51:14 AM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 120980
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvAudio.h
r70993 r71113 154 154 uint32_t DrvAudioHlpCalcBitrate(uint8_t cBits, uint32_t uHz, uint8_t cChannels); 155 155 uint32_t DrvAudioHlpCalcBitrate(const PPDMAUDIOPCMPROPS pProps); 156 uint64_t DrvAudioHlpBytesToMs(const PPDMAUDIOPCMPROPS pProps, size_t cbBytes); 156 157 uint32_t DrvAudioHlpMsToBytes(const PPDMAUDIOPCMPROPS pProps, uint32_t uMs); 157 158 bool DrvAudioHlpPCMPropsAreEqual(const PPDMAUDIOPCMPROPS pPCMProps1, const PPDMAUDIOPCMPROPS pPCMProps2); -
trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp
r70993 r71113 1050 1050 { 1051 1051 return DrvAudioHlpCalcBitrate(pProps->cBits, pProps->uHz, pProps->cChannels); 1052 } 1053 1054 /** 1055 * Returns the time (in ms) for given byte amount and PCM properties. 1056 * 1057 * @return uint64_t Calculated time (in ms). 1058 * @param pProps PCM properties to calculate amount of bytes for. 1059 * @param cbBytes Amount of bytes to calculate time for. 1060 */ 1061 uint64_t DrvAudioHlpBytesToMs(const PPDMAUDIOPCMPROPS pProps, size_t cbBytes) 1062 { 1063 AssertPtrReturn(pProps, 0); 1064 1065 if (!cbBytes) 1066 return 0; 1067 1068 const float dbBytesPerMs = ((pProps->cBits / 8) * pProps->cChannels * pProps->uHz) / 1000; 1069 Assert(dbBytesPerMs >= 0.0f); 1070 if (!dbBytesPerMs) /* Prevent division by zero. */ 1071 return 0; 1072 1073 return cbBytes / dbBytesPerMs; 1052 1074 } 1053 1075
Note:
See TracChangeset
for help on using the changeset viewer.