mikebrady / shairport-sync

AirPlay and AirPlay 2 audio player
Other
7.17k stars 569 forks source link

Shairport returns "Aborted" whenever a Command is Entered #927

Closed sonich2401 closed 3 years ago

sonich2401 commented 4 years ago

Hello, currently im working on a project that enables me to take input via. Shairport and broadcast the music to my brother's fm radio. I planed on doing this by sending the raw data via. Stdout to sox so that it can convert to a lower sample rate and mono, then broadcasting that stream through a Fm Transmitter program (https://github.com/markondej/fm_transmitter). Fm_transmitter supports wav and stream files that are 22050 sample rate or lower so that's why i have to convert it. The full command line for this is

/shairport-sync/shairport-sync -a "Name" -o stdout | sox -t raw -r 22050 -b 16 -c 1 -L -e signed-integer - -t wav - | sudo ./Desktop/Radio/fm_transmitter/fm_transmitter -f 92.7-

To build Shairport I first used the pre-made command line

./configure --sysconfdir=/etc --with-alsa --with-pa --with-avahi --with-ssl=openssl --with-metadata --with-soxr --with-systemd

and proceeded to also add to that command the options for pipe and stdout. however after i built the program and typed in the command line for the fm transmitter everything freezes and nothing is printed (except for a sox error witch is not detrimental). So i checked by doing /shairport-sync/shairport-sync -a "name" and it returns Aborted The only command the shairport is able to accept is shairport-sync/shairport-sync -h. No matter how many times i edit the config file this always occurs. I tried the abrasive version of shairport but it doesn't support stdout just pipe. However it had the pipe option so i tried this on both versions. Stdout is accepted by fm_transmitter and if you convert the fifo file to wav during the lowering in sample rate a fifo file should work but it doesn't.

After much testing and searching online it seems that fm_transmitter and the conversion are working fine im just having troubles with shairport. I forgot to mention that abrasive shairport is able to start for me but doesn't work when using pipe. Its alright if you don't know whats wrong I just thought that this would be a nice project to tinker with. In advance, Thanks a million!

mikebrady commented 4 years ago

Thanks for the post. Could you post the output from:

$ shairport-sync -V

please? (That’s an uppercase “V”.)

mikebrady commented 4 years ago

Also, it might be worth setting the verbosity of the log to 1 and see if anything interesting shows up. (Alternatively, if you’re running Shairport Sync from the command line, include the options -vu.)

artenverho commented 4 years ago

Hi Mike,

I have the sam issue on an arm based device running debian:

 0.002420788 "shairport.c:1621" Started!
         0.001002092 "shairport.c:1633" software version: "3.3.4-OpenSSL-Avahi-ALSA-soxr-metadata-sysconfdir:/etc"
         0.000379061 "shairport.c:1639" log verbosity is 1.
         0.000284639 "audio_alsa.c:1018" alsa: alsa_maximum_stall_time of 0.200000 sec.
         0.000265638 "audio_alsa.c:1165" alsa output rate is 44100 frames per second
         0.000427730 "audio_alsa.c:1303" alsa: disable_standby_mode is "never".
         0.000634574 "audio_alsa.c:1305" alsa: disable_standby_mode_silence_threshold is 0.040000 seconds.
         0.000425730 "audio_alsa.c:1307" alsa: disable_standby_mode_silence_scan_interval is 0.004000 seconds.
         0.000277639 "audio_alsa.c:1346" alsa: output device name is "default".
         0.000562278 "shairport.c:1687" disable resend requests is off.
         0.000886378 "shairport.c:1690" diagnostic_drop_packet_fraction is 0.000000. A value of 0.0 means no packets will be dropped deliberately.
         0.000276055 "shairport.c:1691" statistics_requester status is 0.
         0.000617656 "shairport.c:1696" rtsp listening port is 5000.
         0.000361602 "shairport.c:1697" udp base port is 6001.
         0.000521609 "shairport.c:1698" udp port range is 10.
         0.000144758 "shairport.c:1699" player name is "Marantz".
         0.000166300 "shairport.c:1700" backend is "(null)".
         0.000064920 "shairport.c:1701" run_this_before_play_begins action is "(null)".
         0.000057002 "shairport.c:1702" run_this_after_play_ends action is "(null)".
         0.000059212 "shairport.c:1703" wait-cmd status is 0.
         0.000060044 "shairport.c:1704" run_this_before_play_begins may return output is 0.
         0.000053920 "shairport.c:1705" run_this_if_an_unfixable_error_is_detected action is "(null)".
         0.000368935 "shairport.c:1706" run_this_before_entering_active_state action is  "(null)".
         0.000143341 "shairport.c:1707" run_this_after_exiting_active_state action is  "(null)".
         0.000076837 "shairport.c:1708" active_state_timeout is  10.000000 seconds.
         0.000072795 "shairport.c:1709" mdns backend "avahi".
         0.000055545 "shairport.c:1713" interpolation setting is "soxr".
         0.000052252 "shairport.c:1714" interpolation soxr_delay_threshold is 30.
         0.000076546 "shairport.c:1715" resync time is 0.050000 seconds.
         0.000067378 "shairport.c:1716" allow a session to be interrupted: 1.
         0.000068337 "shairport.c:1717" busy timeout time is 120.
         0.000054878 "shairport.c:1718" drift tolerance is 0.001995 seconds.
         0.000076378 "shairport.c:1719" password is "(null)".
         0.000055045 "shairport.c:1720" ignore_volume_control is 0.
         0.000086421 "shairport.c:1724" volume_max_db is not set
         0.000053586 "shairport.c:1726" volume range in dB (zero means use the range specified by the mixer): 0.
         0.000070920 "shairport.c:1729" volume_range_combined_hardware_priority (1 means hardware mixer attenuation is used first) is 0.
         0.000057503 "shairport.c:1731" playback_mode is 0 (0-stereo, 1-mono, 1-reverse_stereo, 2-both_left, 3-both_right).
         0.000056920 "shairport.c:1732" disable_synchronization is 0.
         0.000257971 "shairport.c:1733" use_mmap_if_available is 1.
         0.000150757 "shairport.c:1735" output_format automatic selection is disabled.
         0.000080379 "shairport.c:1737" output_format is "S24".
         0.000379311 "shairport.c:1739" output_rate automatic selection is disabled.
         0.000205469 "shairport.c:1741" output_rate is 44100.
         0.000183259 "shairport.c:1743" audio backend desired buffer length is 0.200000 seconds.
         0.000102672 "shairport.c:1745" audio_backend_buffer_interpolation_threshold_in_seconds is 0.120000 seconds.
         0.000064962 "shairport.c:1746" audio backend latency offset is 0.000000 seconds.
         0.000056711 "shairport.c:1748" audio backend silence lead-in time is -1.000000 seconds. A value -1.0 means use the default.
         0.000090171 "shairport.c:1749" zeroconf regtype is "_raop._tcp".
         0.000057044 "shairport.c:1750" decoders_supported field is 3.
         0.000057628 "shairport.c:1751" use_apple_decoder is 1.
         0.000053586 "shairport.c:1752" alsa_use_hardware_mute is 0.
         0.000603406 "shairport.c:1756" no special mdns service interface was requested.
         0.000156133 "shairport.c:1760" configuration file name "/etc/shairport-sync.conf" resolves to "/etc/shairport-sync.conf".
         0.000099588 "shairport.c:1766" metadata enabled is 1.
         0.000110839 "shairport.c:1767" metadata pipename is "/tmp/shairport-sync-metadata".
         0.000070253 "shairport.c:1769" metadata socket address is "(null)" port 0.
         0.000059962 "shairport.c:1770" metadata socket packet size is "500".
         0.000051377 "shairport.c:1771" get-coverart is 1.
         0.000047669 "shairport.c:1789" loudness is 0.
         0.000046253 "shairport.c:1790" loudness reference level is -20.000000
         0.031937480 "mdns_avahi.c:371" avahi_dacp_monitor_start Avahi DACP monitor successfully started
        20.436709659 "rtsp.c:1000" Connection 1: SETUP DACP-ID "B811B6C9284AB415" from fe80::7e:9396:4443:6053 to fe80::1aec:7e05:e33d:a54b with UDP ports Control: 6001, Timing: 6002 and Audio: 6003.
*** Error in `shairport-sync': free(): invalid next size (normal): 0xb431e7d0 ***
Aborted
mikebrady commented 4 years ago

Very interesting thanks. Is it easily reproducible?

artenverho commented 4 years ago

Yes it actually occurs every time I tried connecting using any device I have with this version (3.3.4)

mikebrady commented 4 years ago

It will be mid next week before I can troubleshoot this, I’m afraid. Can you share more details on the run time environment, e.g. what version of Debian, and is it 32- or 64-bit?

artenverho commented 4 years ago

No problem! no rush. It seems the issue is already present in version 3.3.2. I have now reverted back version 3.3, which runs fine. hope this helps!

I am running ARMBIAN 5.69 stable Debian GNU/Linux 9 (stretch) 4.19.62-sunxi btw

mikebrady commented 4 years ago

Thanks!

sonich2401 commented 4 years ago

I thought /shairport-sync -V also didn't work but to my supprize it returned this 3.3.4-OpenSSL-ALSA-pa-stdout-pipe-soxr-sysconfdir:/etc It looks like i didn't configure it correctly when i built shairport? Im not very knowledgeable in how building a program on Raspain works but did i mess up when trying to figure out what type of system im running on? (opps forgot /shairport-sync -vu) 0.000675933 "shairport.c:1001" *fatal error: Line 9 of the configuration file "/etc/shairport-sync.conf": syntax error Aborted Im going to check the config file now

I commeted all of my config settings basicly reverting it back to its normal state. Then i ran ./shairport-sync -vu

Output:

0.002543578 "shairport.c:1621" Started!
         0.000294008 "shairport.c:1633" software version: "3.3.4-OpenSSL-ALSA-pa-stdout-pipe-soxr-sysconfdir:/etc"
         0.000048021 "shairport.c:1639" log verbosity is 1.
         0.000094999 "audio_alsa.c:1018" alsa: alsa_maximum_stall_time of 0.200000 sec.
         0.000096198 "audio_alsa.c:1303" alsa: disable_standby_mode is "never".
         0.000036197 "audio_alsa.c:1305" alsa: disable_standby_mode_silence_threshold is 0.040000 seconds.
         0.000070416 "audio_alsa.c:1307" alsa: disable_standby_mode_silence_scan_interval is 0.004000 seconds.
         0.000117916 "audio_alsa.c:1346" alsa: output device name is "default".
         0.000290936 "shairport.c:1687" disable resend requests is off.
         0.000040573 "shairport.c:1690" diagnostic_drop_packet_fraction is 0.000000. A value of 0.0 means no packets will be dropped deliberately.
         0.000044374 "shairport.c:1691" statistics_requester status is 0.
         0.000034636 "shairport.c:1696" rtsp listening port is 5000.
         0.000092187 "shairport.c:1697" udp base port is 6001.
         0.000098697 "shairport.c:1698" udp port range is 10.
         0.000082708 "shairport.c:1699" player name is "Raspberrypi".
         0.000083385 "shairport.c:1700" backend is "(null)".
         0.000080572 "shairport.c:1701" run_this_before_play_begins action is "(null)".
         0.000081562 "shairport.c:1702" run_this_after_play_ends action is "(null)".
         0.000081666 "shairport.c:1703" wait-cmd status is 0.
         0.000079583 "shairport.c:1704" run_this_before_play_begins may return output is 0.
         0.000081979 "shairport.c:1705" run_this_if_an_unfixable_error_is_detected action is "(null)".
         0.000079999 "shairport.c:1706" run_this_before_entering_active_state action is  "(null)".
         0.000082239 "shairport.c:1707" run_this_after_exiting_active_state action is  "(null)".
         0.000084323 "shairport.c:1708" active_state_timeout is  10.000000 seconds.
         0.000088957 "shairport.c:1709" mdns backend "(null)".
         0.000078385 "shairport.c:1713" interpolation setting is "auto".
         0.000080729 "shairport.c:1714" interpolation soxr_delay_threshold is 30.
         0.000083333 "shairport.c:1715" resync time is 0.050000 seconds.
         0.000081666 "shairport.c:1716" allow a session to be interrupted: 0.
         0.000079218 "shairport.c:1717" busy timeout time is 120.
         0.000080104 "shairport.c:1718" drift tolerance is 0.001995 seconds.
         0.000083905 "shairport.c:1719" password is "(null)".
         0.000119739 "shairport.c:1720" ignore_volume_control is 0.
         0.000110468 "shairport.c:1724" volume_max_db is not set
         0.000666194 "shairport.c:1726" volume range in dB (zero means use the range specified by the mixer): 0.
         0.000082395 "shairport.c:1729" volume_range_combined_hardware_priority (1 means hardware mixer attenuation is used first) is 0.
         0.000040521 "shairport.c:1731" playback_mode is 0 (0-stereo, 1-mono, 1-reverse_stereo, 2-both_left, 3-both_right).
         0.000039219 "shairport.c:1732" disable_synchronization is 0.
         0.000033697 "shairport.c:1733" use_mmap_if_available is 1.
         0.000033802 "shairport.c:1735" output_format automatic selection is enabled.
         0.000111874 "shairport.c:1739" output_rate automatic selection is enabled.
         0.000085729 "shairport.c:1743" audio backend desired buffer length is 0.200000 seconds.
         0.000089687 "shairport.c:1745" audio_backend_buffer_interpolation_threshold_in_seconds is 0.120000 seconds.
         0.000086718 "shairport.c:1746" audio backend latency offset is 0.000000 seconds.
         0.000081145 "shairport.c:1748" audio backend silence lead-in time is -1.000000 seconds. A value -1.0 means use the default.
         0.000083125 "shairport.c:1749" zeroconf regtype is "_raop._tcp".
         0.000081041 "shairport.c:1750" decoders_supported field is 1.
         0.000080729 "shairport.c:1751" use_apple_decoder is 0.
         0.000080260 "shairport.c:1752" alsa_use_hardware_mute is 0.
         0.000077916 "shairport.c:1756" no special mdns service interface was requested.
         0.000128332 "shairport.c:1760" configuration file name "/etc/shairport-sync.conf" resolves to "/etc/shairport-sync.conf".
         0.000084010 "shairport.c:1789" loudness is 0.
         0.000075104 "shairport.c:1790" loudness reference level is -20.000000
         0.001714573 "mdns.c:103" *fatal error: Could not establish mDNS advertisement!
Aborted
sonich2401 commented 4 years ago

Im studying the -vu and it looks like mdns is a part of avatchi ill try to re-build shairport with avatchi

I did so and that fixed the aborting issue however now ive run into the same problem with the abrasive version of shairport, it just freezes and returns nothing. ./shairport-sync -vu is no use because 1. it cuts off the top portion of the output and 2. it freezes once it states 1.487286752 "shairport.c:199" "soxr" interpolation has been chosen.

Edit: Got the aborted issue again but i tried editing a few things and got this ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused I wasn't planning on using pulse audio but i also don't know if i need it or what it does.

sonich2401 commented 4 years ago

Got the full -vu here

0.002932380 "shairport.c:1621" Started!
         0.000252394 "shairport.c:1633" software version: "3.3.4-OpenSSL-Avahi-ALSA-pa-stdout-pipe-soxr-metadata-sysconfdir:/etc"
         0.000047031 "shairport.c:1639" log verbosity is 1.
         0.000103645 "audio_alsa.c:1018" alsa: alsa_maximum_stall_time of 0.200000 sec.
         0.000098333 "audio_alsa.c:1303" alsa: disable_standby_mode is "never".
         0.000032396 "audio_alsa.c:1305" alsa: disable_standby_mode_silence_threshold is 0.040000 seconds.
         0.000041197 "audio_alsa.c:1307" alsa: disable_standby_mode_silence_scan_interval is 0.004000 seconds.
         0.000055469 "audio_alsa.c:1346" alsa: output device name is "default".
         0.000310258 "shairport.c:1687" disable resend requests is off.
         0.000042031 "shairport.c:1690" diagnostic_drop_packet_fraction is 0.000000. A value of 0.0 means no packets will be dropped deliberately.
         0.000042761 "shairport.c:1691" statistics_requester status is 0.
         0.000030416 "shairport.c:1696" rtsp listening port is 5000.
         0.000032396 "shairport.c:1697" udp base port is 6001.
         0.000034791 "shairport.c:1698" udp port range is 10.
         0.000031979 "shairport.c:1699" player name is "Raspberrypi".
         0.000032031 "shairport.c:1700" backend is "(null)".
         0.000031875 "shairport.c:1701" run_this_before_play_begins action is "(null)".
         0.000034844 "shairport.c:1702" run_this_after_play_ends action is "(null)".
         0.000034010 "shairport.c:1703" wait-cmd status is 0.
         0.000032656 "shairport.c:1704" run_this_before_play_begins may return output is 0.
         0.000033750 "shairport.c:1705" run_this_if_an_unfixable_error_is_detected action is "(null)".
         0.000035052 "shairport.c:1706" run_this_before_entering_active_state action is  "(null)".
         0.000033072 "shairport.c:1707" run_this_after_exiting_active_state action is  "(null)".
         0.000033802 "shairport.c:1708" active_state_timeout is  10.000000 seconds.
         0.000040833 "shairport.c:1709" mdns backend "(null)".
         0.000032969 "shairport.c:1713" interpolation setting is "auto".
         0.000033333 "shairport.c:1714" interpolation soxr_delay_threshold is 30.
         0.000033021 "shairport.c:1715" resync time is 0.050000 seconds.
         0.000035625 "shairport.c:1716" allow a session to be interrupted: 0.
         0.000032604 "shairport.c:1717" busy timeout time is 120.
         0.000033593 "shairport.c:1718" drift tolerance is 0.001995 seconds.
         0.000035937 "shairport.c:1719" password is "(null)".
         0.000032917 "shairport.c:1720" ignore_volume_control is 0.
         0.000032656 "shairport.c:1724" volume_max_db is not set
         0.000031406 "shairport.c:1726" volume range in dB (zero means use the range specified by the mixer): 0.
         0.000038750 "shairport.c:1729" volume_range_combined_hardware_priority (1 means hardware mixer attenuation is used first) is 0.
         0.000036197 "shairport.c:1731" playback_mode is 0 (0-stereo, 1-mono, 1-reverse_stereo, 2-both_left, 3-both_right).
         0.000035365 "shairport.c:1732" disable_synchronization is 0.
         0.000031823 "shairport.c:1733" use_mmap_if_available is 1.
         0.000033333 "shairport.c:1735" output_format automatic selection is enabled.
         0.000033229 "shairport.c:1739" output_rate automatic selection is enabled.
         0.000032968 "shairport.c:1743" audio backend desired buffer length is 0.200000 seconds.
         0.000035365 "shairport.c:1745" audio_backend_buffer_interpolation_threshold_in_seconds is 0.120000 seconds.
         0.000038697 "shairport.c:1746" audio backend latency offset is 0.000000 seconds.
         0.000035521 "shairport.c:1748" audio backend silence lead-in time is -1.000000 seconds. A value -1.0 means use the default.
         0.000037604 "shairport.c:1749" zeroconf regtype is "_raop._tcp".
         0.000034375 "shairport.c:1750" decoders_supported field is 1.
         0.000032187 "shairport.c:1751" use_apple_decoder is 0.
         0.000031615 "shairport.c:1752" alsa_use_hardware_mute is 0.
         0.000032551 "shairport.c:1756" no special mdns service interface was requested.
         0.000079948 "shairport.c:1760" configuration file name "/etc/shairport-sync.conf" resolves to "/etc/shairport-sync.conf".
         0.000040833 "shairport.c:1766" metadata enabled is 1.
         0.000033489 "shairport.c:1767" metadata pipename is "/tmp/shairport-sync-metadata".
         0.000034479 "shairport.c:1769" metadata socket address is "(null)" port 0.
         0.000033750 "shairport.c:1770" metadata socket packet size is "500".
         0.000032292 "shairport.c:1771" get-coverart is 1.
         0.000031874 "shairport.c:1789" loudness is 0.
         0.000030782 "shairport.c:1790" loudness reference level is -20.000000
         0.022587269 "mdns_avahi.c:371" avahi_dacp_monitor_start Avahi DACP monitor successfully started
         1.479350562 "shairport.c:199" "soxr" interpolation has been chosen.`

Im also not getting the pulse audio error (or its not showing up) however i can connect to shairport from my phone and then it does nothing, it doesnt even go to the audio jack so ¯_(ツ)_/¯

sonich2401 commented 4 years ago

Update: It seems to be accepting input just fine now but after using --statistics it seems that if i use pipe it will tell me that alsa was "underrun while writing to alsa device" or it will say aborted again. with stdout it prints every so often a bunch of zeross and the sample rate and says Error: in millisecounds (and about everything else in the .conf file for alsa returned Error also)

Stdout will also print garbled junk and emojiis if you do /shairport-sync -a "Name" -o stdout -vu

mikebrady commented 4 years ago

Thanks for the update. The version string indicates that you have include the pa (i.e. PulseAudio) backend in your build of Shairport Sync. In that log file, it looks like you didn’t specify the back end, so one would have been chosen, and it could have been the pa one, possibly giving rise to the PulseAudio messages.

When you were successful with shairport-sync -a "Name" -o stdout -vu, the "garbage" on the screen was the audio being output to stdout. You need to pipe it to your processing chain. To troubleshoot further, try piping to something like aplay to ensure that Shairport Sync is delivering the goods. Something like:

$ shairport-sync -a "Name" -o stdout | aplay -f cd

should produce audio at the output. Then you can start troubleshooting your own processing chain.

sonich2401 commented 4 years ago

It seems that shairport has been working since yesterday. Whoops! Sorry for this issue page. So in conclusion it was just that i didn''t install shairport with acatchii. The reason i thought it was broken yesterday is because i thought that shairport had a buffer length of about 15 sec before it started playing however i left shairport on while i was grabing a cord and it started playing something wich i found out was the song played at 8x slower than usual. i fixed the slowness issue kinda so if its ok by you artenverho ill close the issue?

mikebrady commented 4 years ago

That’s great that you resolved your issue. However it seems that @artenverho‘s issue is still to be dealt with, so let’s leave it open for the time being.

mikebrady commented 4 years ago

@artenverho, is your device an Orange Pi, by any chance?

mikebrady commented 4 years ago

I think I can replicate it!

mikebrady commented 4 years ago

@artenverho, this has been fixed, I believe, in the development branch. I'd be obliged if you would check it.

artenverho commented 4 years ago

Hi Mike, I just checked the development branch and it seems to be fixed. Thanks!

mikebrady commented 4 years ago

Many thanks. As soon as it's in the master branch, I'll close this issue, if that's okay.

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.