Changeset 76679 in vbox
- Timestamp:
- Jan 7, 2019 1:50:26 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp
r76553 r76679 1320 1320 * Returns the amount of bytes for a given time (in ms) and PCM properties. 1321 1321 * 1322 * Note: The result will return an amount of bytes which is aligned to the audio frame size. 1323 * 1322 1324 * @return uint32_t Calculated amount of bytes. 1323 1325 * @param uMs Time (in ms) to calculate amount of bytes for. … … 1331 1333 return 0; 1332 1334 1333 return ((double)drvAudioHlpBytesPerSec(pProps) / (double)RT_MS_1SEC) * uMs; 1335 const uint32_t uBytesPerFrame = DrvAudioHlpPCMPropsBytesPerFrame(pProps); 1336 1337 uint32_t uBytes = ((double)drvAudioHlpBytesPerSec(pProps) / (double)RT_MS_1SEC) * uMs; 1338 if (uBytes % uBytesPerFrame) /* Any remainder? Make the returned bytes an integral number to the given frames. */ 1339 uBytes = uBytes + (uBytesPerFrame - uBytes % uBytesPerFrame); 1340 1341 Assert(uBytes % uBytesPerFrame == 0); /* Paranoia. */ 1342 1343 return uBytes; 1334 1344 } 1335 1345 1336 1346 /** 1337 1347 * Returns the amount of bytes for a given time (in ns) and PCM properties. 1348 * 1349 * Note: The result will return an amount of bytes which is aligned to the audio frame size. 1338 1350 * 1339 1351 * @return uint32_t Calculated amount of bytes. … … 1348 1360 return 0; 1349 1361 1350 return ((double)drvAudioHlpBytesPerSec(pProps) / (double)RT_NS_1SEC) * uNs; 1362 const uint32_t uBytesPerFrame = DrvAudioHlpPCMPropsBytesPerFrame(pProps); 1363 1364 uint32_t uBytes = ((double)drvAudioHlpBytesPerSec(pProps) / (double)RT_NS_1SEC) * uNs; 1365 if (uBytes % uBytesPerFrame) /* Any remainder? Make the returned bytes an integral number to the given frames. */ 1366 uBytes = uBytes + (uBytesPerFrame - uBytes % uBytesPerFrame); 1367 1368 Assert(uBytes % uBytesPerFrame == 0); /* Paranoia. */ 1369 1370 return uBytes; 1351 1371 } 1352 1372
Note:
See TracChangeset
for help on using the changeset viewer.