roc-streaming / roc-toolkit

Real-time audio streaming over the network.
https://roc-streaming.org
Mozilla Public License 2.0
1.03k stars 205 forks source link

sox source: can't open: unsupported # of channels: expected=2 actual=1 #498

Open Ramblurr opened 1 year ago

Ramblurr commented 1 year ago

As discussed in matrix..

pi@dev1:~ $ roc-send -vvvv --input alsa://hw:1,0 --source rtp+rs8m://10.9.6.96:10001 --repair rs8m://10.9.6.96:10002
17:01:11.476 [5110] [dbg] roc_core: [slab_pool.cpp:38] slab pool: initializing: object_size=672 min_slab=0B(1S) max_slab=0B(0S) poison=0
17:01:11.477 [5110] [dbg] roc_core: [slab_pool.cpp:38] slab pool: initializing: object_size=2064 min_slab=0B(1S) max_slab=0B(0S) poison=0
17:01:11.477 [5110] [dbg] roc_core: [slab_pool.cpp:38] slab pool: initializing: object_size=4112 min_slab=0B(1S) max_slab=0B(0S) poison=0
17:01:11.477 [5111] [dbg] roc_netio: [network_loop.cpp:278] network loop: starting event loop
17:01:11.477 [5110] [dbg] roc_peer: [context.cpp:25] context: initializing
17:01:11.478 [5110] [dbg] roc_sndio: [pulseaudio_backend.cpp:19] pulseaudio backend: initializing
17:01:11.478 [5110] [dbg] roc_sndio: [sox_backend.cpp:164] sox backend: initializing
17:01:11.478 [5112] [dbg] roc_ctl: [control_task_queue.cpp:95] control task queue: starting event loop
17:01:11.478 [5112] [trc] roc_ctl: [control_task_queue.cpp:706] control task queue: ready task queue is empty or being pushed
17:01:11.478 [5112] [trc] roc_ctl: [control_task_queue.cpp:839] control task queue: updating wakeup deadline: deadline=-1
17:01:11.478 [5110] [dbg] roc_sndio: [backend_map.cpp:20] backend map: initialized: n_backends=2 n_drivers=58
17:01:11.478 [5110] [inf] roc_sndio: [sox_source.cpp:65] sox source: opening: driver=alsa path=hw:1,0
17:01:11.491 [5110] [trc] roc_sndio: [sox_backend.cpp:157] sox: alsa.c: select_format: trying #7
17:01:11.491 [5110] [trc] roc_sndio: [sox_backend.cpp:157] sox: alsa.c: select_format: trying #8
17:01:11.491 [5110] [trc] roc_sndio: [sox_backend.cpp:157] sox: alsa.c: select_format: trying #4
17:01:11.491 [5110] [trc] roc_sndio: [sox_backend.cpp:157] sox: alsa.c: select_format: trying #5
17:01:11.491 [5110] [trc] roc_sndio: [sox_backend.cpp:157] sox: alsa.c: select_format: trying #6
17:01:11.491 [5110] [trc] roc_sndio: [sox_backend.cpp:157] sox: alsa.c: select_format: trying #2
17:01:11.491 [5110] [dbg] roc_sndio: [sox_backend.cpp:157] sox: alsa.c: can't encode 32-bit Signed Integer PCM
17:01:11.491 [5110] [trc] roc_sndio: [sox_backend.cpp:157] sox: alsa.c: selecting format 2: S16_LE (Signed 16 bit Little Endian)
17:01:11.493 [5110] [err] roc_sndio: [sox_source.cpp:337] sox source: can't open: unsupported # of channels: expected=2 actual=1
17:01:11.494 [5110] [dbg] roc_sndio: [sox_backend.cpp:289] sox backend: open failed: driver=alsa path=hw:1,0
17:01:11.494 [5110] [inf] roc_sndio: [sox_source.cpp:361] sox source: closing input
17:01:11.495 [5110] [err] roc_sndio: [backend_dispatcher.cpp:208] backend dispatcher: failed to open source: type=device driver=alsa path=hw:1,0
17:01:11.495 [5110] [err] roc_send: [main.cpp:255] can't open input file or device: uri=alsa://hw:1,0 format=(null)
17:01:11.495 [5110] [dbg] roc_peer: [context.cpp:29] context: deinitializing
17:01:11.495 [5112] [trc] roc_ctl: [control_task_queue.cpp:706] control task queue: ready task queue is empty or being pushed
17:01:11.496 [5112] [trc] roc_ctl: [control_task_queue.cpp:839] control task queue: updating wakeup deadline: deadline=-1
17:01:11.496 [5112] [dbg] roc_ctl: [control_task_queue.cpp:105] control task queue: finishing event loop
17:01:11.496 [5111] [dbg] roc_netio: [network_loop.cpp:285] network loop: finishing event loop

Raspberry PI Zero 2 running 64bit raspbian PulseAudio 14.2


pi@dev1:~ $ roc-send  --version
roc-send 0.2.0 (ed92e21e98)```
gavv commented 1 year ago

To fix this, we should ask backend (source or sink) its channel layout and perform channel mapping. We already have channel mapper class, just need to apply it in right place.