Changeset 87993 in vbox
- Timestamp:
- Mar 7, 2021 3:19:13 PM (4 years ago)
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r87991 r87993 592 592 if (CfgHostAcq.Backend.cFramesBufferSize != pCfgHost->Backend.cFramesBufferSize) 593 593 LogRel2(("Audio: Backend changed buffer size from %RU64ms (%RU32 frames) to %RU64ms (%RU32 frames)\n", 594 DrvAudioHlpFramesToMilli( pCfgHost->Backend.cFramesBufferSize, &pCfgHost->Props), pCfgHost->Backend.cFramesBufferSize,595 DrvAudioHlpFramesToMilli( CfgHostAcq.Backend.cFramesBufferSize, &CfgHostAcq.Props), CfgHostAcq.Backend.cFramesBufferSize));594 DrvAudioHlpFramesToMilli(&pCfgHost->Props, pCfgHost->Backend.cFramesBufferSize), pCfgHost->Backend.cFramesBufferSize, 595 DrvAudioHlpFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesBufferSize), CfgHostAcq.Backend.cFramesBufferSize)); 596 596 597 597 if (CfgHostAcq.Backend.cFramesPeriod != pCfgHost->Backend.cFramesPeriod) 598 598 LogRel2(("Audio: Backend changed period size from %RU64ms (%RU32 frames) to %RU64ms (%RU32 frames)\n", 599 DrvAudioHlpFramesToMilli( pCfgHost->Backend.cFramesPeriod, &pCfgHost->Props), pCfgHost->Backend.cFramesPeriod,600 DrvAudioHlpFramesToMilli( CfgHostAcq.Backend.cFramesPeriod, &CfgHostAcq.Props), CfgHostAcq.Backend.cFramesPeriod));599 DrvAudioHlpFramesToMilli(&pCfgHost->Props, pCfgHost->Backend.cFramesPeriod), pCfgHost->Backend.cFramesPeriod, 600 DrvAudioHlpFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesPeriod), CfgHostAcq.Backend.cFramesPeriod)); 601 601 602 602 if (CfgHostAcq.Backend.cFramesPreBuffering != pCfgHost->Backend.cFramesPreBuffering) 603 603 LogRel2(("Audio: Backend changed pre-buffering size from %RU64ms (%RU32 frames) to %RU64ms (%RU32 frames)\n", 604 DrvAudioHlpFramesToMilli( pCfgHost->Backend.cFramesPreBuffering, &pCfgHost->Props), pCfgHost->Backend.cFramesPreBuffering,605 DrvAudioHlpFramesToMilli( CfgHostAcq.Backend.cFramesPreBuffering, &CfgHostAcq.Props), CfgHostAcq.Backend.cFramesPreBuffering));604 DrvAudioHlpFramesToMilli(&pCfgHost->Props, pCfgHost->Backend.cFramesPreBuffering), pCfgHost->Backend.cFramesPreBuffering, 605 DrvAudioHlpFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesPreBuffering), CfgHostAcq.Backend.cFramesPreBuffering)); 606 606 /* 607 607 * Configure host buffers. … … 625 625 } 626 626 627 uint64_t msBufferSize = DrvAudioHlpFramesToMilli( CfgHostAcq.Backend.cFramesBufferSize, &CfgHostAcq.Props);627 uint64_t msBufferSize = DrvAudioHlpFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesBufferSize); 628 628 629 629 LogRel2(("Audio: Buffer size of stream '%s' is %RU64ms (%RU32 frames)\n", … … 631 631 632 632 /* If no own pre-buffer is set, let the backend choose. */ 633 uint64_t msPreBuf = DrvAudioHlpFramesToMilli( CfgHostAcq.Backend.cFramesPreBuffering, &CfgHostAcq.Props);633 uint64_t msPreBuf = DrvAudioHlpFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesPreBuffering); 634 634 LogRel2(("Audio: Pre-buffering size of stream '%s' is %RU64ms (%RU32 frames)\n", 635 635 pStream->szName, msPreBuf, CfgHostAcq.Backend.cFramesPreBuffering)); 636 636 637 637 /* Make sure the configured buffer size by the backend at least can hold the configured latency. */ 638 const uint32_t msPeriod = DrvAudioHlpFramesToMilli( CfgHostAcq.Backend.cFramesPeriod, &CfgHostAcq.Props);638 const uint32_t msPeriod = DrvAudioHlpFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesPeriod); 639 639 640 640 LogRel2(("Audio: Period size of stream '%s' is %RU64ms (%RU32 frames)\n", … … 1029 1029 1030 1030 Log3Func(("[%s] Writing %RU32 frames (%RU64ms)\n", 1031 pStream->szName, cfGstWritten, DrvAudioHlpFramesToMilli( cfGstWritten, &pStream->Guest.Cfg.Props)));1031 pStream->szName, cfGstWritten, DrvAudioHlpFramesToMilli(&pStream->Guest.Cfg.Props, cfGstWritten))); 1032 1032 1033 1033 Log3Func(("[%s] Last written %RU64ns (%RU64ms), now filled with %RU64ms -- %RU8%%\n", 1034 1034 pStream->szName, tsNowNs - pStream->tsLastReadWrittenNs, 1035 1035 (tsNowNs - pStream->tsLastReadWrittenNs) / RT_NS_1MS, 1036 DrvAudioHlpFramesToMilli( AudioMixBufUsed(&pStream->Host.MixBuf), &pStream->Host.Cfg.Props),1036 DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, AudioMixBufUsed(&pStream->Host.MixBuf)), 1037 1037 AudioMixBufUsed(&pStream->Host.MixBuf) * 100 / AudioMixBufSize(&pStream->Host.MixBuf))); 1038 1038 … … 1550 1550 Log3Func(("[%s] Last played %RU64ns (%RU64ms), filled with %RU64ms (%RU8%%) total (fThresholdReached=%RTbool)\n", 1551 1551 pStream->szName, tsDeltaPlayedCapturedNs, tsDeltaPlayedCapturedNs / RT_NS_1MS_64, 1552 DrvAudioHlpFramesToMilli( cFramesLive, &pStream->Host.Cfg.Props), uLivePercent, pStream->fThresholdReached));1552 DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cFramesLive), uLivePercent, pStream->fThresholdReached)); 1553 1553 1554 1554 if ( pStream->fThresholdReached /* Has the treshold been reached (e.g. are we in playing stage) ... */ … … 1556 1556 { 1557 1557 LogRel2(("Audio: Buffer underrun for stream '%s' occurred (%RU64ms passed)\n", 1558 pStream->szName, DrvAudioHlpFramesToMilli( cfPassedReal, &pStream->Host.Cfg.Props)));1558 pStream->szName, DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cfPassedReal))); 1559 1559 1560 1560 if (pStream->Host.Cfg.Backend.cFramesPreBuffering) /* Any pre-buffering configured? */ … … 1622 1622 #ifdef DEBUG 1623 1623 Log3Func(("[%s] Playing %RU32 frames (%RU64ms), now filled with %RU64ms -- %RU8%%\n", 1624 pStream->szName, cfToPlay, DrvAudioHlpFramesToMilli( cfToPlay, &pStream->Host.Cfg.Props),1625 DrvAudioHlpFramesToMilli( AudioMixBufUsed(&pStream->Host.MixBuf), &pStream->Host.Cfg.Props),1624 pStream->szName, cfToPlay, DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cfToPlay), 1625 DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, AudioMixBufUsed(&pStream->Host.MixBuf)), 1626 1626 AudioMixBufUsed(&pStream->Host.MixBuf) * 100 / AudioMixBufSize(&pStream->Host.MixBuf))); 1627 1627 #endif … … 1654 1654 DrvAudioHlpMilliToFrames(pStream->Guest.Cfg.Device.cMsSchedulingHint, &pStream->Host.Cfg.Props), 1655 1655 pStream->Guest.Cfg.Device.cMsSchedulingHint, 1656 cfPassedReal, DrvAudioHlpFramesToMilli( cfPassedReal, &pStream->Host.Cfg.Props),1657 cFramesLive, DrvAudioHlpFramesToMilli( cFramesLive, &pStream->Host.Cfg.Props),1658 cFramesPeriod, DrvAudioHlpFramesToMilli( cFramesPeriod, &pStream->Host.Cfg.Props),1659 cfWritable, DrvAudioHlpFramesToMilli( cfWritable, &pStream->Host.Cfg.Props),1660 cfToPlay, DrvAudioHlpFramesToMilli( cfToPlay, &pStream->Host.Cfg.Props),1661 cfPlayedTotal, DrvAudioHlpFramesToMilli( cfPlayedTotal, &pStream->Host.Cfg.Props)));1656 cfPassedReal, DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cfPassedReal), 1657 cFramesLive, DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cFramesLive), 1658 cFramesPeriod, DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cFramesPeriod), 1659 cfWritable, DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cfWritable), 1660 cfToPlay, DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cfToPlay), 1661 cfPlayedTotal, DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cfPlayedTotal))); 1662 1662 } 1663 1663 … … 2504 2504 { 2505 2505 Log3Func(("[%s] Filling in silence (%RU64ms / %RU64ms)\n", pStream->szName, 2506 DrvAudioHlpFramesToMilli( cfBuf - cfReadTotal, &pStream->Guest.Cfg.Props),2507 DrvAudioHlpFramesToMilli( cfBuf, &pStream->Guest.Cfg.Props)));2506 DrvAudioHlpFramesToMilli(&pStream->Guest.Cfg.Props, cfBuf - cfReadTotal), 2507 DrvAudioHlpFramesToMilli(&pStream->Guest.Cfg.Props, cfBuf))); 2508 2508 2509 2509 DrvAudioHlpClearBuf(&pStream->Guest.Cfg.Props, … … 3228 3228 } 3229 3229 3230 LogRel2(("Audio: Using %s period size (%RU64ms, %RU32 frames)for stream '%s'\n",3231 szWhat, 3232 DrvAudioHlpFramesToMilli(pCfgReq->Backend.cFramesPeriod, &pCfgReq->Props),pCfgReq->Backend.cFramesPeriod, pStream->szName));3230 LogRel2(("Audio: Using %s period size %RU64 ms / %RU32 frames for stream '%s'\n", 3231 szWhat, DrvAudioHlpFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesPeriod), 3232 pCfgReq->Backend.cFramesPeriod, pStream->szName)); 3233 3233 3234 3234 /* … … 3247 3247 } 3248 3248 3249 LogRel2(("Audio: Using %s buffer size (%RU64ms, %RU32 frames)for stream '%s'\n",3250 szWhat, 3251 DrvAudioHlpFramesToMilli(pCfgReq->Backend.cFramesBufferSize, &pCfgReq->Props),pCfgReq->Backend.cFramesBufferSize, pStream->szName));3249 LogRel2(("Audio: Using %s buffer size %RU64 ms / %RU32 frames for stream '%s'\n", 3250 szWhat, DrvAudioHlpFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize), 3251 pCfgReq->Backend.cFramesBufferSize, pStream->szName)); 3252 3252 3253 3253 /* … … 3269 3269 } 3270 3270 3271 LogRel2(("Audio: Using %s pre-buffering size (%RU64ms, %RU32 frames)for stream '%s'\n",3272 szWhat, 3273 DrvAudioHlpFramesToMilli(pCfgReq->Backend.cFramesPreBuffering, &pCfgReq->Props),pCfgReq->Backend.cFramesPreBuffering, pStream->szName));3271 LogRel2(("Audio: Using %s pre-buffering size %RU64 ms / %RU32 frames for stream '%s'\n", 3272 szWhat, DrvAudioHlpFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesPreBuffering), 3273 pCfgReq->Backend.cFramesPreBuffering, pStream->szName)); 3274 3274 3275 3275 /* … … 3279 3279 { 3280 3280 LogRel(("Audio: Error for stream '%s': Buffering size (%RU64ms) must not be smaller than the period size (%RU64ms)\n", 3281 pStream->szName, DrvAudioHlpFramesToMilli( pCfgReq->Backend.cFramesBufferSize, &pCfgReq->Props),3282 DrvAudioHlpFramesToMilli( pCfgReq->Backend.cFramesPeriod, &pCfgReq->Props)));3281 pStream->szName, DrvAudioHlpFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize), 3282 DrvAudioHlpFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesPeriod))); 3283 3283 return VERR_INVALID_PARAMETER; 3284 3284 } … … 3290 3290 { 3291 3291 LogRel(("Audio: Error for stream '%s': Buffering size (%RU64ms) must not be smaller than the pre-buffering size (%RU64ms)\n", 3292 pStream->szName, DrvAudioHlpFramesToMilli( pCfgReq->Backend.cFramesPreBuffering, &pCfgReq->Props),3293 DrvAudioHlpFramesToMilli( pCfgReq->Backend.cFramesBufferSize, &pCfgReq->Props)));3292 pStream->szName, DrvAudioHlpFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesPreBuffering), 3293 DrvAudioHlpFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize))); 3294 3294 return VERR_INVALID_PARAMETER; 3295 3295 } … … 3329 3329 if (pCfgAcq->Backend.cFramesBufferSize != pCfgReq->Backend.cFramesBufferSize) 3330 3330 LogRel2(("Audio: Buffer size overwritten by backend for stream '%s' (now %RU64ms, %RU32 frames)\n", 3331 pStream->szName, DrvAudioHlpFramesToMilli( pCfgAcq->Backend.cFramesBufferSize, &pCfgAcq->Props), pCfgAcq->Backend.cFramesBufferSize));3331 pStream->szName, DrvAudioHlpFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesBufferSize), pCfgAcq->Backend.cFramesBufferSize)); 3332 3332 3333 3333 if (pCfgAcq->Backend.cFramesPeriod != pCfgReq->Backend.cFramesPeriod) 3334 3334 LogRel2(("Audio: Period size overwritten by backend for stream '%s' (now %RU64ms, %RU32 frames)\n", 3335 pStream->szName, DrvAudioHlpFramesToMilli( pCfgAcq->Backend.cFramesPeriod, &pCfgAcq->Props), pCfgAcq->Backend.cFramesPeriod));3335 pStream->szName, DrvAudioHlpFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesPeriod), pCfgAcq->Backend.cFramesPeriod)); 3336 3336 3337 3337 /* Was pre-buffering requested, but the acquired configuration from the backend told us something else? */ … … 3340 3340 if (pCfgAcq->Backend.cFramesPreBuffering != pCfgReq->Backend.cFramesPreBuffering) 3341 3341 LogRel2(("Audio: Pre-buffering size overwritten by backend for stream '%s' (now %RU64ms, %RU32 frames)\n", 3342 pStream->szName, DrvAudioHlpFramesToMilli( pCfgAcq->Backend.cFramesPreBuffering, &pCfgAcq->Props), pCfgAcq->Backend.cFramesPreBuffering));3342 pStream->szName, DrvAudioHlpFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesPreBuffering), pCfgAcq->Backend.cFramesPreBuffering)); 3343 3343 3344 3344 if (pCfgAcq->Backend.cFramesPreBuffering > pCfgAcq->Backend.cFramesBufferSize) … … 3346 3346 pCfgAcq->Backend.cFramesPreBuffering = pCfgAcq->Backend.cFramesBufferSize; 3347 3347 LogRel2(("Audio: Pre-buffering size bigger than buffer size for stream '%s', adjusting to %RU64ms (%RU32 frames)\n", 3348 pStream->szName, DrvAudioHlpFramesToMilli( pCfgAcq->Backend.cFramesPreBuffering, &pCfgAcq->Props), pCfgAcq->Backend.cFramesPreBuffering));3348 pStream->szName, DrvAudioHlpFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesPreBuffering), pCfgAcq->Backend.cFramesPreBuffering)); 3349 3349 } 3350 3350 } -
trunk/src/VBox/Devices/Audio/DrvAudio.h
r87992 r87993 205 205 uint64_t DrvAudioHlpBytesToNano(PCPDMAUDIOPCMPROPS pProps, uint32_t cb); 206 206 uint32_t DrvAudioHlpFramesToBytes(uint32_t cFrames, PCPDMAUDIOPCMPROPS pProps); 207 uint64_t DrvAudioHlpFramesToMilli( uint32_t cFrames, PCPDMAUDIOPCMPROPS pProps);207 uint64_t DrvAudioHlpFramesToMilli(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames); 208 208 uint64_t DrvAudioHlpFramesToNano(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames); 209 209 uint32_t DrvAudioHlpMilliToBytes(uint64_t uMs, PCPDMAUDIOPCMPROPS pProps); -
trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp
r87992 r87993 1347 1347 * @param cFrames Number of audio frames to convert. 1348 1348 */ 1349 uint64_t DrvAudioHlpFramesToMilli( uint32_t cFrames, PCPDMAUDIOPCMPROPS pProps)1349 uint64_t DrvAudioHlpFramesToMilli(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames) 1350 1350 { 1351 1351 AssertPtrReturn(pProps, 0); -
trunk/src/VBox/Devices/Audio/DrvHostPulseAudio.cpp
r87979 r87993 794 794 pStreamPA->SampleSpec.channels = pCfgReq->Props.cChannels; 795 795 796 pStreamPA->curLatencyUs = DrvAudioHlpFramesToMilli( pCfgReq->Backend.cFramesBufferSize, &pCfgReq->Props) * RT_US_1MS;796 pStreamPA->curLatencyUs = DrvAudioHlpFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize) * RT_US_1MS; 797 797 798 798 const uint32_t cbLatency = pa_usec_to_bytes(pStreamPA->curLatencyUs, &pStreamPA->SampleSpec); -
trunk/src/VBox/Devices/Audio/testcase/tstAudioMixBuffer.cpp
r87992 r87993 66 66 RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToNano(&s_Cfg441StereoS16, 44100)) == RT_NS_1SEC, 67 67 ("ns=%RU64\n", u64)); 68 //RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToMicro( 44100, &s_Cfg441StereoS16)) == RT_US_1SEC,68 //RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToMicro(&s_Cfg441StereoS16, 44100)) == RT_US_1SEC, 69 69 // ("us=%RU64\n", u64)); 70 RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToMilli( 44100, &s_Cfg441StereoS16)) == RT_MS_1SEC,70 RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToMilli(&s_Cfg441StereoS16, 44100)) == RT_MS_1SEC, 71 71 ("ms=%RU64\n", u64)); 72 72
Note:
See TracChangeset
for help on using the changeset viewer.