Commit Graph
245 Commits
Author SHA1 Message Date
Mike Brady f30dd7aee6 Enhancements
Enable the AirPlay 2 build to operate an optional classic-AirPlay-only service or to gracefully degrade to classic AirPlay, as follows:
  1. Add a new command-line option '-—service-type=<type>' and an equivalent configuration entry 'service_type = "<type>"' in the 'general' section of the configuration file,
     where <type> can be "auto", "classic" or "airplay2":
      1. "auto" (default) means that the service will be AirPlay 2 if NQPTP is running. If NQPTP is not running, classic AirPlay service will be provided instead, and in that case,
      "(Classic)" will be appended to the default AirPlay service name visible to AirPlay clients like Apple Music, for example "RaspberryPi3B (Classic)".
      2. "classic" means the service will be classic AirPlay (aka AirPlay 1).
      3. "airplay2" means the service will be the modern AirPlay 2. In this case, as distinct from "auto", if NQPTP is not running, Shairport Sync will log an error and terminate.
  2. In the systemd service file, NQPTP is now a "Want" rather than a "Require". If it's present, then it will be launched before Shairport Sync. If it's absent, Shairport Sync will launch anyway.
  3. Improve the delivery of input format changes and emit 'sdsc' metadata when changes occur.
  4. Emit new format information in the log if statistics is enabled.

Docker Changes
  1. Support for linux/arm/v6 has been dropped, as Docker is no longer supported.
  2. NQPTP is not started in the AirPlay 2 Docker image if '--service-type=classic' or '--service-type=airplay1' is in the command line options at the end of the docker run command.
     The purpose is to ensure that ports 319 and 320 are left alone when the AirPlay 2 image is set to provide Classic service only.
     Note that setting the configuration file 'service_type' to 'classic' will not prevent NQPTP from starting up -- you must use the command line option.
  3. A new "dev" target has been added. It is a large image containing the custom-built FFmpeg library, NQPTP, Avahi and D-Bus along with the Shairport Sync source and
     all necessary development tools. When started, Avahi, D-Bus and NQPTP are all installed and running. The bash shell has also been added and is entered.

Stability Improvements
  Reorganise session preemption to fully terminate the existing session before starting a new one.
  Don't delay closing the event port to wait for it to be closed at the client end.
  Add a safe_socket_close() function to ensure sockets are fully closed. Use -1 to designate closed rather than 0, to prevent attempts to reclose sockets, causing mayhem.
  Re-order FFmpeg decommissioning during teardown.
2026-05-18 09:57:12 +01:00
Mike Brady 11052b7896 Lot of changes here.
1. check_classic_mac_basic.yml — update to latest macOS-latest
2. docker-on-push-tag-or-pr — dependant updates
3. FFTConvolver — fix a compilation warning when the DEBUG flag is turned off
4. Reorganise some source files — e.g. move most of the metadata stuff into a subdirectory
5. Remove unused special-purpose AirPlay 2 RC event handler.
6. Reorganise source files and source code relating to the standard event handler.
7. Check configuration settings a little more carefully to offer more meaningful diagnostics.
8. Add password to AirPlay 2 and reorganise initialisation to set AirPlay 2 flags accordingly.  Also, remove redundant airplay_pin.
9. Remove redundant debug facility definitions from common.h
10. Make it possible to omit all the dacp stuff from a build.
11. Make it possible to omit metadata multicast from a build.
12. Add AP2-native metadata by setting bit 50 of features to true.
13. Improve stability when pre-empting an existing play session.
14. Fix a few compiler warnings in the pair_ap library.
15. Ensure that the audio format is known before starting synchronisation.
16. Improve handle_configure to set/clear a new config setting. Doesn’t seem to do anything…
17. Experimentally turn off bit 46 of AirPlay 2 features — seems to stop failing pair-verify attempts.
2026-04-26 10:23:18 +01:00
Mike Brady 45063d101f Add Carl Johnson's suggestion for omitting dummy internet interfaces. 2026-01-05 21:19:11 +00:00
Mike Brady 16b6534ad3 further changes to remove compilation warnings on 32-bit builds 2025-12-31 19:02:16 +00:00
Mike Brady 691d71f356 More fixes due to tightening the checks on debug/die/inform/warn varadic arguments. 2025-12-30 16:56:30 +00:00
Mike Brady 3aa34cd712 fix lots of errors calling debug() with incorrect argument patterns. 2025-12-30 14:59:27 +00:00
Mike Brady 5d3829199b Merge branch 'development' of github.com:mikebrady/shairport-sync into development
Update to use mbedtls V 3.
2025-12-22 10:29:57 +00:00
Christian Beier 0ed6b5de08 mbedtls: use high-level PK API for signing w/ mbedTLS >= 3
They state in https://github.com/Mbed-TLS/mbedtls/blob/master/docs/3.0-migration-guide.md#remove-the-mode-parameter-from-rsa-functions
that the lower level API will not work as expected.

Closes #2115
2025-12-20 17:21:25 +01:00
Mike Brady 54445ee8f5 Separate out the debug facilities into their own files. Clean up and add a few associated methods. 2025-11-27 12:37:16 +00:00
Mike Brady e12a3ed7b2 Do a long-overdue rebuild of the buffered audio processor and, with everything we have figured out, implement a cleaner method to handle both immediate and deferred flush requests. Remove lots of old flags and redundant code. Leave in a few debug messages. 2025-11-16 16:58:34 +00:00
Mike Brady d043f98330 Update the convolution code:
(1) to be multithreaded,
    (2) to work on multichannel audio and
    (3) to work on 48k and 44.1k audio.

    Allow multiple impulse response (IR) files with a new setting: "convolution_ir_files"
    When convolution starts, Shairport Sync will look for an IR file with a sample rate
    matching the input (44.1k or 48k) and channel count.
    If one can't be found, it will look for a single-channel IR file with the same rate.
    It will always choose the first match in the file list supplied "convolution_ir_files".

    Allow multithreading -- use the "convolution_thread_pool_size" to set the number of threads to use.

    Deprecate "convolution" -- use "convolution_enabled" instead.
    Deprecate "convolution_max_length" -- use "convolution_max_length_in_seconds" instead.
    Deprecate "convolution_ir_file" -- use "convolution_ir_files" instead.
    Update corresponding D-Bus methods and properties.

Update the loudness code to work on 48k and well as 44.1k audio and with multichannel audio.

    Deprecate "loudness" -- use "loudness_enabled" instead.
    Update corresponding D-Bus methods and properties.

Fix a deprecated FFmpeg warning.

Update HiFi-LoFi FFT convolver to latest available.
2025-10-13 13:26:20 +01:00
Mike Brady e05448aecc Check for configuration strings that are given but turn out to be empty, issue a warning and ignore them. 2025-04-14 10:40:26 +01:00
Mike Brady 60143518c2 This squashed commit comprises a long series of improvements, bug fixes, optimizations, and new feature additions:
- 48,000 frames per second operation,
 - 48k lossless stereo, 5.1 and 7.1 surround sound
 - Multichannel and multi rate operation on ALSA, PipeWire, PulseAudio, FreeBSD, stdout and unix pipe output backends.

Automatic, flexible and controllable output format (rate, sample format and channel count) selection.

Full FFmpeg integration to support transcoding, resampling, and new audio formats.

Better operation on lower powered devices down to e.g. Raspberry Pi B.

Reduced Docker image sizes with a slimmed-down FFmpeg library.

Enhanced timestamp handling for better synchronization.

Improved the sync error calculation.

A new "vernier" resampling and interpolation method for low-power CPUs.

Bug fixes and minor enhancements.

Note -- there are many breaking changes from previous versions of Shairport Sync!
2025-02-23 13:31:17 +00:00
Mike Brady 10b965a7aa add a diagnostic function debug_print_buffer, which might be useful in the future. 2024-07-18 15:26:55 +01:00
Seo Suchan d73b585c6f mbedtls: add support to mbedtls3
Signed-off-by: Seo Suchan <tjtncks@gmail.com>
2024-05-09 21:51:38 +09:00
Mike Brady 60cee967dc Add a pthread_cleanup compatible function to release a pthread_rwlock. 2023-09-21 15:50:43 +01:00
Mike Brady 465c5a3ee2 Tidy up some code and add diagnostics to tackle issue #1723. 2023-09-18 19:51:36 +01:00
Mike Brady b7d9c22de9 format adjustments 2023-09-11 16:01:38 +01:00
Mike Brady b965add150 Minor comment change. 2023-07-21 13:34:02 +02:00
Mike Brady bc2fda5207 Modify the dasl_tapered volume control transfer function to use the entire AirPlay volume range with mixers having a restricted attenuation range. 2023-07-20 16:27:07 +02:00
dasl- ebe1ca17f2 rename to dasl_tapered 2023-07-13 21:43:25 -04:00
David LeibovicandGitHub 3479d8d7d4 make use of max_db 2023-07-07 20:19:34 -04:00
dasl- baf51cf2a7 Add logarithmic volume_control_profile mode 2023-07-02 09:27:53 -04:00
Mike Brady 78dbfe6a88 replace some deprecated OpenSSL calls 2023-06-10 16:06:25 +01:00
Mike Brady 1d858d6866 replace code making deprecated OpenSSL calls 2023-06-10 15:52:37 +01:00
Mike Brady ffeeacc4bd add Shared Memory Interface Revision number, e.g. "smi9" to the version string for AirPlay2. 2023-05-20 16:42:52 +01:00
Mike Brady 039618302a Add a short delay before retrying for a MAC address in get_device_id. 2023-04-06 12:09:43 +01:00
Mike Brady 13ac11bfe0 Fix a bug in get_device_id which allowed it to return with an all-zeros ID. Not it waits for up to 10 seconds for a MAC address. 2023-04-03 09:01:51 +01:00
Mike Brady 8201903a4e Add code to try to save your ears by handling a situation where the player volume was set very high some time ago and you have forgotten.
In that situation currenctly, when you play something, it will come out at the last volume set on the device, which will be that very high volume.
This could happen, for example, the morning after a loud party :).

The new code works as follows: If nothing has been played for a period, say a few hours, and the volume is higher than a threshold, new connections that ask
for the current volume setting will be offered the default (low) volume rather than the current (very high) one.
Most players, including the HomePod mini, iOS and iPadOS use this to set their initial volume.
The Mac Music app retains its own setting, and the Mac System Sounds preference sometimes seems to take its setting from the Music app,
but at least you can see the settings they will apply.

Existing connections are unaffected, so this facility should be unobtrusive.
2023-01-18 10:41:50 +00:00
Mike Brady f775267d02 Remove the useless main_thread_id and fix the MPRIS quit handler. 2022-10-11 09:45:47 +01:00
Mike Brady fd880056fb Squashed commit of the following:
Add three parameters to the backend play() function call -- (1) a flag indicating whether the samples are timed or not. If timed, (2) the timestamp and (3) the local time at which the first frame should be heard.
    Update missing pipewire library message.
    Makefile.am fix.
    Update the SHM version and fix the SHM name so that it works with FreeBSD.
    Remove redundant (?) AC_HEADER_STDC check.
    Fix compilation and installation under FreeBSD -- changes to allow building in a separate directory broke the FreeBSD build process.
    Add AC_CHECK_LIB for gcrypt in case PKG_CHECK_MODULES fails to find it.
    Find gcrypt using pkg-config
    Add code to detect when the RTSP channel goes idle for a period, and use it to reset clocks and timings, etc. so that SPS resumes correctly where the source has gone to sleep while playing a realtime stream and has subsequently woken up.
    Don't exit if a UDP Clock Control packet is empty. Also check minimum packet size.
    Remove some very experimental code which may cause memory and port leaks.
    Strip file path from the filename used in debug messages, information messages, warnings and fatal error messages.
    BB fix to Makefile.am -- overwriting the DBUS stuff with MPRIS definitions, duh.
    Fix some problems building on FreeBSD and tidy up the use of the "sed" editor.
    Fix some problems building on picore.
    Fix an uninitialised variable
    start using the "nqptp" SMI
2022-09-12 15:19:52 +01:00
Mike Brady 05dfcdfd6a Merge other enhancements. 2022-08-09 14:18:53 +01:00
Mike Brady 882d6c5b68 Fix get_device_id to work property when using AF_LINK rather than AF_PACKET. Ensure only int_length bytes are copied to the device ID 2022-08-09 12:34:17 +01:00
Mike Brady bc7d122a9e Clean us a few compilation errors. 2022-08-08 09:58:16 +01:00
Mike Brady 4963c65a0e Fix the D-Bus quit method so that it works, duh. 2022-08-07 11:15:54 +01:00
Mike Brady f317161aca Include -pw in the Version String if PipeWire support is included. 2022-07-03 12:02:34 +01:00
Mike Brady cdb4d384d3 Fix a stupid bug in the selection of timebases. 2022-05-23 20:34:37 +01:00
Mike Brady a62e4b0b3b Use a simpler (?) method for checking if a mutex is taking too long. 2022-05-22 22:20:05 +01:00
Mike Brady f51f78ada1 tidy up the timed mutex stuff. 2022-05-19 18:11:52 +01:00
Mike Brady 7690fed9f1 Simplify mutex timeout checking. Use CLOCK_MONOTONIC if CLOCK_MONOTONIC_RAW is not available. 2022-05-18 22:31:49 +01:00
Mike Brady 2dc6af2daf Partially clean up some mutex diagnostic stuff. 2022-05-18 19:37:18 +01:00
Mike Brady 5a23ff5224 slightly simplify function generate_preliminary_string. 2021-12-16 09:47:50 +00:00
Mike Brady 9bf4557422 Make debug messages easier to see on macOS Terminal. 2021-12-12 12:53:40 +00:00
Mike Brady 5aa3324d3d Merge "openbsd corrections #1357" after resolving one conflict. 2021-12-09 14:16:37 +00:00
Anton Lindqvist 489a77633b add missing includes on openbsd 2021-12-05 09:00:23 +01:00
Mike Brady 56bef8e7dd Use CLOCK_MONOLITHIC_RAW to avoid NTP effects, report raw and corrected timing from audio_alsa. Clean up statistics. Stop watchdog timing out AP2 sessions. CLean up some debug messages. 2021-11-28 16:08:48 +00:00
Mike Brady 14bfba2724 Add code to check divisions and mods for a potrntial divide by zero problem. MAy cause SPS to terminate but leave a log message. 2021-11-21 21:47:32 +00:00
Mike Brady 04240708a9 Try using the monotonic clock for checking output rate... 2021-11-08 10:14:42 +00:00
Mike Brady 6beb73e99e Allow debug/inform/die/warn messages up to 16384 bytes (up from 1024 bytes) 2021-08-23 12:57:56 +01:00
Mike Brady 23da206c7e revert output to syslog rather than stderr 2021-07-30 19:15:17 +01:00