- Timestamp:
- Aug 6, 2018 1:58:05 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvHostPulseAudio.cpp
r73462 r73526 133 133 } PULSEAUDIOSTREAM, *PPULSEAUDIOSTREAM; 134 134 135 /* The desired buffer length in milliseconds. Will be the target total stream136 * latency on newer version of pulse. Apparent latency can be less (or more.)137 */138 typedef struct PULSEAUDIOCFG139 {140 RTMSINTERVAL buffer_msecs_out;141 RTMSINTERVAL buffer_msecs_in;142 } PULSEAUDIOCFG, *PPULSEAUDIOCFG;143 144 static PULSEAUDIOCFG s_pulseCfg =145 {146 100, /* buffer_msecs_out */147 100 /* buffer_msecs_in */148 };149 150 135 /** 151 136 * Callback context for server enumeration callbacks. … … 750 735 pStreamPA->SampleSpec.channels = pCfgReq->Props.cChannels; 751 736 752 pStreamPA->curLatencyUs = 100 * 1000; /** 10ms latency by default. @todo Make this configurable. */737 pStreamPA->curLatencyUs = DrvAudioHlpFramesToMilli(pCfgReq->Backend.cfBufferSize, &pCfgReq->Props) * RT_US_1MS; 753 738 754 739 const uint32_t cbLatency = pa_usec_to_bytes(pStreamPA->curLatencyUs, &pStreamPA->SampleSpec); 755 740 756 LogRel2(("PulseAudio: Initial output latency is %RU64ms (%RU32 bytes)\n", pStreamPA->curLatencyUs / 1000 /* ms */, cbLatency));741 LogRel2(("PulseAudio: Initial output latency is %RU64ms (%RU32 bytes)\n", pStreamPA->curLatencyUs / RT_US_1MS, cbLatency)); 757 742 758 743 pStreamPA->BufAttr.tlength = cbLatency; 759 pStreamPA->BufAttr.maxlength = (pStreamPA->BufAttr.tlength * 3) / 2;744 pStreamPA->BufAttr.maxlength = -1; /* Let the PulseAudio server choose the biggest size it can handle. */ 760 745 pStreamPA->BufAttr.prebuf = cbLatency; 761 pStreamPA->BufAttr.minreq = (uint32_t)-1; /* PulseAudio should set something sensible for minreq on it's own. */762 763 LogFunc((" BufAttr tlength=%RU32, maxLength=%RU32, minReq=%RU32\n",746 pStreamPA->BufAttr.minreq = DrvAudioHlpFramesToBytes(pCfgReq->Backend.cfPeriod, &pCfgReq->Props); 747 748 LogFunc(("Requested: BufAttr tlength=%RU32, maxLength=%RU32, minReq=%RU32\n", 764 749 pStreamPA->BufAttr.tlength, pStreamPA->BufAttr.maxlength, pStreamPA->BufAttr.minreq)); 765 750 … … 767 752 768 753 char szName[256]; 769 RTStrPrintf2(szName, sizeof(szName), 754 RTStrPrintf2(szName, sizeof(szName), "VirtualBox %s [%s]", 770 755 DrvAudioHlpPlaybackDstToStr(pCfgReq->DestSource.Dest), pThis->szStreamName); 771 756 … … 788 773 uint32_t cbBuf = RT_MIN(pStreamPA->BufAttr.tlength * 2, 789 774 pStreamPA->BufAttr.maxlength); /** @todo Make this configurable! */ 775 776 LogFunc(("Acquired: BufAttr tlength=%RU32, maxLength=%RU32, minReq=%RU32\n", 777 pStreamPA->BufAttr.tlength, pStreamPA->BufAttr.maxlength, pStreamPA->BufAttr.minreq)); 778 790 779 if (cbBuf) 791 780 { … … 810 799 pStreamPA->SampleSpec.channels = pCfgReq->Props.cChannels; 811 800 812 /** @todo Check these values! */ 813 pStreamPA->BufAttr.fragsize = (pa_bytes_per_second(&pStreamPA->SampleSpec) * s_pulseCfg.buffer_msecs_in) / 1000; 814 pStreamPA->BufAttr.maxlength = (pStreamPA->BufAttr.fragsize * 3) / 2; 801 pStreamPA->BufAttr.fragsize = DrvAudioHlpFramesToBytes(pCfgReq->Backend.cfPeriod, &pCfgReq->Props); 802 pStreamPA->BufAttr.maxlength = -1; /* Let the PulseAudio server choose the biggest size it can handle. */ 815 803 816 804 Assert(pCfgReq->enmDir == PDMAUDIODIR_IN); 817 805 818 806 char szName[256]; 819 RTStrPrintf2(szName, sizeof(szName), 807 RTStrPrintf2(szName, sizeof(szName), "VirtualBox %s [%s]", 820 808 DrvAudioHlpRecSrcToStr(pCfgReq->DestSource.Source), pThis->szStreamName); 821 809
Note:
See TracChangeset
for help on using the changeset viewer.