From 62abb0465c0840a06703256e51fccdbec50294c0 Mon Sep 17 00:00:00 2001 From: Klemens Nanni Date: Tue, 30 Jan 2024 02:52:49 +0100 Subject: [PATCH 1/3] fix [-Wunused-variable] for keep* variables --- rtsp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rtsp.c b/rtsp.c index 6ac850504..ee8f2971e 100644 --- a/rtsp.c +++ b/rtsp.c @@ -5601,7 +5601,7 @@ void *rtsp_listen_loop(__attribute((unused)) void *arg) { } else { size_of_reply = sizeof(SOCKADDR); if (getsockname(conn->fd, (struct sockaddr *)&conn->local, &size_of_reply) == 0) { - +#ifndef COMPILE_FOR_OPENBSD // Thanks to https://holmeshe.me/network-essentials-setsockopt-SO_KEEPALIVE/ for this. // turn on keepalive stuff -- wait for keepidle + (keepcnt * keepinttvl time) seconds @@ -5623,7 +5623,6 @@ void *rtsp_listen_loop(__attribute((unused)) void *arg) { #define KEEP_ALIVE_OR_IDLE_OPTION TCP_KEEPIDLE #endif -#ifndef COMPILE_FOR_OPENBSD if (setsockopt(conn->fd, SOL_OPTION, KEEP_ALIVE_OR_IDLE_OPTION, (void *)&keepAliveIdleTime, sizeof(keepAliveIdleTime))) { debug(1, "can't set the keepidle wait time"); From 5cc825c7e2927dfbe86a186b22f28cc0dd7535bd Mon Sep 17 00:00:00 2001 From: Klemens Nanni Date: Tue, 30 Jan 2024 03:03:36 +0100 Subject: [PATCH 2/3] Sprinkle OpenBSD news in README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 37992583b..eba78c2cb 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Shairport Sync -Shairport Sync is an [AirPlay](https://www.pocket-lint.com/speakers/news/apple/144646-apple-airplay-2-vs-airplay-what-s-the-difference) audio player for Linux and FreeBSD. It plays audio streamed from Apple devices and from AirPlay sources such as [OwnTone](https://github.com/owntone/owntone-server) (formerly `forked-daapd`). +Shairport Sync is an [AirPlay](https://www.pocket-lint.com/speakers/news/apple/144646-apple-airplay-2-vs-airplay-what-s-the-difference) audio player for Linux, FreeBSD and OpenBSD. It plays audio streamed from Apple devices and from AirPlay sources such as [OwnTone](https://github.com/owntone/owntone-server) (formerly `forked-daapd`). Shairport Sync can be built as an AirPlay 2 player (with [some limitations](AIRPLAY2.md#features-and-limitations)) or as "classic" Shairport Sync – a player for the older, but still supported, AirPlay (aka "AirPlay 1") protocol. @@ -33,7 +33,7 @@ Some features require configuration at build time – see [CONFIGURATION FLAGS.m # Status Shairport Sync was designed to [run best](ADVANCED%20TOPICS/GetTheBest.md) on stable, dedicated, stand-alone low-power "headless" systems with ALSA as the audio system and with a decent CD-quality Digital to Analog Converter (DAC). -Shairport Sync runs on recent (2018 onwards) Linux systems and FreeBSD from 12.1 onwards. It requires a system with the power of a Raspberry Pi 2 or a Pi Zero 2 or better. +Shairport Sync runs on recent (2018 onwards) Linux systems, FreeBSD from 12.1 onwards and OpenBSD. It requires a system with the power of a Raspberry Pi 2 or a Pi Zero 2 or better. Classic Shairport Sync runs on a wider variety of Linux sytems, including OpenWrt and Cygwin and it also runs on OpenBSD. Many embedded devices are powerful enough to power classic Shairport Sync. @@ -57,7 +57,7 @@ Thanks to everyone who has supported and improved Shairport Sync over the years. The audio that Shairport Sync receives is sent to the computer's sound system, to a named unix pipe or to `STDOUT`. By far the best sound system to use is ALSA. This is because ALSA can give direct access to the Digital to Analog Converter (DAC) hardware of the machine. Audio samples can be sent through ALSA directly to the DAC, maximising fidelity, and accurate timing information can be obtained from the DAC, maximising synchronisation. Direct access to hardware is given through ALSA devices with names beginning with `hw:`. ## Synchronised Audio -Shairport Sync offers *full audio synchronisation*. Full audio synchronisation means that audio is played on the output device at exactly the time specified by the audio source. To accomplish this, Shairport Sync needs access to audio systems – such as ALSA on Linux and `sndio` on FreeBSD – that provide very accurate timing information about audio being streamed to output devices. Ideally, Shairport Sync should have direct access to the output device used, which should be a real sound card capable of working with 44,100, 88,200 or 176,400 samples per second, interleaved PCM stereo of 8, 16, 24 or 32 bits. Using the ALSA sound system, Shairport Sync will choose the greatest bit depth available at 44,100 samples per second, resorting to multiples of 44,100 if it is not available. You'll get a message in the log if there's a problem. With all other sound systems, a sample rate of 44,100 is chosen with a bit depth of 16 bit. +Shairport Sync offers *full audio synchronisation*. Full audio synchronisation means that audio is played on the output device at exactly the time specified by the audio source. To accomplish this, Shairport Sync needs access to audio systems – such as ALSA on Linux and `sndio` on FreeBSD and OpenBSD – that provide very accurate timing information about audio being streamed to output devices. Ideally, Shairport Sync should have direct access to the output device used, which should be a real sound card capable of working with 44,100, 88,200 or 176,400 samples per second, interleaved PCM stereo of 8, 16, 24 or 32 bits. Using the ALSA sound system, Shairport Sync will choose the greatest bit depth available at 44,100 samples per second, resorting to multiples of 44,100 if it is not available. You'll get a message in the log if there's a problem. With all other sound systems, a sample rate of 44,100 is chosen with a bit depth of 16 bit. Shairport Sync works well with PulseAudio, a widely used sound server found on many desktop Linuxes. While the timing information is not as accurate as that of ALSA or `sndio`, it is often impractical to remove or disable PulseAudio. From 2eb2cc20e52b4e274d13f90d49913d8e7ac0765d Mon Sep 17 00:00:00 2001 From: Klemens Nanni Date: Tue, 30 Jan 2024 03:14:52 +0100 Subject: [PATCH 3/3] clarify root privilege requirements NQPTP works and runs as _shairport user on OpenBSD. Linux capabilities(7) allow starting as unprivileged user in the first place, otherwise programs only need to start and perform privileged actions such as bind(2)ing sockets as root, after that they can and should! drop privileges. Instead of updating/repeating supported systems, drop listings. --- AIRPLAY2.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/AIRPLAY2.md b/AIRPLAY2.md index 11cba596e..79e32f2ce 100644 --- a/AIRPLAY2.md +++ b/AIRPLAY2.md @@ -18,7 +18,7 @@ Shairport Sync offers AirPlay 2 support for audio sources on iOS devices, Macs f ## General Shairport Sync uses a companion application called [NQPTP](https://github.com/mikebrady/nqptp) ("Not Quite PTP") -for timing and synchronisation in AirPlay 2. NQPTP must run as `root` and must have exclusive access to ports `319` and `320`. +for timing and synchronisation in AirPlay 2. NQPTP must have exclusive access to ports `319` and `320`. Lossless and High Definition Lossless material is transcoded to AAC before it reaches Shairport Sync. @@ -26,12 +26,12 @@ Lossless and High Definition Lossless material is transcoded to AAC before it re AirPlay 2 support needs a slightly more powerful CPU for decoding and synchronisation and more memory for bigger buffers and larger libraries. A system with the power of a Raspberry Pi 2 or Raspberry Pi Zero 2 W, or better, is recommended. Here are some guidelines: -* Full access, including `root` privileges, to a system at least as powerful as a Raspberry Pi 2 or a Raspberry Pi Zero 2 W. +* Full access, including network capabilities or `root` privileges, to a system at least as powerful as a Raspberry Pi 2 or a Raspberry Pi Zero 2 W. * Ports 319 and 320 must be free to use (i.e. they must not be in use by another service such as a PTP service) and must not be blocked by a firewall. -* An up-to-date Linux or FreeBSD. This is important, as some of the libraries must be the latest available. +* An up-to-date system. This is important, as some of the libraries must be the latest available. * Shairport Sync will not run in AirPlay 2 mode on a Mac because NQPTP, on which it relies, needs ports 319 and 320, which are already used by macOS. * A version of the [FFmpeg](https://www.ffmpeg.org) library with an AAC decoder capable of decoding Floating Planar -- `fltp` -- material. There is a guide [here](TROUBLESHOOTING.md#aac-decoder-issues-airplay-2-only) to help you find out if your system has it. -* An audio output, for example an ALSA device (or `sndio` in FreeBSD). The device must be capable of running at 44,100 frames per second. You can use [`sps-alsa-explore`](https://github.com/mikebrady/sps-alsa-explore) to test the suitability of hardware ALSA audio devices on your device. +* An audio output. The device must be capable of running at 44,100 frames per second. You can use [`sps-alsa-explore`](https://github.com/mikebrady/sps-alsa-explore) to test the suitability of hardware ALSA audio devices on your device. Other backends continue to work as with "classic" Shairport Sync. - Multiple instances of the AirPlay 2 version of Shairport Sync can not be hosted on the same system. It seems that AirPlay 2 clients are confused by having multiple AirPlay 2 players at the same IP addresses.