Commit Graph
575 Commits
Author SHA1 Message Date
Mike Brady a062f83abe Quieten lots of debug messages. 2025-12-05 08:49:22 +00:00
Mike Brady aac6913681 Stop the player thread from resetting the NTPTP client clock when it finishes. 2025-12-05 08:33:18 +00:00
Mike Brady 0e274eb760 Balking when connecting to HPM. 2025-12-04 11:35:00 +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 341a1f8d5d Move a function so that it can be build without the FFmpeg library, duh. 2025-12-03 16:13:38 +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 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
Mike Brady e4d3c6f7e8 Fix a potential bug by checking that a buffer is not zero before attempting to deallocate it. 2024-12-04 16:06:22 +00:00
Mike Brady da1c20c672 Quieten some debug messages. 2024-12-02 10:59:29 +00:00
Mike Brady ab6225c1ac Add some extra diagnostics to investigate a read of zero bytes. 2024-11-02 14:44:12 +00:00
Mike Brady aa3af3b368 Add a check for when a read() returns zero. 2024-10-31 17:28:12 +00:00
Mike Brady 419ff394f5 Remove watchdog stuff. USe the session timeout to set the TCP keep intervals and stuff. Change response to ETIMEDOUT to rtsp_read_request_response_immediate_shutdown_requested. 2024-06-29 20:04:29 +01:00
Mike Brady c064b8bae5 Change order of some include file to facilitiate old Mac OS X builds. Check existence of TCP_KEEPINTVL before trying to use it. Fix a race condition with initial messages to the metadata queues. The race was that the queues and mutexes were definied in a thread, so could be delayed to after when the main process was using them. 2024-06-15 14:31:14 +01:00
Mike Brady e0b13829cd Reverse changes made in PR 1831 (https://github.com/mikebrady/shairport-sync/pull/1831/files) -- issue identified in Issue 1856 (https://github.com/mikebrady/shairport-sync/issues/1856). 2024-05-23 14:24:30 +01:00
= 5fb152a5f5 fix inversion of number and size arguments in a calloc 2024-04-26 11:20:03 +01:00
Mike BradyandGitHub 6eba4fd83e Merge pull request #1831 from kuzhylol/master
This patch introduces modification to AirPlay attributes allowing AirPlay clients seeing only appropriate Endpoints of specific version of AirPlay protocol.

[Test]
Run two instances of shairport-sync - built for version 1 and for version 2.

TuneBlade recognizes only AirPlay version 1 instance running.
MacOS/iOS recognizes only AirPlay version 2 instance running.

Without that patch, both MacOS/iOS detect two endpoints at the same time. The TuneBlade detects only AirPlay version 1 since it doesn't support AirPlay version 2.
2024-04-01 13:02:20 +01:00
Mike BradyandGitHub 5922f9d1b4 Merge pull request #1813 from rmounce/fix-ptp-net-iface
Limit PTP addresses to configured network interface.
2024-04-01 10:38:58 +01:00
Oleh Kuzhylnyi 3dc5926243 Add version-based visibility of shairport-sync endpoints
This patch introduces modification to AirPlay attributes allowing AirPlay clients
seeing only appropriate Endpoints of specific version of AirPlay protocol.

[Test]
Run two instances of shairport-sync - built for version 1 and for version 2.

TuneBlade recognizes only AirPlay version 1 instance running.
MacOS/iOS recognizes only AirPlay version 2 instance running.

Without that patch, both MacOS/iOS detect two endpoints at the same time.
The TuneBlade detects only AirPlay version 1 since it doesn't support AirPlay version 2.
2024-03-26 19:48:42 -03:00
Mike Brady 0f07107c36 Look for DACP-ID and Active-Remote in the GET /info request, where it sometimes appears from AirPlay from an intel Mac. 2024-03-25 20:28:11 +00:00
Ryan Mounce b6a3835d45 Limit PTP addresses to configured network interface
Otherwise every address on the system is advertised and AirPlay 2
sources will send PTP announce + signalling messages to all of them in
parallel.
2024-02-27 22:20:27 +10:30
Klemens Nanni 783d600a10 Fix crash on double pthread_cancel(3) on exit
On OpenBSD 7.4-current, failure to listen on the RTSP socket(s) results
the `rtsp_listener_thread` being pthread_cancel(3)'ed twice, once through
`rtsp_listen_loop()` and again via atexit(3) handler `exit_rtsp_listener()`:

```
$ nc -4l 5000 &
$ nc -6l 5000 &
$ shairport-sync -c/dev/null
warning: could not establish a service on port 5000 -- program terminating. Is another instance of Shairport Sync running on this device?
Segmentation fault (core dumped)
```
```
Program terminated with signal SIGSEGV, Segmentation fault.
433             if (tib->tib_canceled == 0 && tid != 0 &&
[Current thread is 1 (process 290061)]
```

`die()` -> `exit(EXIT_FAILURE)` normally in this case, thus forgoing the
first cancel and relying on the atexit handler alone.

With Mike Brady.
2024-02-01 18:35:35 +01:00
Klemens Nanni 62abb0465c fix [-Wunused-variable] for keep* variables 2024-01-30 02:52:49 +01:00
Klemens NanniandKlemens Nanni dc235275ac No per-socket TCP keepidle on OpenBSD
A system-wide sysctl(2) net.inet.tcp.keepidle exists, but there is no
setsockopt(2) equivalent.
2024-01-27 19:15:07 +01:00
Mike Brady e36ec5c45d Quieten some debug messages. 2023-11-12 11:50:21 +00:00
Mike Brady 5f9a88fb74 Use pthread_rwlock_wrlock instead of the incorrect use of pthread_rdlock_wrlock when tearing down a connection. 2023-10-31 09:01:24 +00:00
Mike Brady b70dd4633f Change response to a /feedback message in a Classic AirPlay session to 501 Not Implmemented instead of 200 OK. 2023-10-13 07:52:51 +01:00
Mike Brady 4cd3c1da4b Return code 200 for a POST of type /feedback, and continue to return 500 for everything else. 2023-10-08 17:43:02 +01:00
Mike Brady 29a5589be6 Quieten a debug message. 2023-10-02 10:05:21 +01:00
Mike Brady c4975d5c3b Add missing arguments to some debug messages. They could potentially cause crashes just when you need them to work properly, sigh! 2023-09-25 09:37:47 +01:00
Mike Brady a3f12d685a When a connection termiates abruptly while is it the principal_conn, make sure it sets the principal_conn
to NULL and cleans up the bonjour flags, if appropriate.

Simplify the TEARDOWN handlers and the thress teardown functions by incporporating
the above code in the teardown_phase_two (for AP2) and teardown (fpr AP1) functions.

It means that closing a connection will block on the principal_conn_lock, so if
you have the principal_conn_lock, closing will not complete until you release it.

Maybe we need a principal_conn_acquisition_lock for that...
2023-09-24 17:23:04 +01:00
Mike Brady 91c0803d04 Quieten a debug message. 2023-09-21 17:28:03 +01:00
Mike Brady 5abf393f7e clang format 2023-09-21 16:45:22 +01:00
Mike Brady 2e023fb13b Remove a few debug messages. 2023-09-21 16:41:48 +01:00
Mike Brady 2987478f4c Set and reset bonjour flags correctly when it's a Classic Airplay session. Reintroduce a 1 second delay for the prempted session to go away. 2023-09-21 16:36:21 +01:00
Mike Brady 152ddbb87d Change principal_conn_lock from a regular mutex to a read-write mutex, so it can be used to check and hold the current principal_conn unless it's being altered in get_play_lock or a release_play_lock.
Only allow access to the config.airplay_statusflags, build_bonjour_strings(NULL), mdns_update(NULL, secondary_txt_records) when read_lock is acquired on the principal_conn_lock.
Only allow changes to config.airplay_statusflags and only allow access to mdns_update if you are the principal conn.

The bonjour status flags and the info response plist calculations are still a dirty rotten hack.
2023-09-21 16:04:23 +01:00
Mike Brady 2fb81ca9f7 Set debug verbosity to 2 when the client closes the connection. 2023-09-19 11:28:45 +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 2d24665983 Fix a bug that prevented Shairport Sync being added to Home. 2023-09-17 14:30:02 +01:00
Mike Brady ef14cacebf Quieten a debug message 2023-09-11 16:47:14 +01:00
Mike Brady 556419e845 Fix a bug whereby volume control changes would be ignored after a pause in playing of longer than about 8 minutes. 2023-09-10 11:02:59 +01:00
Mike Brady 986f9587de Rebuild the locking mechanisms for safe interruption of an existing play session. 2023-09-09 10:49:32 +01:00
Mike Brady 9a8f1ba12b Update the mDNS strings for the Classic AirPlay feature of AP2 2023-07-06 09:13:58 +01:00
Mike Brady b0f2fb9a10 Fix a bug when interrupting a Classic Airplay session -- don't reset the UDP port suggestion when you interrupt a session. IOW use different UDP ports for the new session to avoid poisoning the new session. 2023-06-25 17:51:32 +01:00
Mike Brady 01937965d7 quieten a few debug messages 2023-06-25 11:39:32 +01:00
Christian König fbeba7e360 Fix some openssl 3.0 deprecation warnings
Signed-off-by: Christian König <ckoenig@posteo.de>
2023-06-08 14:05:04 +02:00
Mike Brady c3d99f96c9 increase the debug output for RTSP messages and responses at verbosity 2. 2023-06-05 14:22:40 +01:00
Markus Reiter bd848a7548 Fix compilation with libplist 2.3.0. 2023-05-08 03:58:32 +02:00