roc-streaming / roc-pulse

Roc Toolkit modules for PulseAudio.
https://roc-streaming.org
GNU Lesser General Public License v2.1
8 stars 2 forks source link

PulseAudio modules not working on Orange Pi Lite2 #7

Closed gavv closed 5 years ago

gavv commented 5 years ago

roc-recv works, but module-roc-sink-input constantly interrupts playback:

I: [alsa-sink-USB Audio] roc_pipeline: receiver: creating session
D: [alsa-sink-USB Audio] roc_packet: delayed reader: initializing: delay=8820
D: [alsa-sink-USB Audio] roc_fec: of decoder: initializing Reed-Solomon decoder
D: [alsa-sink-USB Audio] roc_audio: watchdog: initializing: max_blank_duration=88200 max_drops_duration=88200 drop_detection_window=13230
D: [alsa-sink-USB Audio] roc_audio: resampler: initializing: window_interp=128 window_size=32 frame_size=640 channels_num=2
D: [alsa-sink-USB Audio] roc_audio: resampler reader: initializing window
D: [alsa-sink-USB Audio] roc_audio: latency monitor: initializing: target_latency=8820 in_rate=44100 out_rate=44100
D: [alsa-sink-USB Audio] roc_packet: router: detected new stream: source=2072940300 flags=0x8u
D: [alsa-sink-USB Audio] roc_packet: router: detected new stream: source=1451934384 flags=0x10u
D: [alsa-sink-USB Audio] roc_packet: delayed reader: initial queue: delay=8820 queue=79104 packets=256
D: [alsa-sink-USB Audio] roc_packet: delayed reader: trimmed queue: delay=8820 queue=8961 packets=29
D: [alsa-sink-USB Audio] roc_fec: fec reader: repair queue: dropped=21
D: [alsa-sink-USB Audio] roc_audio: depacketizer: got first packet: zero_samples=0
D: [alsa-sink-USB Audio] roc_fec: fec reader: repair queue: dropped=21
D: [alsa-sink-USB Audio] roc_audio: depacketizer: ts=1976227423 loss_ratio=0.00000
D: [alsa-sink-USB Audio] roc_fec: fec reader: repair queue: dropped=21
D: [alsa-sink-USB Audio] roc_fec: fec reader: repair queue: dropped=21
D: [alsa-sink-USB Audio] roc_fec: fec reader: repair queue: dropped=21
D: [alsa-sink-USB Audio] roc_fec: fec reader: repair queue: dropped=15
D: [alsa-sink-USB Audio] roc_fec: fec reader: got first packet in a block, start decoding: n_packets_before=12 blk_sn=3948
D: [alsa-sink-USB Audio] roc_audio: latency monitor: latency=1546 target=8820 fe=1.00000 trim_fe=1.00000 adj_fe=1.00000
D: [alsa-sink-USB Audio] roc_fec: of decoder: repaired 0/28/30 ..XXXXXXXXXXXXXXXXXX xxxxxxxxxx
D: [alsa-sink-USB Audio] roc_audio: watchdog: status: ............ibbbbbbb
D: [alsa-sink-USB Audio] roc_audio: depacketizer: dropping late packet: ts=1976244063 pkt_ts=1976237609
D: [alsa-sink-USB Audio] roc_audio: depacketizer: dropping late packet: ts=1976244063 pkt_ts=1976237918
D: [alsa-sink-USB Audio] roc_audio: depacketizer: dropping late packet: ts=1976244063 pkt_ts=1976238227
D: [alsa-sink-USB Audio] roc_audio: depacketizer: dropping late packet: ts=1976244063 pkt_ts=1976238536
D: [alsa-sink-USB Audio] roc_fec: of decoder: repaired 0/24/30 ......XXXXXXXXXXXXXX xxxxxxxxxx
D: [alsa-sink-USB Audio] roc_audio: depacketizer: fetched=0 dropped=4
D: [alsa-sink-USB Audio] roc_audio: watchdog: status: bbbbbbbbbbbbbBbbbbbb
D: [alsa-sink-USB Audio] roc_audio: latency monitor: latency out of bounds: latency=-12611 min=-8820
I: [alsa-sink-USB Audio] roc_pipeline: receiver: removing session

This box is aarch64 (have not tested it before) and uses pulseaudio 8.0 (also have not tested it before).

gavv commented 5 years ago

It seems the problem is that PulseAudio buffer size is larger then the Roc target latency. Playback goes almost normally if I set 2sec latency in Roc. Not sure why PulseAudio chose such a high latency though, needs some more investigation. Also there are some tiny but regular glitches even with 2sec latency.

gavv commented 5 years ago

Related: roc-streaming/roc-pulse#6, roc-streaming/roc-pulse#17, roc-streaming/roc-pulse#18, roc-streaming/roc-pulse#16.

gavv commented 5 years ago

It's now possible to configure module-roc-sink-input to use higher network latency. This fixes the playback.

However the real problem was that module-roc-sink-input didn't request PulseAudio the minimum desired latency so the sink was using the default which is about 2 seconds.

It's now also possible to configure module-roc-sink-input to request lower playback latency. This is enabled by default now and fixes the playback as well.