roc-toolkit: roc-send not working with pulseaudio source
As discussed in matrix…
pi@dev1:~ $ pulseaudio --version
pulseaudio 14.2
pi@dev1:~ $ roc-send --version
roc-send 0.2.0 (ed92e21e98)
pi@dev1:~ $ roc-send --list-supported
supported schemes for audio devices and files:
pulse:// alsa:// oss:// file://
supported formats for audio files:
.aifc .aiffc .aiff .aif .al .au .snd .avr .cdda .cdr .cvsd .cvs .cvu .dat
.dvms .vms .f32 .f64 .gsrt .hcom .htk .ima .la .lu .maud .prc .s8 .s16
.s24 .s32 .sf .ircam .sln .smp .sndr .sndt .sox .sph .nist .8svx .txw
.u8 .sou .fssd .u16 .u24 .u32 .ul .voc .vox .wav .wavpcm .amb .wve .xa
pi@dev1:~ $ roc-send -vvvv --input pulse://alsa_input.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.mono-fallback --source rtp+rs8m://10.9.6.96:10001 -
-repair rs8m://10.9.6.96:10002
14:52:31.481 [4967] [dbg] roc_core: [slab_pool.cpp:38] slab pool: initializing: object_size=672 min_slab=0B(1S) max_slab=0B(0S) poison=0
14:52:31.481 [4967] [dbg] roc_core: [slab_pool.cpp:38] slab pool: initializing: object_size=2064 min_slab=0B(1S) max_slab=0B(0S) poison=0
14:52:31.481 [4967] [dbg] roc_core: [slab_pool.cpp:38] slab pool: initializing: object_size=4112 min_slab=0B(1S) max_slab=0B(0S) poison=0
14:52:31.482 [4968] [dbg] roc_netio: [network_loop.cpp:278] network loop: starting event loop
14:52:31.482 [4967] [dbg] roc_peer: [context.cpp:25] context: initializing
14:52:31.482 [4967] [dbg] roc_sndio: [pulseaudio_backend.cpp:19] pulseaudio backend: initializing
14:52:31.482 [4967] [dbg] roc_sndio: [sox_backend.cpp:164] sox backend: initializing
14:52:31.482 [4969] [dbg] roc_ctl: [control_task_queue.cpp:95] control task queue: starting event loop
14:52:31.483 [4969] [trc] roc_ctl: [control_task_queue.cpp:706] control task queue: ready task queue is empty or being pushed
14:52:31.483 [4969] [trc] roc_ctl: [control_task_queue.cpp:839] control task queue: updating wakeup deadline: deadline=-1
14:52:31.483 [4967] [dbg] roc_sndio: [backend_map.cpp:20] backend map: initialized: n_backends=2 n_drivers=58
14:52:31.483 [4967] [err] roc_sndio: [backend_dispatcher.cpp:208] backend dispatcher: failed to open source: type=device driver=pulse path=alsa_input.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.mono-fallback
14:52:31.483 [4967] [err] roc_send: [main.cpp:255] can't open input file or device: uri=pulse://alsa_input.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.mono-fallback format=(null)
14:52:31.483 [4967] [dbg] roc_peer: [context.cpp:29] context: deinitializing
14:52:31.484 [4969] [trc] roc_ctl: [control_task_queue.cpp:706] control task queue: ready task queue is empty or being pushed
14:52:31.484 [4969] [trc] roc_ctl: [control_task_queue.cpp:839] control task queue: updating wakeup deadline: deadline=-1
14:52:31.484 [4969] [dbg] roc_ctl: [control_task_queue.cpp:105] control task queue: finishing event loop
14:52:31.484 [4968] [dbg] roc_netio: [network_loop.cpp:285] network loop: finishing event loop
pi@dev1:~ $ pactl list sources short
3 alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo.monitor module-alsa-card.c s16le 2ch 44100Hz SUSPENDED
4 alsa_input.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.mono-fallback module-alsa-card.c s16le 1ch 44100Hz SUSPENDED
gavv Thanks. I think I know where is the bug (in backrnd dispatching code).
As a temporary workaround, could you try to use -i alsa://pulse ?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (10 by maintainers)
I see, thanks. I thought you’re also streaming from mic.
BTW you can also use pipewire modules for roc.
Definitely, it’s on my TODO.
I’m closing this. @Ramblurr feel free to reopen if needed!
Thanks for checking!
If you mean overall latency from sender input to receiver output, you can:
--io-latencyon sender, as you’re already doing, to reduce PulseAudio recording latency (default 60ms)--io-latencyon receiver too, to reduce PulseAudio playback latency (default 60ms)--sess-latencyon receiver, to reduce session pipeline latency (default 200ms)--nbsrc(number of source packets in block, default 20)--nbrpr(number of repair/redundancy packets in block, default 10)--packet-length(duration of single packet; default 7ms)20 * 7ms = 140msminimum allowed session latency; you can reduce--nbsrcand/or--packet-lengthto reduce minimum allowed session latency; meaningful values for--nbrpris something in range[nbsrc/2; nbsrc]@zopieux I’ve pushed a fix for the latency to develop branch (cafa5a49327763a4b7a3ab9e45e2a8fb22dbc7ec). Pulseaudio part of the latency by default is about 60ms now.
I also added
--io-latencyoption to roc-send (d65cfbfa5d5ad853f0c07b1010137cb66304d610), which allows to set that part of the latency manually. In my experience, on many devices you can safely set it to 20-30 ms, and sometimes even lower. (but usually you need rtkit for that).Thanks for testing and report!
The high latency is not expected, it should be possible to set pulseaudio part of the latency from ~15s to ~60ms depending on device, and 60ms is expected to be default (since it works well for most devices).
I was able to reproduce it, looking into it.
I’ve added pulseaudio source support to
developbranch. It will be part of next release.Example:
You’re welcome to test it 😃
https://github.com/roc-streaming/roc-toolkit/issues/312
@zopieux Hi,
You can try to set
PULSE_SOURCEenvironment variable. Hopefully, ALSApulsedevice will use it.If not, I think after starting roc-send you can just open pavucontrol, open “recording” tab and connect roc-send to needed source:
You you can do the same using
pactl move-source-output.When you restart roc-send, pulseaudio should remember your last choice, however this functionality sometimes does not always behave as you can expect.