Changeset 73408 in vbox
- Timestamp:
- Jul 31, 2018 11:32:55 AM (6 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/AudioMixer.cpp
r73404 r73408 657 657 if (RT_SUCCESS(rc)) 658 658 { 659 rc = RTCircBufCreate(&pMixStream->pCircBuf, DrvAudioHlpM sToBytes(100 /* ms */, &pSink->PCMProps)); /** @todo Make this configurable. */659 rc = RTCircBufCreate(&pMixStream->pCircBuf, DrvAudioHlpMilliToBytes(100 /* ms */, &pSink->PCMProps)); /** @todo Make this configurable. */ 660 660 AssertRC(rc); 661 661 } … … 931 931 #else 932 932 /* Return how much data we expect since the last write. */ 933 cbWritable = DrvAudioHlpM sToBytes(RTTimeMilliTS() - pSink->tsLastReadWrittenMs, &pSink->PCMProps);933 cbWritable = DrvAudioHlpMilliToBytes(RTTimeMilliTS() - pSink->tsLastReadWrittenMs, &pSink->PCMProps); 934 934 #endif 935 935 } -
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r73405 r73408 667 667 668 668 /* If no own pre-buffer is set, let the backend choose. */ 669 uint32_t msPreBuf = DrvAudioHlpFramesToM s(CfgHostAcq.Backend.cfPreBuf, &pCfgHost->Props);669 uint32_t msPreBuf = DrvAudioHlpFramesToMilli(CfgHostAcq.Backend.cfPreBuf, &pCfgHost->Props); 670 670 LogRel2(("Audio: Pre-buffering size of stream '%s' is %RU32ms (%RU32 frames)\n", 671 671 pHstStream->szName, msPreBuf, CfgHostAcq.Backend.cfPreBuf)); 672 672 673 673 /* Make sure the configured buffer size by the backend at least can hold the configured latency. */ 674 const uint32_t msPeriod = DrvAudioHlpFramesToM s(CfgHostAcq.Backend.cfPeriod, &pCfgHost->Props);674 const uint32_t msPeriod = DrvAudioHlpFramesToMilli(CfgHostAcq.Backend.cfPeriod, &pCfgHost->Props); 675 675 676 676 LogRel2(("Audio: Period size of stream '%s' is %RU32ms (%RU32 frames)\n", … … 685 685 } 686 686 687 uint32_t msBufferSize = DrvAudioHlpFramesToM s(CfgHostAcq.Backend.cfBufferSize, &pCfgHost->Props);687 uint32_t msBufferSize = DrvAudioHlpFramesToMilli(CfgHostAcq.Backend.cfBufferSize, &pCfgHost->Props); 688 688 689 689 LogRel2(("Audio: Buffer size of stream '%s' is %RU32ms (%RU32 frames)\n", … … 1044 1044 { 1045 1045 Log3Func(("[%s] Buffer: Last written %RU64ms, writing %RU32 frames (%RU64ms), now filled with %RU64ms -- %RU8%%\n", 1046 pHstStream->szName, tsDeltaWrittenMs, cfGstWritten, DrvAudioHlpFramesToM s(cfGstWritten, &pHstStream->Cfg.Props),1047 DrvAudioHlpFramesToM s(AudioMixBufUsed(&pHstStream->MixBuf), &pHstStream->Cfg.Props),1046 pHstStream->szName, tsDeltaWrittenMs, cfGstWritten, DrvAudioHlpFramesToMilli(cfGstWritten, &pHstStream->Cfg.Props), 1047 DrvAudioHlpFramesToMilli(AudioMixBufUsed(&pHstStream->MixBuf), &pHstStream->Cfg.Props), 1048 1048 AudioMixBufUsed(&pHstStream->MixBuf) * 100 / AudioMixBufSize(&pHstStream->MixBuf))); 1049 1049 … … 1599 1599 Log3Func(("[%s] Buffer: Last played %RU64ms, filled with %RU64ms (%RU8%%) total, " 1600 1600 "(cfLive=%RU32, fThresholdReached=%RTbool)\n", 1601 pHstStream->szName, tsDeltaPlayedCapturedMs, DrvAudioHlpFramesToM s(cfLive, &pHstStream->Cfg.Props),1601 pHstStream->szName, tsDeltaPlayedCapturedMs, DrvAudioHlpFramesToMilli(cfLive, &pHstStream->Cfg.Props), 1602 1602 uLivePercent, cfLive, pHstStream->fThresholdReached)); 1603 1603 #endif … … 1645 1645 cfToPlay = pHstStream->Cfg.Backend.cfPeriod; 1646 1646 else 1647 cfToPlay = DrvAudioHlpM sToFrames(tsDeltaPlayedCapturedMs, &pHstStream->Cfg.Props);1647 cfToPlay = DrvAudioHlpMilliToFrames(tsDeltaPlayedCapturedMs, &pHstStream->Cfg.Props); 1648 1648 1649 1649 Log3Func(("[%s] Buffer: fJustStarted=%RTbool, cfLive=%RU32, cfToPlay=%RU32\n", … … 3254 3254 */ 3255 3255 if (pDrvCfg->uPeriodMs) 3256 pCfgReq->Backend.cfPeriod = DrvAudioHlpM sToFrames(pDrvCfg->uPeriodMs, &pCfgReq->Props);3256 pCfgReq->Backend.cfPeriod = DrvAudioHlpMilliToFrames(pDrvCfg->uPeriodMs, &pCfgReq->Props); 3257 3257 else /* Set default period size. */ 3258 pCfgReq->Backend.cfPeriod = DrvAudioHlpM sToFrames(50 /* ms */, &pCfgReq->Props);3258 pCfgReq->Backend.cfPeriod = DrvAudioHlpMilliToFrames(50 /* ms */, &pCfgReq->Props); 3259 3259 3260 3260 LogRel2(("Audio: Using %s period size (%RU32ms, %RU32 frames) for stream '%s'\n", 3261 pDrvCfg->uPeriodMs ? "custom" : "default", DrvAudioHlpFramesToM s(pCfgReq->Backend.cfPeriod, &pCfgReq->Props),3261 pDrvCfg->uPeriodMs ? "custom" : "default", DrvAudioHlpFramesToMilli(pCfgReq->Backend.cfPeriod, &pCfgReq->Props), 3262 3262 pCfgReq->Backend.cfPeriod, pHstStream->szName)); 3263 3263 … … 3266 3266 */ 3267 3267 if (pDrvCfg->uBufferSizeMs) 3268 pCfgReq->Backend.cfBufferSize = DrvAudioHlpM sToFrames(pDrvCfg->uBufferSizeMs, &pCfgReq->Props);3268 pCfgReq->Backend.cfBufferSize = DrvAudioHlpMilliToFrames(pDrvCfg->uBufferSizeMs, &pCfgReq->Props); 3269 3269 else /* Set default buffer size. */ 3270 pCfgReq->Backend.cfBufferSize = DrvAudioHlpM sToFrames(200 /* ms */, &pCfgReq->Props);3270 pCfgReq->Backend.cfBufferSize = DrvAudioHlpMilliToFrames(200 /* ms */, &pCfgReq->Props); 3271 3271 3272 3272 LogRel2(("Audio: Using %s buffer size (%RU32ms, %RU32 frames) for stream '%s'\n", 3273 pDrvCfg->uBufferSizeMs ? "custom" : "default", DrvAudioHlpFramesToM s(pCfgReq->Backend.cfBufferSize, &pCfgReq->Props),3273 pDrvCfg->uBufferSizeMs ? "custom" : "default", DrvAudioHlpFramesToMilli(pCfgReq->Backend.cfBufferSize, &pCfgReq->Props), 3274 3274 pCfgReq->Backend.cfBufferSize, pHstStream->szName)); 3275 3275 … … 3281 3281 if (!pDrvCfg->uPreBufMs) /* Pre-buffering is set to disabled. */ 3282 3282 LogRel2(("Audio: Using custom pre-buffering (disabled) for stream '%s'\n", pHstStream->szName)); 3283 pCfgReq->Backend.cfPreBuf = DrvAudioHlpM sToFrames(pDrvCfg->uPreBufMs, &pCfgReq->Props);3283 pCfgReq->Backend.cfPreBuf = DrvAudioHlpMilliToFrames(pDrvCfg->uPreBufMs, &pCfgReq->Props); 3284 3284 } 3285 3285 else /* Set default pre-buffering size. */ … … 3287 3287 3288 3288 LogRel2(("Audio: Using %s pre-buffering size (%RU32ms, %RU32 frames) for stream '%s'\n", 3289 pDrvCfg->uPreBufMs != UINT32_MAX ? "custom" : "default", DrvAudioHlpFramesToM s(pCfgReq->Backend.cfPreBuf, &pCfgReq->Props),3289 pDrvCfg->uPreBufMs != UINT32_MAX ? "custom" : "default", DrvAudioHlpFramesToMilli(pCfgReq->Backend.cfPreBuf, &pCfgReq->Props), 3290 3290 pCfgReq->Backend.cfPreBuf, pHstStream->szName)); 3291 3291 … … 3296 3296 { 3297 3297 LogRel(("Audio: Error for stream '%s': Buffer size (%RU32ms) must not be smaller than the period size (%RU32ms)\n", 3298 pHstStream->szName, DrvAudioHlpFramesToM s(pCfgReq->Backend.cfBufferSize, &pCfgReq->Props),3299 DrvAudioHlpFramesToM s(pCfgReq->Backend.cfPeriod, &pCfgReq->Props)));3298 pHstStream->szName, DrvAudioHlpFramesToMilli(pCfgReq->Backend.cfBufferSize, &pCfgReq->Props), 3299 DrvAudioHlpFramesToMilli(pCfgReq->Backend.cfPeriod, &pCfgReq->Props))); 3300 3300 return VERR_INVALID_PARAMETER; 3301 3301 } … … 3307 3307 { 3308 3308 LogRel(("Audio: Error for stream '%s': Pre-buffering size (%RU32ms) must not be bigger than the buffer size (%RU32ms)\n", 3309 pHstStream->szName, DrvAudioHlpFramesToM s(pCfgReq->Backend.cfPreBuf, &pCfgReq->Props),3310 DrvAudioHlpFramesToM s(pCfgReq->Backend.cfBufferSize, &pCfgReq->Props)));3309 pHstStream->szName, DrvAudioHlpFramesToMilli(pCfgReq->Backend.cfPreBuf, &pCfgReq->Props), 3310 DrvAudioHlpFramesToMilli(pCfgReq->Backend.cfBufferSize, &pCfgReq->Props))); 3311 3311 return VERR_INVALID_PARAMETER; 3312 3312 } … … 3346 3346 { 3347 3347 LogRel2(("Audio: Custom buffer size overwritten by backend for stream '%s' (now %RU64ms, %RU32 frames)\n", 3348 pHstStream->szName, DrvAudioHlpFramesToM s(pCfgAcq->Backend.cfBufferSize, &pCfgAcq->Props), pCfgAcq->Backend.cfBufferSize));3348 pHstStream->szName, DrvAudioHlpFramesToMilli(pCfgAcq->Backend.cfBufferSize, &pCfgAcq->Props), pCfgAcq->Backend.cfBufferSize)); 3349 3349 } 3350 3350 … … 3353 3353 { 3354 3354 LogRel2(("Audio: Custom period size overwritten by backend for stream '%s' (now %RU64ms, %RU32 frames)\n", 3355 pHstStream->szName, DrvAudioHlpFramesToM s(pCfgAcq->Backend.cfPeriod, &pCfgAcq->Props), pCfgAcq->Backend.cfPeriod));3355 pHstStream->szName, DrvAudioHlpFramesToMilli(pCfgAcq->Backend.cfPeriod, &pCfgAcq->Props), pCfgAcq->Backend.cfPeriod)); 3356 3356 } 3357 3357 … … 3360 3360 { 3361 3361 LogRel2(("Audio: Custom pre-buffering size overwritten by backend for stream '%s' (now %RU64ms, %RU32 frames)\n", 3362 pHstStream->szName, DrvAudioHlpFramesToM s(pCfgAcq->Backend.cfPreBuf, &pCfgAcq->Props), pCfgAcq->Backend.cfPreBuf));3362 pHstStream->szName, DrvAudioHlpFramesToMilli(pCfgAcq->Backend.cfPreBuf, &pCfgAcq->Props), pCfgAcq->Backend.cfPreBuf)); 3363 3363 } 3364 3364 -
trunk/src/VBox/Devices/Audio/DrvAudio.h
r73407 r73408 187 187 bool DrvAudioHlpBytesIsAligned(uint32_t cbSize, const PPDMAUDIOPCMPROPS pProps); 188 188 uint32_t DrvAudioHlpBytesToFrames(uint32_t cbBytes, const PPDMAUDIOPCMPROPS pProps); 189 uint64_t DrvAudioHlpBytesToM s(uint32_t cbBytes, const PPDMAUDIOPCMPROPS pProps);189 uint64_t DrvAudioHlpBytesToMilli(uint32_t cbBytes, const PPDMAUDIOPCMPROPS pProps); 190 190 uint64_t DrvAudioHlpBytesToNano(uint32_t cbBytes, const PPDMAUDIOPCMPROPS pProps); 191 191 uint32_t DrvAudioHlpFramesToBytes(uint32_t cFrames, const PPDMAUDIOPCMPROPS pProps); 192 uint64_t DrvAudioHlpFramesToM s(uint32_t cFrames, const PPDMAUDIOPCMPROPS pProps);192 uint64_t DrvAudioHlpFramesToMilli(uint32_t cFrames, const PPDMAUDIOPCMPROPS pProps); 193 193 uint64_t DrvAudioHlpFramesToNano(uint32_t cFrames, const PPDMAUDIOPCMPROPS pProps); 194 uint32_t DrvAudioHlpM sToBytes(uint32_t uMs, const PPDMAUDIOPCMPROPS pProps);194 uint32_t DrvAudioHlpMilliToBytes(uint32_t uMs, const PPDMAUDIOPCMPROPS pProps); 195 195 uint32_t DrvAudioHlpNanoToBytes(uint32_t uNs, const PPDMAUDIOPCMPROPS pProps); 196 uint32_t DrvAudioHlpM sToFrames(uint32_t uMs, const PPDMAUDIOPCMPROPS pProps);196 uint32_t DrvAudioHlpMilliToFrames(uint32_t uMs, const PPDMAUDIOPCMPROPS pProps); 197 197 uint32_t DrvAudioHlpNanoToFrames(uint32_t uNs, const PPDMAUDIOPCMPROPS pProps); 198 198 /** @} */ -
trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp
r73407 r73408 1120 1120 * @param pProps PCM properties to calculate amount of bytes for. 1121 1121 */ 1122 uint64_t DrvAudioHlpBytesToM s(uint32_t cbBytes, const PPDMAUDIOPCMPROPS pProps)1122 uint64_t DrvAudioHlpBytesToMilli(uint32_t cbBytes, const PPDMAUDIOPCMPROPS pProps) 1123 1123 { 1124 1124 AssertPtrReturn(pProps, 0); … … 1181 1181 * @param pProps PCM properties to calculate time (in ms) for. 1182 1182 */ 1183 uint64_t DrvAudioHlpFramesToM s(uint32_t cFrames, const PPDMAUDIOPCMPROPS pProps)1183 uint64_t DrvAudioHlpFramesToMilli(uint32_t cFrames, const PPDMAUDIOPCMPROPS pProps) 1184 1184 { 1185 1185 AssertPtrReturn(pProps, 0); … … 1221 1221 * @param pProps PCM properties to calculate amount of bytes for. 1222 1222 */ 1223 uint32_t DrvAudioHlpM sToBytes(uint32_t uMs, const PPDMAUDIOPCMPROPS pProps)1223 uint32_t DrvAudioHlpMilliToBytes(uint32_t uMs, const PPDMAUDIOPCMPROPS pProps) 1224 1224 { 1225 1225 AssertPtrReturn(pProps, 0); … … 1255 1255 * @param pProps PCM properties to calculate amount of frames for. 1256 1256 */ 1257 uint32_t DrvAudioHlpM sToFrames(uint32_t uMs, const PPDMAUDIOPCMPROPS pProps)1257 uint32_t DrvAudioHlpMilliToFrames(uint32_t uMs, const PPDMAUDIOPCMPROPS pProps) 1258 1258 { 1259 1259 AssertPtrReturn(pProps, 0); … … 1263 1263 return 0; 1264 1264 1265 return DrvAudioHlpM sToBytes(uMs, pProps) / cbFrame;1265 return DrvAudioHlpMilliToBytes(uMs, pProps) / cbFrame; 1266 1266 } 1267 1267 -
trunk/src/VBox/Devices/Audio/DrvHostALSAAudio.cpp
r73380 r73408 1290 1290 req.freq = pCfgReq->Props.uHz; 1291 1291 req.nchannels = pCfgReq->Props.cChannels; 1292 req.period_size = DrvAudioHlpM sToFrames(50 /* ms */, &pCfgReq->Props); /** @todo Make this configurable. */1292 req.period_size = DrvAudioHlpMilliToFrames(50 /* ms */, &pCfgReq->Props); /** @todo Make this configurable. */ 1293 1293 req.buffer_size = req.period_size * 2; /** @todo Make this configurable. */ 1294 1294 req.threshold = req.period_size; -
trunk/src/VBox/Devices/Audio/DrvHostDSound.cpp
r73392 r73408 677 677 678 678 DSLOG(("DSound: Requested playback buffer is %RU64ms (%ld bytes)\n", 679 pCfgReq->Backend.cfBufferSize, DrvAudioHlpBytesToM s(bd.dwBufferBytes, &pCfgReq->Props), bd.dwBufferBytes));679 pCfgReq->Backend.cfBufferSize, DrvAudioHlpBytesToMilli(bd.dwBufferBytes, &pCfgReq->Props), bd.dwBufferBytes)); 680 680 681 681 hr = IDirectSound8_CreateSoundBuffer(pThis->pDS, &bd, &pDSB, NULL); … … 719 719 720 720 DSLOG(("DSound: Acquired playback buffer is %RU64ms (%ld bytes)\n", 721 DrvAudioHlpBytesToM s(bc.dwBufferBytes, &pCfgReq->Props), bc.dwBufferBytes));721 DrvAudioHlpBytesToMilli(bc.dwBufferBytes, &pCfgReq->Props), bc.dwBufferBytes)); 722 722 723 723 DSLOG(("DSound: Acquired playback format:\n" … … 1361 1361 1362 1362 DSLOG(("DSound: Requested capture buffer is %RU64ms (%ld bytes)\n", 1363 pCfgReq->Backend.cfBufferSize, DrvAudioHlpBytesToM s(bd.dwBufferBytes, &pCfgReq->Props), bd.dwBufferBytes));1363 pCfgReq->Backend.cfBufferSize, DrvAudioHlpBytesToMilli(bd.dwBufferBytes, &pCfgReq->Props), bd.dwBufferBytes)); 1364 1364 1365 1365 LPDIRECTSOUNDCAPTUREBUFFER pDSCB; … … 1414 1414 1415 1415 DSLOG(("DSound: Acquired capture buffer is %RU64ms (%ld bytes)\n", 1416 DrvAudioHlpBytesToM s(bc.dwBufferBytes, &pCfgReq->Props), bc.dwBufferBytes));1416 DrvAudioHlpBytesToMilli(bc.dwBufferBytes, &pCfgReq->Props), bc.dwBufferBytes)); 1417 1417 1418 1418 DSLOG(("DSound: Capture format:\n" … … 2297 2297 { 2298 2298 const uint64_t diffLastTransferredMs = RTTimeMilliTS() - pStreamDS->Out.tsLastTransferred; 2299 const uint64_t uLastTranserredChunkMs = DrvAudioHlpBytesToM s(pStreamDS->Out.cbLastTransferred, &pStreamDS->Cfg.Props);2299 const uint64_t uLastTranserredChunkMs = DrvAudioHlpBytesToMilli(pStreamDS->Out.cbLastTransferred, &pStreamDS->Cfg.Props); 2300 2300 if ( uLastTranserredChunkMs 2301 2301 && diffLastTransferredMs < uLastTranserredChunkMs) -
trunk/src/VBox/Devices/Audio/HDAStream.cpp
r73381 r73408 207 207 208 208 /* By default we allocate an internal buffer of 100ms. */ 209 rc = RTCircBufCreate(&pStream->State.pCircBuf, DrvAudioHlpM sToBytes(100 /* ms */, &pCfg->Props)); /** @todo Make this configurable. */209 rc = RTCircBufCreate(&pStream->State.pCircBuf, DrvAudioHlpMilliToBytes(100 /* ms */, &pCfg->Props)); /** @todo Make this configurable. */ 210 210 AssertRCReturn(rc, rc); 211 211 -
trunk/src/VBox/Main/src-client/DrvAudioVRDE.cpp
r73380 r73408 91 91 92 92 /* According to the VRDP docs, the VRDP server stores audio in 200ms chunks. */ 93 const uint32_t cfVRDPServer = DrvAudioHlpM sToFrames(200 /* ms */, &pCfgAcq->Props);93 const uint32_t cfVRDPServer = DrvAudioHlpMilliToFrames(200 /* ms */, &pCfgAcq->Props); 94 94 95 95 int rc = RTCircBufCreate(&pStreamVRDE->In.pCircBuf, DrvAudioHlpFramesToBytes(cfVRDPServer, &pCfgAcq->Props)); … … 136 136 137 137 /* According to the VRDP docs, the VRDP server stores audio in 200ms chunks. */ 138 pCfgAcq->Backend.cfPeriod = DrvAudioHlpM sToFrames(10 /* ms */, &pCfgAcq->Props);139 pCfgAcq->Backend.cfBufferSize = DrvAudioHlpM sToFrames(200 /* ms */, &pCfgAcq->Props);138 pCfgAcq->Backend.cfPeriod = DrvAudioHlpMilliToFrames(10 /* ms */, &pCfgAcq->Props); 139 pCfgAcq->Backend.cfBufferSize = DrvAudioHlpMilliToFrames(200 /* ms */, &pCfgAcq->Props); 140 140 pCfgAcq->Backend.cfPreBuf = pCfgAcq->Backend.cfBufferSize; 141 141 } … … 170 170 { 171 171 rc = pDrv->pConsoleVRDPServer->SendAudioInputBegin(NULL, pStreamVRDE, 172 DrvAudioHlpM sToFrames(200 /* ms */, &pStreamVRDE->pCfg->Props),172 DrvAudioHlpMilliToFrames(200 /* ms */, &pStreamVRDE->pCfg->Props), 173 173 pStreamVRDE->pCfg->Props.uHz, pStreamVRDE->pCfg->Props.cChannels, 174 174 pStreamVRDE->pCfg->Props.cBits); -
trunk/src/VBox/Main/src-client/DrvAudioVideoRec.cpp
r73380 r73408 524 524 525 525 /* Every Opus frame marks a period for now. Optimize this later. */ 526 pCfgAcq->Backend.cfPeriod = DrvAudioHlpM sToFrames(pSink->Codec.Opus.msFrame, &pCfgAcq->Props); /** @todo Make this configurable. */526 pCfgAcq->Backend.cfPeriod = DrvAudioHlpMilliToFrames(pSink->Codec.Opus.msFrame, &pCfgAcq->Props); /** @todo Make this configurable. */ 527 527 } 528 528 }
Note:
See TracChangeset
for help on using the changeset viewer.