[pulseaudio-discuss] Rate/Timing issues when streaming over BT from iPhone.....
pl bossart
bossart.nospam at gmail.com
Mon Aug 16 13:43:36 PDT 2010
This is a known issue with module-loopback. If you look at this part
of the log, you'll see that there's something really wrong with how
the sample-rate is set:
> I: module-loopback.c: Old rate 43236 Hz, new rate 43300 Hz
> I: module-loopback.c: Loopback overall latency is 99.98 ms + 806.05 ms +
> 39.69 ms = 945.71 ms
> I: module-loopback.c: Should buffer 34640 bytes, buffered at minimum 69240
> bytes
> I: module-loopback.c: Old rate 43300 Hz, new rate 44965 Hz
> I: module-loopback.c: Loopback overall latency is 99.98 ms + 781.78 ms +
> 40.83 ms = 922.60 ms
> I: module-loopback.c: Should buffer 35976 bytes, buffered at minimum 134708
> bytes
> I: module-loopback.c: Old rate 44965 Hz, new rate 46568 Hz
> I: module-loopback.c: Loopback overall latency is 99.98 ms + 429.80 ms +
> 40.62 ms = 570.40 ms
> I: module-loopback.c: Should buffer 37256 bytes, buffered at minimum 79028
> bytes
> I: module-loopback.c: Old rate 46568 Hz, new rate 45144 Hz
> I: module-loopback.c: Loopback overall latency is 100.00 ms + 409.27 ms +
> 41.85 ms = 551.11 ms
> I: module-loopback.c: Should buffer 36120 bytes, buffered at minimum 73904
> bytes
> I: module-loopback.c: Old rate 45144 Hz, new rate 45044 Hz
By changing the sample-rate so often you end-up with cracks/noises.
I had similar problems when using an RTP link, the oscillations on the
sample-rate are not good.
Fundamentally I think there's something wrong with the logic Lennart
added to my original code. Every 5s or so, a timer fires, and a
message LATENCY_SNAPSHOT is sent to the input and output thread. Then
once both answers are received, the code determines what the sampling
rate should be. What I think is flawed is that this is not an atomic
way of getting the latency on both sides, and since we receive packets
the latency varies by large steps unlike for ALSA sinks/sources.
Without some filtering you end-up with too many variations of the
sampling rate.
Bottomline: this loopback code deserves some love, unfortunately I
don't have time to look into this. I had some success by limiting the
sample-rate oscilllations to 100Hz around the nominal value.
-Pierre
More information about the pulseaudio-discuss
mailing list