[pulseaudio-discuss] module-remap-source, module-virtual-source, and latencies

Georg Chini georg at chini.tk
Tue Apr 19 06:45:42 UTC 2022


Hi Chase,

let me know the results of your tests. I would especially be interested 
in the
difference between using module-null-sink with module-remap-source
and module-null-source with the uplink sink of module-remap-source.

Regards
        Georg

On 19.04.22 01:32, Chase Lambert wrote:
> Thanks for the replies!
>
> guest271314 - Huh, that's odd that you would see any audio 
> differences. My stab in the dark guess would be some sort of 
> PulseAudio resampling? Otherwise I would think the PCM data would be 
> the same. I'll double check that the audio quality is as expected.
>
> Georg - I can see how that MR could reduce latency, interesting.
>
> I'm kind of just thinking out loud here, but the latency can get very 
> low (say to 10ms), right? As long as I have small numbers 
> in pa_buffer_attr, I would think that:
> - My application would get a callback from PulseAudio, telling it to 
> write something
> - My application writes something
> - Immediately thereafter, Chrome gets a callback to read data
> - Chrome reads the data
> - There isn't a risk of an underrun here by Chrome, because it will 
> only get callbacks when data is ready (hazy guess!)
>
> I ask this because my alternative is modifying Chromium and sending 
> data directly to it over a custom IPC channel. But in theory that IPC 
> channel should not be faster than PulseAudio. PulseAudio is just 
> acting as a queue, and ultimately just a form of IPC between my 
> application and Chrome.
>
> In any case, I'll soon find the answer myself. Thanks!
>
> On Sun, Apr 17, 2022 at 9:13 AM guest271314 <guest271314 at gmail.com 
> <mailto:guest271314 at gmail.com>> wrote:
>
>     I am not sure about different latencies re module-remap-source and
>     module-virtual-source. From my testing the quality of audio output
>     when using a remapped source with getUserMedia() is inferior
>     compared to getting the raw PCM using pactl or parec with fetch()
>     on the browser side then using AudioWorklet or
>     MediaStreamTrackGenerator in Chrome/Chromium to output the audio.
>
>
>
>     On Sat, Apr 16, 2022 at 9:49 PM Chase Lambert
>     <chaselambda at gmail.com <mailto:chaselambda at gmail.com>> wrote:
>
>         Hi,
>
>         I'm trying to make a low latency Virtual microphone. What that
>         means is I make a null sink, and then a module-virtual-source
>         or module-remap-source that has a master pointing to the
>         sink's monitor.
>
>         Then I can write to that sink, and get data to show up in this
>         virtual microphone.
>
>         I've found that module-remap-source has a lower latency
>         than module-virtual-source, (~400ms lower it seems), but I
>         don't have any idea why. And more generally -- what is the
>         difference between these two modules? I looked at their source
>         and also the git history, but that didn't clear much up for me.
>
>         Also, is this the best way to make a low latency microphone? I
>         have an application that I want to send data to Chrome, with
>         as low latency as possible. Chrome operates directly with
>         pulseaudio[0].
>
>         Thanks,
>         Chase
>
>         [0]
>         https://source.chromium.org/chromium/chromium/src/+/main:media/audio/pulse/audio_manager_pulse.cc
>         <https://source.chromium.org/chromium/chromium/src/+/main:media/audio/pulse/audio_manager_pulse.cc>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20220419/f4d4b5e5/attachment.htm>


More information about the pulseaudio-discuss mailing list