roc-streaming / roc-toolkit

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

Double session restart on packet delay #137

Open gavv opened 6 years ago

gavv commented 6 years ago

The following happens.

1.

2.

3.

4.

gavv commented 6 years ago

The problem is that when we receive packets for a new session, we can't detect that they're already outdated.

gavv commented 6 years ago
D: [alsa-sink-USB Audio] roc_audio: latency monitor: latency=8832 target=8640 fe=0.99995 trim_fe=0.99995 adj_fe=0.99995
D: [alsa-sink-USB Audio] roc_audio: latency monitor: latency=8576 target=8640 fe=0.99995 trim_fe=0.99995 adj_fe=0.99995
D: [alsa-sink-USB Audio] roc_audio: latency monitor: latency=9408 target=8640 fe=0.99991 trim_fe=0.99991 adj_fe=0.99991
D: [alsa-sink-USB Audio] roc_audio: latency monitor: latency out of bounds: latency=-9216, min=-8640
I: [alsa-sink-USB Audio] roc_pipeline: receiver: removing session
I: [alsa-sink-USB Audio] roc_pipeline: receiver: creating session
D: [alsa-sink-USB Audio] roc_pipeline: receiver: dropping repair packet for non-existent session
D: [alsa-sink-USB Audio] roc_pipeline: receiver: can't route packet, dropping
I: [alsa-sink-USB Audio] roc_pipeline: receiver: creating session
D: [alsa-sink-USB Audio] roc_pipeline: receiver: dropping repair packet for non-existent session
D: [alsa-sink-USB Audio] roc_pipeline: receiver: can't route packet, dropping
I: [alsa-sink-USB Audio] roc_pipeline: receiver: creating session
D: [alsa-sink-USB Audio] roc_pipeline: receiver: dropping repair packet for non-existent session
D: [alsa-sink-USB Audio] roc_pipeline: receiver: can't route packet, dropping
I: [alsa-sink-USB Audio] roc_pipeline: receiver: creating session
D: [alsa-sink-USB Audio] roc_packet: delayed reader: initializing: delay=8640
D: [alsa-sink-USB Audio] roc_fec: of decoder: initializing Reed-Solomon decoder
D: [alsa-sink-USB Audio] roc_audio: resampler: initializing window
D: [alsa-sink-USB Audio] roc_audio: latency monitor: initializing: target_latency=8640 in_rate=44100 out_rate=44100
D: [alsa-sink-USB Audio] roc_packet: router: detected new stream: source=1537904675 flags=0x8u
D: [alsa-sink-USB Audio] roc_audio: depacketizer: ts=128 loss_ratio=0.00000
D: [alsa-sink-USB Audio] roc_packet: router: detected new stream: source=1805507153 flags=0x10u
D: [alsa-sink-USB Audio] roc_packet: delayed reader: initial queue: delay=8640 queue=12800 packets=40
D: [alsa-sink-USB Audio] roc_packet: delayed reader: trimmed queue: delay=8640 queue=8640 packets=27
D: [alsa-sink-USB Audio] roc_fec: fec reader: repair queue: dropped=10
D: [alsa-sink-USB Audio] roc_audio: depacketizer: got first packet: zero_samples=18304
D: [alsa-sink-USB Audio] roc_audio: latency monitor: latency=18752 target=8640 fe=1.00000 trim_fe=1.00000 adj_fe=1.00000
D: [alsa-sink-USB Audio] roc_fec: fec reader: got first packet in a block, start decoding: n_packets_before=7 blk_sn=30035
D: [alsa-sink-USB Audio] roc_audio: latency monitor: latency out of bounds: latency=29120, max=25920
I: [alsa-sink-USB Audio] roc_pipeline: receiver: removing session
I: [alsa-sink-USB Audio] roc_pipeline: receiver: creating session
D: [alsa-sink-USB Audio] roc_packet: delayed reader: initializing: delay=8640
D: [alsa-sink-USB Audio] roc_fec: of decoder: initializing Reed-Solomon decoder
D: [alsa-sink-USB Audio] roc_audio: resampler: initializing window
D: [alsa-sink-USB Audio] roc_audio: latency monitor: initializing: target_latency=8640 in_rate=44100 out_rate=44100
D: [alsa-sink-USB Audio] roc_packet: router: detected new stream: source=1537904675 flags=0x8u
D: [alsa-sink-USB Audio] roc_packet: router: detected new stream: source=1805507153 flags=0x10u
D: [alsa-sink-USB Audio] roc_packet: delayed reader: initial queue: delay=8640 queue=13120 packets=41
D: [alsa-sink-USB Audio] roc_packet: delayed reader: trimmed queue: delay=8640 queue=8640 packets=27
D: [alsa-sink-USB Audio] roc_fec: fec reader: repair queue: dropped=10
D: [alsa-sink-USB Audio] roc_audio: depacketizer: got first packet: zero_samples=0
D: [alsa-sink-USB Audio] roc_audio: depacketizer: ts=1692045923 loss_ratio=0.00000
D: [alsa-sink-USB Audio] roc_audio: latency monitor: latency=7232 target=8640 fe=1.00000 trim_fe=1.00000 adj_fe=1.00000