mikebrady / shairport-sync

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

[Problem]: SPS on Mac crashing when trying to play audio #1752

Closed Badsheep closed 10 months ago

Badsheep commented 1 year ago

What happened?

Hello,

I use Shairportsync on Mac OS. I installed it with home-brew (following this guide).

I was using SPS v4.2, and I had a little bug that I was hoping to resolve by upgrading to the last version... Unfortunately since I upgraded it to v4.3.2, it doesn't work at all anymore : when Shairportsync is launched, it appears normaly on my others devices, I can connect to it, but at the moment I press play the app crashes, and/or disappears from the airport available on my playing device. Any help ? Thanks !

Relevant log output

No response

System Information.

Hardware : NUC with mackintosh, Mac OS 11.7.7.

Configuration Information.

From "uname -a":
 Darwin Mac-Infame.local 20.6.0 Darwin Kernel Version 20.6.0: Mon Apr 24 23:00:57 PDT 2023; root:xnu-7195.141.49.701.3~1/RELEASE_X86_64 x86_64

Shairport Sync Version String:
 4.3.2-libdaemon-OpenSSL-dns_sd-ao-pa-stdout-pipe-soxr-metadata-sysconfdir:/usr/local/etc/shairport-sync

Command Line:
 /usr/local/opt/shairport-sync/bin/shairport-sync --displayConfig

Configuration File:
 /usr/local/etc/shairport-sync/shairport-sync.conf

Configuration File Settings:
 general : 
 {
   name = "Enceintes du buffet";
   volume_range_db = 60;
 };
 sessioncontrol : 
 {
   allow_session_interruption = "yes";
   session_timeout = 120;
 };

>> Display Config End.
>> Goodbye!

PulseAudio or PipeWire installed?

How did you install Shairport Sync?

Homebrew for Mac

Check previous issues

mikebrady commented 1 year ago

Thanks for the post. I'll take a look.

Badsheep commented 1 year ago

Thanks ! I don't know how to do the log file, but if needed I can search.

mikebrady commented 1 year ago

Thanks. The guide you mentioned seems to install shairport-sync from an archive. Is that how you installed it, or did you build it yourself?

Badsheep commented 1 year ago

I'm not sure to understand... I had home-brew installed before, so I just did : $ brew install shairport-sync

Then it installed automatically... When I did it, it installed the 4.2 version (I presume it was the up-to-date version at that time)

When I upgraded, I did : $ brew upgrade shairport-sync

mikebrady commented 1 year ago

Thanks.

mikebrady commented 1 year ago

I have a hunch the problem may be with PulseAudio. Now, this may not be the right command, I'm afraid, but could you try:

$ shairport-sync -V

...and post whatever it comes back with, if anything, please? If it works, you should get something like:

4.3.2-libdaemon-OpenSSL-dns_sd-ao-pa-stdout-pipe-soxr-metadata-sysconfdir:/usr/local/etc/shairport-sync

If you do get something like that, could you (1) make sure shairport-sync isn't running already in the background and (2) try the following, please?

$ shairport-sync -v --statistics -o ao

That should give lots of diagnostics and should then pause. You could then try playing something.

Badsheep commented 1 year ago

Hi,

The first command you asked works and I get the line you said. Then I launched Shairport using :

/usr/local/opt/shairport-sync/bin/shairport-sync -v --statistics -o ao -- -n 'MIO Airplay'

("MIO Airplay" is a virtual audio device that feeds my sound card. It was working perfectly well before the 4.2 to 4.3.2 upgrade.)

And I get :

0.000972400 "shairport.c:2255" Startup in classic Airplay (aka "AirPlay 1") mode.
         0.000055828 "shairport.c:2291" Version String: "4.3.2-libdaemon-OpenSSL-dns_sd-ao-pa-stdout-pipe-soxr-metadata-sysconfdir:/usr/local/etc/shairport-sync"
         0.000007674 "shairport.c:2310" Command Line: "/usr/local/opt/shairport-sync/bin/shairport-sync -v --statistics -o ao -- -n MIO Airplay".
         0.000005381 "shairport.c:2346" Log Verbosity is 1.
         0.004636467 "shairport.c:2394" disable_resend_requests is off.
         0.000018748 "shairport.c:2398" diagnostic_drop_packet_fraction is 0.000000. A value of 0.0 means no packets will be dropped deliberately.
         0.000005195 "shairport.c:2399" statistics_requester status is 1.
         0.000003758 "shairport.c:2401" daemon status is 0.
         0.000004096 "shairport.c:1567" PID file: "/usr/local/var/run/shairport-sync.pid".
         0.000017026 "shairport.c:2402" daemon pid file path is "/usr/local/var/run/shairport-sync.pid".
         0.000002897 "shairport.c:2404" rtsp listening port is 5000.
         0.000002608 "shairport.c:2405" udp base port is 6001.
         0.000016879 "shairport.c:2406" udp port range is 10.
         0.000003087 "shairport.c:2407" player name is "Enceintes du buffet".
         0.000003023 "shairport.c:2408" backend is "ao".
         0.000003011 "shairport.c:2409" run_this_before_play_begins action is "(null)".
         0.000003191 "shairport.c:2410" run_this_after_play_ends action is "(null)".
         0.000003049 "shairport.c:2411" wait-cmd status is 0.
         0.000003001 "shairport.c:2412" run_this_before_play_begins may return output is 0.
         0.000003047 "shairport.c:2414" run_this_if_an_unfixable_error_is_detected action is "(null)".
         0.000003393 "shairport.c:2416" run_this_before_entering_active_state action is  "(null)".
         0.000003155 "shairport.c:2418" run_this_after_exiting_active_state action is  "(null)".
         0.000003060 "shairport.c:2419" active_state_timeout is  10.000000 seconds.
         0.000005725 "shairport.c:2420" mdns backend "(null)".
         0.000003291 "shairport.c:2425" interpolation setting is "auto".
         0.000003011 "shairport.c:2426" interpolation soxr_delay_threshold is 30000000.
         0.000003077 "shairport.c:2427" resync time is 0.050000 seconds.
         0.000003164 "shairport.c:2428" resync recovery time is 0.100000 seconds.
         0.000003279 "shairport.c:2429" allow a session to be interrupted: 1.
         0.000002951 "shairport.c:2430" busy timeout time is 120.
         0.000002934 "shairport.c:2431" drift tolerance is 0.002000 seconds.
         0.000003115 "shairport.c:2432" password is "(null)".
         0.000003036 "shairport.c:2433" default airplay volume is: -24.000000.
         0.000003455 "shairport.c:2434" high threshold airplay volume is: -16.000000.
         0.000003301 "shairport.c:2436" check for higher-than-threshold volume for new play session is disabled.
         0.000003263 "shairport.c:2442" ignore_volume_control is 0.
         0.000003095 "shairport.c:2446" volume_max_db is not set
         0.000002876 "shairport.c:2448" volume range in dB (zero means use the range specified by the mixer): 60.
         0.000003449 "shairport.c:2452" volume_range_combined_hardware_priority (1 means hardware mixer attenuation is used first) is 0.
         0.000003397 "shairport.c:2454" playback_mode is 0 (0-stereo, 1-mono, 1-reverse_stereo, 2-both_left, 3-both_right).
         0.000003406 "shairport.c:2455" disable_synchronization is 0.
         0.000002881 "shairport.c:2456" use_mmap_if_available is 1.
         0.000002956 "shairport.c:2458" output_format automatic selection is enabled.
         0.000004462 "shairport.c:2462" output_rate automatic selection is enabled.
         0.000004562 "shairport.c:2466" audio backend desired buffer length is 1.000000 seconds.
         0.000005033 "shairport.c:2468" audio_backend_buffer_interpolation_threshold_in_seconds is 0.000000 seconds.
         0.000018761 "shairport.c:2469" audio backend latency offset is 0.000000 seconds.
         0.000023307 "shairport.c:2471" audio backend silence lead-in time is "auto".
         0.000003182 "shairport.c:2475" zeroconf regtype is "_raop._tcp".
         0.000016967 "shairport.c:2476" decoders_supported field is 1.
         0.000003367 "shairport.c:2477" use_apple_decoder is 0.
         0.000003077 "shairport.c:2478" alsa_use_hardware_mute is 0.
         0.000002973 "shairport.c:2482" no special mdns service interface was requested.
         0.000071744 "shairport.c:2486" configuration file name "/usr/local/etc/shairport-sync/shairport-sync.conf" resolves to "/usr/local/etc/shairport-sync/shairport-sync.conf".
         0.000008274 "shairport.c:2492" metadata enabled is 1.
         0.000004539 "shairport.c:2493" metadata pipename is "/tmp/shairport-sync-metadata".
         0.000004524 "shairport.c:2495" metadata socket address is "(null)" port 0.
         0.000004670 "shairport.c:2496" metadata socket packet size is "500".
         0.000004594 "shairport.c:2497" get-coverart is 1.
         0.000003793 "shairport.c:2515" loudness is 0.
         0.000002986 "shairport.c:2516" loudness reference level is -20.000000
         0.002866467 "rtsp.c:4193" metadata pipe name is "/tmp/shairport-sync-metadata".
         0.000238150 "rtsp.c:434" Error locking for pc_queue_add_item
         0.000038459 "rtsp.c:434" Error locking for pc_queue_add_item
         0.000007774 "rtsp.c:420" Error unlocking for pc_queue_add_item or pc_queue_get_item.
         0.000007183 "rtsp.c:434" Error locking for pc_queue_add_item
         0.000005094 "rtsp.c:420" Error unlocking for pc_queue_add_item or pc_queue_get_item.
         0.000006246 "rtsp.c:434" Error locking for pc_queue_add_item
         0.000004926 "rtsp.c:420" Error unlocking for pc_queue_add_item or pc_queue_get_item.
         1.497479515 "shairport.c:259" "soxr" interpolation has been chosen.

Shairport is launched and appears on my iPhone's Airplay available list... I play music on the iPhone, and when I select the airplay I've got the error :

ao_macosx ERROR: Driver macosx unable to set option dev=MIO Airplay
ao_macosx ERROR: Driver macosx unable to set option dev=MIO Airplay
ao_macosx ERROR: Driver macosx unable to set option dev=MIO Airplay
zsh: segmentation fault  /usr/local/opt/shairport-sync/bin/shairport-sync -v --statistics -o ao -- -n 
Badsheep commented 1 year ago

To test I did : /usr/local/opt/shairport-sync/bin/shairport-sync -v --statistics -o ao

So that Shairport plays in the default audio of the system... and it works.

So it seems that it's the 'MIO Airplay' (an aggregate device created on Mac OS) that isn't working anymore...

mikebrady commented 1 year ago

Thanks. I'm afraid I do not know anything about the 'MIO Airplay' device...

Badsheep commented 1 year ago

No it's a name I invented ;) It's just an aggregate device created in Mac OS that allows me that SPS outputs in the 19-20 input of my souncard instead of the default 1-2...

Badsheep commented 1 year ago

In your conf file I can read :

// There are no configuration file parameters for the "ao" audio back end. No interpolation is done.
// To include support for the "ao" backend, Shairport Sync must be built with the following configuration flag:
// --with-ao

Maybe the new version provided by homebrew doesn't include that "ao" backend... Would it be a way to check that ?

EDIT. NO I'm wrong, in the log it's written : 0.000003366 "shairport.c:2408" backend is "ao".

So it must work. It's only my aggregate device that was working before and doesn't work anymore... I don't understand why. I tested it with other audio application that virtual device works.

mikebrady commented 1 year ago

Thanks. The last update to the ao backend was 5 months ago to specify the channel ordering. Is it possible you need to change the specification of your virtual device? Please see also the discussion here.

Badsheep commented 1 year ago

I think I understood ! Sorry for the waste of time... I forgot that Libao is bugged since years and that a guy gave me a workaround here... Probably upgrading Shairport-sync erased the workaround so I have to do it again... I'll test that and let you know.

Badsheep commented 1 year ago

Yes it works ! Sorry for having such a bad memory... And to anyone who would like be able to select a device in Mac OS, please follow the link above. Thank you for your work and your help, Mike Brady !!

mikebrady commented 1 year ago

Many thanks. You’re right — it’s good to record this for others.

github-actions[bot] commented 10 months ago

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