mikebrady / shairport-sync

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

No sound with shairport on Raspberry Pi 4 #1121

Closed mbundes closed 3 years ago

mbundes commented 3 years ago

When shairport is started on Pi, sound redirected from my MacBook Pro or Iphone to the shairport server running on Pi, I cannot hear sound. Spotify on Home Assistant server work correctly.

`$ shairport-sync -vvu
0.000089001 "shairport.c:461" looking for configuration file at full path "/etc/shairport-sync.conf"
0.000948844 "shairport.c:1729" Started!
0.000661841 "shairport.c:1756" software version: "3.3.8rc1-OpenSSL-Avahi-ALSA-soxr-sysconfdir:/etc"
0.000033612 "shairport.c:1762" log verbosity is 2.
0.000053797 "audio_alsa.c:998" alsa: init() -- alsa_backend_state => abm_disconnected.
0.000019500 "audio_alsa.c:1015" alsa: alsa_maximum_stall_time of 0.200000 sec.
0.000034482 "audio_alsa.c:1302" alsa: disable_standby_mode is "never".
0.000015852 "audio_alsa.c:1304" alsa: disable_standby_mode_silence_threshold is 0.040000 seconds.
0.000017426 "audio_alsa.c:1306" alsa: disable_standby_mode_silence_scan_interval is 0.004000 seconds.
0.000043167 "audio_alsa.c:1345" alsa: output device name is "default".
0.000150039 "shairport.c:1777" The processor is running little-endian.
0.000023759 "shairport.c:1810" disable resend requests is off.
0.000010315 "shairport.c:1814" diagnostic_drop_packet_fraction is 0.000000. A value of 0.0 means no packets will be dropped deliberately.
0.000004686 "audio_alsa.c:1943" keep_dac_busy is now "no"
0.000016055 "shairport.c:1815" statistics_requester status is 0.
0.000055334 "shairport.c:1820" rtsp listening port is 5000.
0.000015574 "shairport.c:1821" udp base port is 6001.
0.000013778 "shairport.c:1822" udp port range is 10.
0.000013408 "shairport.c:1823" player name is "Колонки на кухне1".
0.000013667 "shairport.c:1824" backend is "alsa".
0.000014704 "shairport.c:1825" run_this_before_play_begins action is "(null)".
0.000015222 "shairport.c:1826" run_this_after_play_ends action is "(null)".
0.000015389 "shairport.c:1827" wait-cmd status is 0.
0.000013519 "shairport.c:1828" run_this_before_play_begins may return output is 0.
0.000013593 "shairport.c:1829" run_this_if_an_unfixable_error_is_detected action is "(null)".
0.000013629 "shairport.c:1830" run_this_before_entering_active_state action is  "(null)".
0.000013408 "shairport.c:1831" run_this_after_exiting_active_state action is  "(null)".
0.000013463 "shairport.c:1832" active_state_timeout is  10.000000 seconds.
0.000015741 "shairport.c:1833" mdns backend "(null)".
0.000013408 "shairport.c:1834" userSuppliedLatency is 0.
0.000015611 "shairport.c:1837" interpolation setting is "auto".
0.000016019 "shairport.c:1838" interpolation soxr_delay_threshold is 30.
0.000015074 "shairport.c:1839" resync time is 0.050000 seconds.
0.000015778 "shairport.c:1840" allow a session to be interrupted: 0.
0.000013722 "shairport.c:1841" busy timeout time is 120.
0.000014630 "shairport.c:1842" drift tolerance is 0.001995 seconds.
0.000014870 "shairport.c:1843" password is "(null)".
0.000013352 "shairport.c:1844" ignore_volume_control is 0.
0.000014204 "shairport.c:1848" volume_max_db is not set
0.000014834 "shairport.c:1850" volume range in dB (zero means use the range specified by the mixer): 60.
0.000014389 "shairport.c:1854" volume_range_combined_hardware_priority (1 means hardware mixer attenuation is used first) is 0.
0.000015556 "shairport.c:1856" playback_mode is 0 (0-stereo, 1-mono, 1-reverse_stereo, 2-both_left, 3-both_right).
0.000014278 "shairport.c:1857" disable_synchronization is 0.
0.000014685 "shairport.c:1858" use_mmap_if_available is 1.
0.000014519 "shairport.c:1860" output_format automatic selection is enabled.
0.000058797 "shairport.c:1864" output_rate automatic selection is enabled.
0.000017667 "shairport.c:1868" audio backend desired buffer length is 0.200000 seconds.
0.000016444 "shairport.c:1870" audio_backend_buffer_interpolation_threshold_in_seconds is 0.120000 seconds.
0.000016741 "shairport.c:1871" audio backend latency offset is 0.000000 seconds.
0.000014574 "shairport.c:1873" audio backend silence lead-in time is "auto".
0.000014723 "shairport.c:1877" zeroconf regtype is "_raop._tcp".
0.000013611 "shairport.c:1878" decoders_supported field is 1.
0.000014167 "shairport.c:1879" use_apple_decoder is 0.
0.000015889 "shairport.c:1880" alsa_use_hardware_mute is 0.
0.000014759 "shairport.c:1884" no special mdns service interface was requested.
0.000039149 "shairport.c:1888" configuration file name "/etc/shairport-sync.conf" resolves to "/etc/shairport-sync.conf".
0.000087945 "shairport.c:1917" loudness is 0.
0.000017982 "shairport.c:1918" loudness reference level is -20.000000
0.000740787 "rtsp.c:2896" unable to listen on IPv4 port 5000. The error is: "Address already in use".
0.000070223 "rtsp.c:2896" unable to listen on IPv6 port 5000. The error is: "Address already in use".
0.000024204 "rtsp.c:3028" *fatal error: could not establish a service on port 5000 -- program terminating. Is another instance of Shairport Sync running on this device?
0.000023981 "shairport.c:1424" emergency exit`
sudo shairport-sync -h
hardware output devices:
      "hw:b1"
      "hw:Headphones"
mikebrady commented 3 years ago

Thanks for the post. In the log above, it looks like Shairport Sync is already running as a daemon -- it's using port 5000.

Shairport Sync is set to output to the default device. If you haven't changed the alsa defaults, that may be the headphone jack or the HDMI output. (I never change the alsa settings and In my experience, the default is always the headphone jack.) However, as set up, Shairport Sync does not control the hardware mixer (i.e. the hardware volume control), so it is possible that all you need to do is turn up the mixer level on the default output card. You can use alsamixer for that. When you get it going, you can hook the mixer control up to Shairport Sync.

mbundes commented 3 years ago

Thanks for your answer. 5000 port use for Home Assistant. Yes, I need jack connection. Can we change port here? Can you give me simple instructions? 😊 Thanks

mikebrady commented 3 years ago

You can change port in the configuration file, sure.

mbundes commented 3 years ago

Only change port in config? 😳

mikebrady commented 3 years ago

Also on the command line.

mbundes commented 3 years ago

Changed the port three times. The service was restarted. The error is the same.

$ shairport-sync -vvu
0.000144720 "shairport.c:461" looking for configuration file at full path "/etc/shairport-sync.conf"
0.001887653 "shairport.c:1729" Started!
0.000314625 "shairport.c:1756" software version: "3.3.8rc1-OpenSSL-Avahi-ALSA-soxr-sysconfdir:/etc"
0.000290754 "shairport.c:1762" log verbosity is 2.
0.000248848 "audio_alsa.c:998" alsa: init() -- alsa_backend_state => abm_disconnected.
0.000212126 "audio_alsa.c:1015" alsa: alsa_maximum_stall_time of 0.200000 sec.
0.000241422 "audio_alsa.c:1302" alsa: disable_standby_mode is "never".
0.000035777 "audio_alsa.c:1304" alsa: disable_standby_mode_silence_threshold is 0.040000 seconds.
0.000207496 "audio_alsa.c:1306" alsa: disable_standby_mode_silence_scan_interval is 0.004000 seconds.
        0.000371883 "audio_alsa.c:1345" alsa: output device name is "hw:Headphones".
        0.000391586 "shairport.c:1777" The processor is running little-endian.
        0.000046369 "shairport.c:1810" disable resend requests is off.
        0.000042870 "audio_alsa.c:1943" keep_dac_busy is now "no"
        0.000036574 "shairport.c:1814" diagnostic_drop_packet_fraction is 0.000000. A value of 0.0 means no packets will be dropped deliberately.
        0.000272365 "shairport.c:1815" statistics_requester status is 0.
        0.000154998 "shairport.c:1820" rtsp listening port is 5025.
        0.000149979 "shairport.c:1821" udp base port is 6001.
        0.000150923 "shairport.c:1822" udp port range is 10.
        0.000149349 "shairport.c:1823" player name is "Колонки на кухне".
        0.000146109 "shairport.c:1824" backend is "alsa".
        0.000148164 "shairport.c:1825" run_this_before_play_begins action is "(null)". 
        0.000144701 "shairport.c:1826" run_this_after_play_ends action is "(null)".
        0.000149091 "shairport.c:1827" wait-cmd status is 0.
        0.000149793 "shairport.c:1828" run_this_before_play_begins may return output is 0.
        0.000144942 "shairport.c:1829" run_this_if_an_unfixable_error_is_detected action is "(null)".
        0.000149442 "shairport.c:1830" run_this_before_entering_active_state action is  "(null)".
        0.000151090 "shairport.c:1831" run_this_after_exiting_active_state action is  "(null)".
        0.000472733 "shairport.c:1832" active_state_timeout is  10.000000 seconds.
        0.000038481 "shairport.c:1833" mdns backend "(null)".
        0.000149534 "shairport.c:1834" userSuppliedLatency is 0.
        0.000162887 "shairport.c:1837" interpolation setting is "auto".
        0.000147219 "shairport.c:1838" interpolation soxr_delay_threshold is 30.
        0.000026518 "shairport.c:1839" resync time is 0.050000 seconds.
        0.000153072 "shairport.c:1840" allow a session to be interrupted: 0.
        0.000033721 "shairport.c:1841" busy timeout time is 120.
        0.000026185 "shairport.c:1842" drift tolerance is 0.001995 seconds.
        0.000026852 "shairport.c:1843" password is "(null)".
        0.000025147 "shairport.c:1844" ignore_volume_control is 0.
        0.000222441 "shairport.c:1848" volume_max_db is not set
        0.000033018 "shairport.c:1850" volume range in dB (zero means use the range specified by the mixer): 60.
        0.000147738 "shairport.c:1854" volume_range_combined_hardware_priority (1 means hardware mixer attenuation is used first) is 0.
        0.000162016 "shairport.c:1856" playback_mode is 0 (0-stereo, 1-mono, 1-reverse_stereo, 2-both_left, 3-both_right).
        0.000158886 "shairport.c:1857" disable_synchronization is 0.
        0.000032685 "shairport.c:1858" use_mmap_if_available is 1.
        0.000144627 "shairport.c:1860" output_format automatic selection is enabled.
        0.000148220 "shairport.c:1864" output_rate automatic selection is enabled.
        0.000147997 "shairport.c:1868" audio backend desired buffer length is 0.200000 seconds.
        0.000154646 "shairport.c:1870" audio_backend_buffer_interpolation_threshold_in_seconds is 0.120000 seconds.
        0.000181293 "shairport.c:1871" audio backend latency offset is 0.000000 seconds.
        0.000157146 "shairport.c:1873" audio backend silence lead-in time is "auto".
        0.000027018 "shairport.c:1877" zeroconf regtype is "_raop._tcp".
        0.000026203 "shairport.c:1878" decoders_supported field is 1.
        0.000025481 "shairport.c:1879" use_apple_decoder is 0.
        0.000025333 "shairport.c:1880" alsa_use_hardware_mute is 0.
        0.000024981 "shairport.c:1884" no special mdns service interface was requested.
        0.000063628 "shairport.c:1888" configuration file name "/etc/shairport-sync.conf" resolves to "/etc/shairport-sync.conf".
        0.000032759 "shairport.c:1917" loudness is 0.
        0.000025833 "shairport.c:1918" loudness reference level is -20.000000
        0.001419735 "rtsp.c:2896" unable to listen on IPv4 port 5025. The error is: "Address already in use".
        0.000112332 "rtsp.c:2896" unable to listen on IPv6 port 5025. The error is: "Address already in use".
        0.000221552 "rtsp.c:3028" *fatal error: could not establish a service on port 5025 -- program terminating. Is another instance of Shairport Sync running on this device?
        0.000041110 "shairport.c:1424" emergency exit
mikebrady commented 3 years ago

Is Shairport Sync also running as a daemon? (See above.)

mbundes commented 3 years ago

$ sudo service shairport-sync restart done

How else to check?

mikebrady commented 3 years ago

Thanks. I'm afraid you'll have to educate yourself about standard Linux techniques -- that's not really our role.

mbundes commented 3 years ago

Thanks for your cooperation

github-actions[bot] commented 3 years ago

This issue has been inactive for 60 days so will be closed 7 days from now. To prevent this, please remove the "stale" label or post a comment.