Latency problem with module-loopback after downtime

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

No, this is not about the usual loopback latency ;) I have found a strange anomaly.

I have 2 sound cards: C-Media CMI8738 (I've check, well supported on Linux, work great) 1st is for Toslink input, 2nd for Toslink output (and this is the default and only sink for the whole system)

I'm setting up a loopback device like this:
pactl load-module module-loopback \
latency_msec=1 \
source=alsa_input.pci-0000_06_01.0.iec958-stereo \
sink=alsa_output.pci-0000_06_02.0.iec958-stereo

And this works great! Latency is very low:
Sink Input #0
        Driver: module-loopback.c
        [...]
        Buffer Latency: 10250 usec
        Sink Latency: 7263 usec

Source Output #0
        Driver: module-loopback.c
        [...]
        Buffer Latency: 0 usec
        Source Latency: 380 usec


Now, here is the problem. When I unplug a cable of the source, source latency rises to infinity. And I understand why, it's fine, but, when I plug the cable again, then: source Latency slowly goes down, but sink's buffer latency rises, up to even 8-12 seconds.

Notes:
 - Reloading the module is a fix.
- by unplug I mean unplug, or shut down the source: anything that stops the signal.


What I'm looking for:
1. This is most likely a bug, which I could help analyze by providing more data. 2. But in the meantime, I'm looking for a way to reload the module when source device shows up. This is the best I came up with so far, in tmux:

watch -n 105 'pactl list | grep -A 12 module-loopback.c | grep "Source Latency" | grep -Eo "[0-9]{9}" &> /dev/null && pactl unload-module module-loopback && sleep 6 && pactl load-module module-loopback latency_msec=1 source=alsa_input.pci-0000_06_01.0.iec958-stereo sink=alsa_output.pci-0000_06_02.0.iec958-stereo && echo "reload"'

(if Source Latency goes over 8 digit number (100seconds), reload the module-loopback)
--
dextkrk
_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux