Commit Graph
348 Commits
Author SHA1 Message Date
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 fb7de841b7 Silence some currently-irrelevant debug messages. 2026-03-02 19:00:31 +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 1caaa38071 Quieten a few debug messages and simplify one of two. 2025-12-16 09:33:31 +00:00
Mike Brady 009a13dfe5 Separate out the buffered audio processor, the buffered reader and the mod 2^23 aritemetic. 2025-12-03 17:44:50 +00:00
Mike Brady 93bafe304a Modify/simplify the TEARDOWN handling in AP2 mode. Allow the threads to natrually terminate when ports are closed by the client. 2025-12-03 15:56:38 +00:00
Mike Brady 4e4d35ec77 Move rtp_event_handler out to its own files, make two copies of it called ap2_event_handler and ap2_rc_event_handler respectively. 2025-12-02 12:57:01 +00:00
Mike Brady 8c765d74ac Merge branch 'development' of github.com:mikebrady/shairport-sync into development
Add code to clear pending flushes from a connection whn a new buffered audio processor is created.
2025-12-01 13:07:54 +00:00
Mike Brady 1417cd6f51 When a new buffered audio processor is created, ensure any old flush requests are removed first. 2025-12-01 11:15:25 +00: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 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
Andrew May 94eda9b9e1 Check swr_init() error code and exit early. 2024-08-16 23:50:41 -07:00
Mike Brady e28c566a7d Remove the avcodec_free_context(&codec_context) -- seems to cause a double free. 2024-07-16 12:58:37 +01:00
Mike Brady 9909bc21b7 Use (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO now in place of bit-mapped AV_CH_LAYOUT_STEREO -- possible from FFmpeg 5.1, mandatory in FFmpeg 7. Also remove deprecated avcodec_close. 2024-07-16 12:25:15 +01:00
Mike Brady f5475924dc Fix a benign warning from Clang 16 on FreeBSD 2023-09-20 11:46:38 +01:00
Mike Brady b7d9c22de9 format adjustments 2023-09-11 16:01:38 +01:00
Mike Brady 17414f576d stop two FFmpeg deprecation warnings 2023-06-10 17:10:02 +01:00
Mike Brady 65c6975ea6 Remove some race conditions between Shairport Sync ('SPS') opening a TCP connection and the client checking that it's open. If SPS is slow for some reason (e.g. slow CPU), the client could find that the connection hasn't been opened and may then terminate the session. The fix is to ensure the TCP connections are open for reading before telling the client about them. 2023-02-12 20:14:07 +00:00
Mike Brady e8b8c6edb7 Clang cleanup 2022-11-18 18:14:50 +00:00
Mike Brady 1046a076c4 Change how a missing session key is dealt with: instead of dropping the AirPlay connection, simply skip the audio. Hopefully this will be less disruptive for users. 2022-10-16 22:15:26 +01:00
Mike Brady 7dc077e260 Clang format 2022-09-23 17:05:26 +01:00
Mike Brady c433e2e87d Add in code to detect the iOS 16 discontinuity but not to do anything about it. Delaying everything by 2112 frames after the discontinuity removes it, but the result seems to be that playback is delayed by 2112 frames. One approach would be to advance everything prior to the discontinuity by 2112 frames, but that would require checking what version of software the source was using, so hardly worth the trouble. 2022-09-23 17:02:26 +01:00
Mike Brady c6bb33dcaf Roll back fix for extra frames -- it fixes sync issues but introduces transients or glitches. Not nice. 2022-09-22 18:19:46 +01:00
Mike Brady b19dd9e93c Skip the out-of-date frames at the start of a session in AirPLay 2 Buffered Streams in iOS 16.0 / Ventura beta / iOS 16.1 beta. Only skip two blocks to avoid AAC transients and substitute silent for them. 2022-09-22 16:28:51 +01:00
Mike Brady cae9492d0a Add in, but comment out, some code to investigate discontinuities in timestamps of audio coming from iOS 16.0 devices. Also clean up code to supress initial AAC transients when skipping or scrubbing. There must be a nicer way to do this. 2022-09-16 20:02:32 +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 a617e607cb Wait for a longer period for a realtime control packet before concluding that the sender is gone. Also, don't exit if the packet is empty. Also check minimum packet size. 2022-08-31 12:55:42 +01:00
Mike Brady 174556f054 Remove a few causes of "possibly uninitialised" warnings. 2022-08-16 09:26:35 +01:00
Mike Brady de8df93471 Comment out an unused variable. 2022-08-08 12:19:04 +01:00
Mike Brady 3cc1ec6abc reset anchor time if realtime control message is missing. 2022-08-03 12:55:59 +01:00
Mike Brady 524a8a1203 Quieten a debug message. 2022-07-14 11:04:02 +01:00
Mike Brady 623b760ba5 Reinstate the 5.0 second settling time for a clock change. 2022-07-09 09:55:28 +01:00
Mike Brady 6bfeb49fba Reduce the settling time given for a change in master clock from 5 sec to 0.75 sec. 2022-07-08 15:18:25 +01:00
Mike Brady f551274a2e Set the initial volume to 0.0 (full volume) if ignore_volume_control is selected. Add some code to explore remote_control. Still not even close to working. 2022-06-25 10:47:18 +01:00
Mike Brady fb151915ae Tidy up write encrypted. Explore some of the remote_control connections. Not working. 2022-06-23 09:40:30 +01:00
Mike Brady 6556a79dbc Fix a bug that caused SPS to stop if another speaker with its own master clock (e.g. a HomePod mini) was included and then removed from the output group. 2022-06-19 13:13:09 +01:00
Mike Brady 3d9d9757ce Add a const qualifier 2022-06-09 07:57:51 -07:00
Mike Brady 953b09560c Remove the unnecessary fltp capability test; it should have been done at startup. 2022-05-24 15:20:54 +01:00
Mike Brady 645e17749e Turn off AAC decoder checker. 2022-05-24 13:31:28 +01:00
Mike Brady a1dabd79a7 Remove check for AAC decoder. 2022-05-24 10:17:01 +01:00
Mike Brady 2177daec13 Remove misleading (obselete) comment. 2022-05-22 15:36:39 +01:00
Mike Brady 086acbe5a4 Check that the AAC decoder can do fltp decoding. Need to do more of this kind of checking at startup! 2022-05-22 11:32:36 +01:00
Mike Brady 00bc837bef quieten some debug messages. 2022-05-17 17:50:46 +01:00
Mike Brady 3b4a21f002 Quieten some debug messages. Remove some redundant code. 2022-05-17 15:49:01 +01:00
Mike Brady aedc83978f A little more debug information. 2022-05-17 13:51:29 +01:00
Mike Brady 8a2756b7f0 Greatly simplify dealing with a new anchor clock -- basically, accept a new anchor clock immediately, without delay. A new master clock is accepted after 5 seconds. If the anchor clock changes as it may in a realtime stream, it will change within one second of the master clock, and the 5 second delay will be skipped. Discard the first two seconds of audio within the first two seconds of a connection being made. This is to allow the clocks to settle and stabilise. Debug message changes. 2022-05-14 19:05:38 +10:00