Commit Graph
81 Commits
Author SHA1 Message Date
Mike Brady d692fab9e4 Clean up native dbus interface files and associated changes to existing files. 2018-03-20 16:31:59 +00:00
Mike Brady fba40733f3 Add more basic remote control stuff, but SPS gets confused about who it can control. 2018-03-18 19:10:45 +00:00
Mike Brady 13931664ed Check if locks are already acquired. 2018-03-16 15:57:35 +00:00
Mike Brady 9d9b0a1824 Add a Shairport Sync Diagnostics DBus Onject, only part working 2018-03-10 17:01:42 +00:00
Mike Brady c36a7822a3 Tidy up using clang-format 2018-03-07 14:35:25 +00:00
Mike Brady 07e46565ca Eliminate almost all warnings from -Wall 2018-03-07 14:29:14 +00:00
Mike Brady a7d82ae823 Begin to avoid strict aliasing violations -- not finished yet. 2018-03-07 08:58:23 +00:00
Mike Brady 71a9a0cb81 Add timings to warnings and die messages if debugging is enabled. 2018-02-20 09:20:21 +00:00
Mike Brady 283e4930e8 Add support for OpenBSD compilation 2018-02-09 21:11:39 +00:00
Mike Brady a89742e3a0 Quieten some debug messages. 2018-02-05 18:10:49 +00:00
Mike Brady a0bb2993df Add timing to debug messages, make timing sender wait interruptable eveyr 20 ms, thus making TEARDOWN faster. 2018-02-03 20:24:58 +00:00
Mike Brady f83b86ec23 Add the option to use a flat volume control profile. 2018-01-29 22:28:22 +00:00
Mike Brady 86b72a981a Fix small compilation bug evident in FreeBSD 2018-01-23 10:18:02 +00:00
Mike Brady 7a73e8fd2a Brown bag update. Fix compilation errors when neither mpris nor dbus is selected. 2018-01-17 10:32:31 +00:00
Mike Brady 4aaa8d19fe Implement a rudimentary cover art file writing facility. 2018-01-16 22:22:03 +00:00
Belbo b98e6a9ac0 Fixed race condition when stopping other threads with SIGUSR1
Many threads have a main loop that checks some exit variable in the loop condition. To stop a thread, another thread sets that exit variable, sends a SIGUSR1 to that thread to get it out of blocking calls like read(), write() or select(), and finally joins it.

There was a race condition though: if the signal arrived after the loop condition was checked but before the blocking system function was entered, the target thread essentially ignored the signal, made the blocking call anyway, and could get stuck forever there.

The only way around this race condition is to block SIGUSR1 in the destination thread during the critical time interval. This requires that the blocking system call and the call to unblock SIGUSR1 be an atomic unit. There is only one system call that makes this possible: pselect(), which takes a signal mask to replace the current signal mask with, but only while pselect() runs. Other functions like read(), recv(), write() and sendto() may only be called if we can be sure that they don't block. For this purpose, the file descriptors must be set to non-blocking mode and we must prepend the call to them with a call to pselect() to block until the socket becomes readable/writable.
2017-11-01 20:46:05 +01:00
Belbo 3e54765193 Fixed loop condition in non_blocking_write()
The while loop should be repeated, if the last write attempt was a partial write only. In this case, however, rc is greater than 0 (should be 1), not equal to 0.
2017-10-31 23:19:22 +01:00
Belbo 19ff6042cf Prevent buffer overflow in log functions
die(), warn(), debug() and inform() write the string into a limited internal buffer first. They now use vsnprintf() instead of vsprintf() to prevent an overflow of that buffer.
2017-10-31 23:19:21 +01:00
Mike Brady 3001f39bc5 3.1.2 pretty-print using clang-format 2017-09-07 12:02:00 +01:00
Mike Brady 48c1d3eb20 Add fixes suggested by using "infer" 2017-09-03 22:46:57 +01:00
Mike Brady 31a09bb368 Fix some silent issues that were highlighted by "infer" 2017-09-03 15:08:13 +01:00
Mike Brady d3148eb464 Improve handling of player lock and simplify handling of loss of connection and improve some debug messages 2017-08-27 12:43:42 +01:00
Mike Brady e513e5330c Tidy up source using clang-format 2017-07-31 11:57:57 +02:00
Cody Cutrer 3e9e228564 read stdout from the on-start command to choose ALSA output device
refs GH-452
2017-06-24 19:46:03 -06:00
Mike Brady e37c277b0a Add a "run_this_when_volume_is_set" facility to call a program when the volume is set. The AirPlay volume is passed. 2017-04-23 12:37:11 +01:00
Mike Brady a53b4c5c36 Fix some warnings from clang on FreeBSD. One was significant -- the randarray stuff didn't look right. 2017-04-16 16:52:43 +01:00
Tobias Kortkamp c9e378f515 FreeBSD doesn't have ETIME but both FreeBSD and Linux know ETIMEDOUT 2017-04-15 02:28:57 +02:00
Mike Brady 5855264eff Improve error reporting in non-blocking write code 2017-04-07 18:45:28 +01:00
Yann Pomarede 2ab2a84c14 change function die, warn, inform and debug
change funcions die, warn, inform and debug argument from `char*` to `const char*` to prevent a warning in C==
2017-02-28 12:47:03 +01:00
Mike Brady cf29625d2c Clang Format 2017-02-11 12:12:07 +00:00
Mike Brady 2a4a4ed22b Add volume_max_db setting which works on the hw mixer if it exists or the sw attenuator otherwise. 2017-02-05 16:18:05 +00:00
Mike Brady 0764199545 Add possibility of using an array of precalculated pseudo random numbers to reduce processor load. 2017-01-30 18:34:09 +00:00
Mike Brady 62aaf07478 Add support for mbed TLS and deprecate polarssl support 2017-01-30 08:21:12 +00:00
Mike Brady 064bd293c5 Tidy up with a clang-format 2016-09-11 10:35:53 +01:00
Mike Brady 8d008fa2ec Begin to add full-scale post processing. Does not compile. 2016-09-08 15:56:22 +01:00
Mike Brady 4849c1d429 Remove mersenne generator -- too slow, try another one 2016-09-07 16:55:14 +01:00
Mike Brady 945483d9c3 Merge support of apple's ALAC decoder 2016-08-28 21:38:24 +01:00
Mike Brady 1fe705cf5f Remove variable delay from non_blocking_write and include it whether metadata is enabled or not. Remove the INSTALL file and ignroe it in git. 2016-06-26 15:20:09 +01:00
Mike Brady a1b975106a Quieten some debug messages. 2016-05-26 08:28:06 +01:00
Mike Brady fd336f45c4 Merge pull request #314 from joerg-krause/development
Fix build without metadata support
2016-05-23 23:11:00 +01:00
Mike Brady e5c6ea8b29 Add some diagnostics to non_blocking_write/3. 2016-05-23 21:10:15 +01:00
Jörg Krause 28efe16f73 Fix build without metadata support
Commit f36352dc4e introduced the parameter
pipe_timeout for the metadata config. If shairport-sync is now configured
without metadata support, the build fails with:

```
shairport.c: In function ‘main’:
shairport.c:766:9: error: ‘shairport_cfg {aka struct <anonymous>}’ has no member named ‘metadata_pipe_timeout’
   config.metadata_pipe_timeout = 5000; //milliseconds

```

Fix this by opting-out the affected code with CONFIG_METADATA.
2016-05-23 22:01:46 +02:00
Mike Brady 870de08db5 Add a little extra diagnostic to nno-blocking write 2016-05-23 16:43:02 +01:00
Mike Brady f36352dc4e Add setting for the time to wait for the metadata pipe to come ready, otherwise give up. Default 5,000 milliseconds. 2016-05-23 14:03:38 +01:00
Mike Brady 5f6f4a2636 replace the nonblocking write code 2016-05-23 11:58:22 +01:00
Mike Brady 46fac92f6c Add a utility for string substitution, rename apname to service_name 2016-05-21 13:05:15 +01:00
Jörg Krause f230e3e543 Fix vol2attn
This fixes calculation of the scaled attenuation if `max_dB` is different from
zero.

Closes: https://github.com/mikebrady/shairport-sync/issues/290
2016-05-09 15:10:37 +02:00
Mike Brady d02bb0e336 If the volume is out of range 0 -- -30 or -144, return minimum vol 2016-04-27 10:23:15 +02:00
Mike Brady e3986855dd Add type check comment. 2016-03-26 21:36:40 +00:00
Mke Brady 3b88d05137 Add CYGWIN flag check to be recognised as Posix-enough (?) 2015-10-21 10:22:56 +01:00