mikebrady / shairport-sync

AirPlay and AirPlay 2 audio player
Other
7.26k stars 574 forks source link

[Problem]: sync errors when JACK running != 44100 Hz #1926

Open lucianoiam opened 1 day ago

lucianoiam commented 1 day ago

What happened?

Notes:

Possibly related to https://github.com/mikebrady/shairport-sync/issues/1917 ?

Relevant log output

$ mpstat
Linux 6.1.77-v8-16k+ (raspberrypi)  10/29/2024  _aarch64_   (4 CPU)

09:18:30 AM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
09:18:30 AM  all    7.19    0.00   24.28    0.22    0.00    0.25    0.00    0.00    0.00   68.07

$ shairport-sync --verbose
         0.001137408 "shairport.c:2278" Startup in AirPlay 2 mode, with features 0x405c4a00,0x1c340 on device "2c:cf:67:34:66:42".
         0.000060241 "shairport.c:2317" Version String: "4.3.4-1-g910264e5-AirPlay2-smi10-alac-OpenSSL-Avahi-ALSA-jack-soxr-sysconfdir:/etc"
         0.000006555 "shairport.c:2336" Command Line: "shairport-sync --verbose".
         0.000131537 "shairport.c:2372" Log Verbosity is 1.
         0.000067000 "audio_jack.c:209" SOXR quality quick
         0.031668185 "shairport.c:2440" disable_resend_requests is off.
         0.000043871 "shairport.c:2441" diagnostic_drop_packet_fraction is 0.000000. A value of 0.0 means no packets will be dropped deliberately.
         0.000013666 "shairport.c:2445" statistics_requester status is 0.
         0.000003871 "shairport.c:2450" rtsp listening port is 7000.
         0.000002907 "shairport.c:2451" udp base port is 6001.
         0.000003130 "shairport.c:2452" udp port range is 10.
         0.000002870 "shairport.c:2453" player name is "Luc Soundsystem".
         0.000003259 "shairport.c:2454" backend is "jack".
         0.000003149 "shairport.c:2455" run_this_before_play_begins action is "(null)".
         0.000003444 "shairport.c:2456" run_this_after_play_ends action is "(null)".
         0.000003593 "shairport.c:2457" wait-cmd status is 0.
         0.000002944 "shairport.c:2458" run_this_before_play_begins may return output is 0.
         0.000003074 "shairport.c:2459" run_this_if_an_unfixable_error_is_detected action is "(null)".
         0.000003593 "shairport.c:2461" run_this_before_entering_active_state action is  "(null)".
         0.000002796 "shairport.c:2463" run_this_after_exiting_active_state action is  "(null)".
         0.000002982 "shairport.c:2465" active_state_timeout is  10.000000 seconds.
         0.000005018 "shairport.c:2466" mdns backend "(null)".
         0.000003056 "shairport.c:2468" interpolation setting is "auto".
         0.000002981 "shairport.c:2472" interpolation soxr_delay_threshold is 30000000.
         0.000002815 "shairport.c:2473" resync time is 0.010000 seconds.
         0.000003055 "shairport.c:2474" resync recovery time is 0.100000 seconds.
         0.000003260 "shairport.c:2475" allow a session to be interrupted: 0.
         0.000002796 "shairport.c:2476" busy timeout time is 120.
         0.000002741 "shairport.c:2477" drift tolerance is 0.002000 seconds.
         0.000003129 "shairport.c:2478" password is not set.
         0.000002630 "shairport.c:2479" default airplay volume is: -24.000000.
         0.000003278 "shairport.c:2480" high threshold airplay volume is: -16.000000.
         0.000003463 "shairport.c:2482" check for higher-than-threshold volume for new play session is disabled.
         0.000003111 "shairport.c:2488" ignore_volume_control is 1.
         0.000002963 "shairport.c:2492" volume_max_db is not set
         0.000002648 "shairport.c:2493" volume range in dB (zero means use the range specified by the mixer): 0.
         0.000003444 "shairport.c:2495" volume_range_combined_hardware_priority (1 means hardware mixer attenuation is used first) is 0.
         0.000003482 "shairport.c:2499" playback_mode is 0 (0-stereo, 1-mono, 1-reverse_stereo, 2-both_left, 3-both_right).
         0.000003685 "shairport.c:2501" disable_synchronization is 0.
         0.000002796 "shairport.c:2502" use_mmap_if_available is 1.
         0.000002778 "shairport.c:2503" output_format automatic selection is enabled.
         0.000002926 "shairport.c:2507" output_rate automatic selection is enabled.
         0.000003111 "shairport.c:2511" audio backend desired buffer length is 0.050000 seconds.
         0.000003593 "shairport.c:2513" audio_backend_buffer_interpolation_threshold_in_seconds is 0.250000 seconds.
         0.000003500 "shairport.c:2515" audio backend latency offset is 0.000000 seconds.
         0.000003389 "shairport.c:2517" audio backend silence lead-in time is "auto".
         0.000002685 "shairport.c:2521" zeroconf regtype is "_raop._tcp".
         0.000002981 "shairport.c:2522" decoders_supported field is 3.
         0.000002834 "shairport.c:2523" use_apple_decoder is 1.
         0.000002092 "shairport.c:2524" alsa_use_hardware_mute is 0.
         0.000002704 "shairport.c:2528" no special mdns service interface was requested.
         0.000018759 "shairport.c:2531" configuration file name "/etc/shairport-sync.conf" resolves to "/etc/shairport-sync.conf".
         0.000003815 "shairport.c:2561" loudness is 0.
         0.000005667 "shairport.c:2562" loudness reference level is -20.000000
         0.000691833 "shairport.c:2689" NQPTP is online.
         0.000628352 "audio_jack.c:173" Average maximum JACK latency across all ports: 0
         0.000980648 "audio_jack.c:173" Average maximum JACK latency across all ports: 0
         1.498147221 "shairport.c:255" "soxr" interpolation has been chosen.
         4.616326479 "rtsp.c:2896" Connection 1: AP2 PTP connection from 2a02:2455:856e:7500:71fd:4b58:1561:2c75:62798 ("iPhone von Luciano") to self at 2a02:2455:856e:7500::fc39:7000.
         0.637322537 "rtsp.c:3253" Connection 1: SETUP AP2 no Active-Remote information  the SETUP Record.
         0.000038685 "rtsp.c:3272" Connection 1: SETUP AP2 doesn't include DACP-ID string information.
         0.423285426 "rtp.c:2490" Flush completed while play_enabled is true.
         0.797727370 "player.c:2903" Large negative (i.e. early) sync error of -1069 frames (-0.024240 seconds), at frame: 1394452527.
         0.080969888 "player.c:2878" Large positive (i.e. late) sync error of 5481 frames (0.124286 seconds), at frame: 1394457103.
         0.342527111 "player.c:2903" Large negative (i.e. early) sync error of -1050 frames (-0.023810 seconds), at frame: 1394471183.
         0.080981130 "player.c:2878" Large positive (i.e. late) sync error of 5420 frames (0.122902 seconds), at frame: 1394475759.
         0.362421074 "player.c:2903" Large negative (i.e. early) sync error of -854 frames (-0.019365 seconds), at frame: 1394490543.
         0.080947259 "player.c:2878" Large positive (i.e. late) sync error of 4759 frames (0.107914 seconds), at frame: 1394495119.
         0.342375315 "player.c:2903" Large negative (i.e. early) sync error of -843 frames (-0.019116 seconds), at frame: 1394509199.
         0.141553148 "player.c:2878" Large positive (i.e. late) sync error of 4013 frames (0.090998 seconds), at frame: 1394516239.
         0.322116407 "player.c:2903" Large negative (i.e. early) sync error of -811 frames (-0.018390 seconds), at frame: 1394529615.
         0.141401203 "player.c:2878" Large positive (i.e. late) sync error of 3961 frames (0.089819 seconds), at frame: 1394536655.
         0.270179445 "player.c:2878" Large positive (i.e. late) sync error of 3204 frames (0.072653 seconds), at frame: 1394548975.
         0.314145833 "player.c:2903" Large negative (i.e. early) sync error of -838 frames (-0.019002 seconds), at frame: 1394561647.
         0.081008685 "player.c:2878" Large positive (i.e. late) sync error of 4708 frames (0.106757 seconds), at frame: 1394566223.
         0.322123092 "player.c:2903" Large negative (i.e. early) sync error of -1013 frames (-0.022971 seconds), at frame: 1394579599.
         0.080988723 "player.c:2878" Large positive (i.e. late) sync error of 5233 frames (0.118662 seconds), at frame: 1394584175.
         0.362462796 "player.c:2903" Large negative (i.e. early) sync error of -816 frames (-0.018503 seconds), at frame: 1394598959.
         0.080871926 "player.c:2878" Large positive (i.e. late) sync error of 4629 frames (0.104966 seconds), at frame: 1394603535.
         0.310784536 "player.c:2878" Large positive (i.e. late) sync error of 2339 frames (0.053039 seconds), at frame: 1394617615.
         0.261996945 "player.c:2903" Large negative (i.e. early) sync error of -1560 frames (-0.035374 seconds), at frame: 1394628527.
         0.113189833 "player.c:2878" Large positive (i.e. late) sync error of 5257 frames (0.119206 seconds), at frame: 1394633103.
         0.351506833 "player.c:2903" Large negative (i.e. early) sync error of -1484 frames (-0.033651 seconds), at frame: 1394648943.
         0.093019667 "player.c:2878" Large positive (i.e. late) sync error of 5651 frames (0.128141 seconds), at frame: 1394653519.
         0.463876296 "player.c:2903" Large negative (i.e. early) sync error of -860 frames (-0.019501 seconds), at frame: 1394672879.
         0.081085518 "player.c:2878" Large positive (i.e. late) sync error of 4781 frames (0.108413 seconds), at frame: 1394677455.
         0.330532778 "player.c:2903" Large negative (i.e. early) sync error of -1366 frames (-0.030975 seconds), at frame: 1394691535.
         0.101002074 "player.c:2878" Large positive (i.e. late) sync error of 1755 frames (0.039796 seconds), at frame: 1394696111.
         0.233837444 "player.c:2878" Large positive (i.e. late) sync error of 616 frames (0.013968 seconds), at frame: 1394706319.
         0.189858037 "player.c:2878" Large positive (i.e. late) sync error of 2222 frames (0.050385 seconds), at frame: 1394715471.
         0.274161037 "player.c:2903" Large negative (i.e. early) sync error of -983 frames (-0.022290 seconds), at frame: 1394726383.
         0.080937444 "player.c:2878" Large positive (i.e. late) sync error of 5186 frames (0.117596 seconds), at frame: 1394730959.
         0.330517870 "player.c:2878" Large positive (i.e. late) sync error of 2332 frames (0.052880 seconds), at frame: 1394745743.
         0.273923797 "player.c:2903" Large negative (i.e. early) sync error of -1032 frames (-0.023401 seconds), at frame: 1394756655.
         0.081006722 "player.c:2878" Large positive (i.e. late) sync error of 5355 frames (0.121429 seconds), at frame: 1394761231.
         0.362650518 "player.c:2903" Large negative (i.e. early) sync error of -829 frames (-0.018798 seconds), at frame: 1394776015.
         0.080836463 "player.c:2878" Large positive (i.e. late) sync error of 4670 frames (0.105896 seconds), at frame: 1394780591.
         0.322953926 "player.c:2903" Large negative (i.e. early) sync error of -972 frames (-0.022041 seconds), at frame: 1394793967.
         0.080887277 "player.c:2878" Large positive (i.e. late) sync error of 5212 frames (0.118186 seconds), at frame: 1394798543.
         0.362846982 "player.c:2903" Large negative (i.e. early) sync error of -1116 frames (-0.025306 seconds), at frame: 1394813679.
         0.080905240 "player.c:2878" Large positive (i.e. late) sync error of 5633 frames (0.127732 seconds), at frame: 1394818255.
         0.362657908 "player.c:2903" Large negative (i.e. early) sync error of -915 frames (-0.020748 seconds), at frame: 1394833039.
         0.080751814 "player.c:2878" Large positive (i.e. late) sync error of 4951 frames (0.112268 seconds), at frame: 1394837615.
         0.310123833 "player.c:2903" Large negative (i.e. early) sync error of -1629 frames (-0.036939 seconds), at frame: 1394850991.
         0.112942889 "player.c:2878" Large positive (i.e. late) sync error of 6032 frames (0.136780 seconds), at frame: 1394855567.
         0.362979185 "player.c:2903" Large negative (i.e. early) sync error of -1058 frames (-0.023991 seconds), at frame: 1394871407.
         0.081278352 "player.c:2878" Large positive (i.e. late) sync error of 5389 frames (0.122200 seconds), at frame: 1394875983.
         0.362821778 "player.c:2903" Large negative (i.e. early) sync error of -835 frames (-0.018934 seconds), at frame: 1394890767.
         0.080952314 "player.c:2878" Large positive (i.e. late) sync error of 4694 frames (0.106440 seconds), at frame: 1394895343.
         0.431471241 "player.c:2903" Large negative (i.e. early) sync error of -1470 frames (-0.033333 seconds), at frame: 1394913999.
         0.113032648 "player.c:2903" Large negative (i.e. early) sync error of -1062 frames (-0.024082 seconds), at frame: 1394918575.
         0.089110537 "player.c:2878" Large positive (i.e. late) sync error of 7894 frames (0.179002 seconds), at frame: 1394923151.
         0.362556407 "player.c:2878" Large positive (i.e. late) sync error of 2530 frames (0.057370 seconds), at frame: 1394939343.
         0.253669167 "player.c:2878" Large positive (i.e. late) sync error of 2668 frames (0.060499 seconds), at frame: 1394950255.
         0.282345129 "player.c:2903" Large negative (i.e. early) sync error of -804 frames (-0.018231 seconds), at frame: 1394961871.
         0.080835963 "player.c:2878" Large positive (i.e. late) sync error of 4583 frames (0.103923 seconds), at frame: 1394966447.
         0.310830241 "player.c:2878" Large positive (i.e. late) sync error of 1572 frames (0.035646 seconds), at frame: 1394980527.
         0.233830777 "player.c:2878" Large positive (i.e. late) sync error of 2579 frames (0.058481 seconds), at frame: 1394990383.
         0.282110963 "player.c:2903" Large negative (i.e. early) sync error of -904 frames (-0.020499 seconds), at frame: 1395001999.
         0.080725074 "player.c:2878" Large positive (i.e. late) sync error of 4913 frames (0.111406 seconds), at frame: 1395006575.
         0.302077685 "player.c:2878" Large positive (i.e. late) sync error of 3099 frames (0.070272 seconds), at frame: 1395019951.
         0.290369204 "player.c:2878" Large positive (i.e. late) sync error of 2317 frames (0.052540 seconds), at frame: 1395032975.
         0.274066407 "player.c:2903" Large negative (i.e. early) sync error of -1020 frames (-0.023129 seconds), at frame: 1395043887.
         0.081077241 "player.c:2878" Large positive (i.e. late) sync error of 5316 frames (0.120544 seconds), at frame: 1395048463.
         0.331058722 "player.c:2878" Large positive (i.e. late) sync error of 3805 frames (0.086281 seconds), at frame: 1395063247.
         0.303367648 "player.c:2878" Large positive (i.e. late) sync error of 3456 frames (0.078367 seconds), at frame: 1395076623.
         0.423779684 "player.c:2903" Large negative (i.e. early) sync error of -1466 frames (-0.033243 seconds), at frame: 1395094575.
         0.093197611 "player.c:2878" Large positive (i.e. late) sync error of 5524 frames (0.125261 seconds), at frame: 1395099151.
         0.342409111 "player.c:2903" Large negative (i.e. early) sync error of -912 frames (-0.020680 seconds), at frame: 1395113231.
         0.080806074 "player.c:2878" Large positive (i.e. late) sync error of 4945 frames (0.112132 seconds), at frame: 1395117807.
         0.322490222 "player.c:2903" Large negative (i.e. early) sync error of -1076 frames (-0.024399 seconds), at frame: 1395131183.
         0.080851834 "player.c:2878" Large positive (i.e. late) sync error of 6656 frames (0.150930 seconds), at frame: 1395135759.
         0.382783962 "player.c:2903" Large negative (i.e. early) sync error of -1047 frames (-0.023741 seconds), at frame: 1395151599.
         0.080890852 "player.c:2878" Large positive (i.e. late) sync error of 5401 frames (0.122472 seconds), at frame: 1395156175.
         0.362574741 "player.c:2903" Large negative (i.e. early) sync error of -851 frames (-0.019297 seconds), at frame: 1395170959.
         0.081037092 "player.c:2878" Large positive (i.e. late) sync error of 4750 frames (0.107710 seconds), at frame: 1395175535.
         0.322250278 "player.c:2903" Large negative (i.e. early) sync error of -1017 frames (-0.023061 seconds), at frame: 1395188911.
         0.080843444 "player.c:2878" Large positive (i.e. late) sync error of 5299 frames (0.120159 seconds), at frame: 1395193487.
         0.362216333 "player.c:2903" Large negative (i.e. early) sync error of -838 frames (-0.019002 seconds), at frame: 1395208271.
         0.080913130 "player.c:2878" Large positive (i.e. late) sync error of 4701 frames (0.106599 seconds), at frame: 1395212847.

System Information.

Linux raspberrypi 6.1.77-v8-16k+ #1730 SMP PREEMPT Thu Feb  8 15:30:42 GMT 2024 aarch64 GNU/Linux

Model       : Raspberry Pi 5 Model B Rev 1.0
Revision    : d04170

card 0: sndrpihifiberry [snd_rpi_hifiberry_dacplus], device 0: HiFiBerry DAC+ Pro HiFi pcm512x-hifi-0 [HiFiBerry DAC+ Pro HiFi pcm512x-hifi-0]

Configuration Information.

$ shairport-sync --displayConfig 
>> Display Config Start.

From "uname -a":
 Linux raspberrypi 6.1.77-v8-16k+ #1730 SMP PREEMPT Thu Feb  8 15:30:42 GMT 2024 aarch64 GNU/Linux

From /etc/os-release:
 Debian GNU/Linux 12 (bookworm)

From /sys/firmware/devicetree/base/model:
 Raspberry Pi 5 Model B Rev 1.0

Shairport Sync Version String:
 4.3.4-1-g910264e5-AirPlay2-smi10-alac-OpenSSL-Avahi-ALSA-jack-soxr-sysconfdir:/etc

Command Line:
 shairport-sync --displayConfig

Configuration File:
 /etc/shairport-sync.conf

Configuration File Settings:
 general : 
 {
   name = "Luc Soundsystem";
   output_backend = "jack";
   audio_backend_buffer_desired_length_in_seconds = 0.05;
   resync_threshold_in_seconds = 0.01;
   volume_control_profile = "dasl_tapered";
   ignore_volume_control = "yes";
 };
 pw : 
 {
 };
 jack : 
 {
   soxr_resample_quality = "quick";
 };

>> Display Config End.
>> Goodbye!

PulseAudio or PipeWire installed?

How did you install Shairport Sync?

Built from source

Check previous issues

lucianoiam commented 1 day ago

Also tried various buffer sizes for the JACK server, from 16 (works for 44k1) up to 512.