Commit Graph
260 Commits
Author SHA1 Message Date
Mike Brady 1637a79dd6 Add tinyhttp code for sending and reading responses. Clean up some dacp routines. Most new and modified rooutines untested. 2017-12-18 18:50:01 +00:00
Mike Brady ea46a09aea More comprhensive saving and restoring of hardware and software level when a session is stopped and started. Does hardware as well as software. 2017-12-11 16:32:37 +00:00
Mike Brady 6089007bc4 Store the last software volume setting so that it can become the default when the next play sessions starts. This is important if a starting volume is not always given, a new phenomenon in iOS 11.2 and macOS 10.13.2 2017-12-09 20:14:39 +00:00
Mike Brady af50e91232 Intermediate 2017-12-02 16:21:46 +00:00
Mike Brady dc111c8d1d Send playing status as soon as the first packet is received 2017-11-20 11:45:49 +00:00
Mike Brady bafdd94e33 Clang-format 2017-11-19 21:41:11 +00:00
Mike Brady df7c48f0f3 Clean up naming of some files, get the 'stop' command working 2017-11-19 21:16:36 +00:00
Mike Brady 74f41a1769 Reorganise D-BUS interface code and introduce an MPRIS interface. 2017-11-19 16:08:39 +00:00
Mike Brady d4eae76f33 dbus-related files taken from directories and renamed 2017-11-12 15:45:29 +01:00
Mike Brady f5248a20e1 Change the names of some of the files. 2017-11-12 14:49:53 +01:00
Mike Brady 3198ec4265 Improve dbus and add some dacp services 2017-11-12 14:26:10 +01: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 39e122a4ff Fixed dangling pointer to random state array
The C library function initstate(), at least in macOS El Capitan, not only sets the state array given to it as the second argument, but also accesses the state array given to it in a previous call! (I don't know why, or if that behaviour is correct, but macOS seems to do that anyhow).
Therefore, we cannot pass a local variable to it. As soon as the player thread stops, it will be a dangling pointer, and when a new player thread is started afterwards, initstate() will dereference that dangling pointer with unforeseeable consequences.
2017-10-31 23:19:22 +01:00
Mike Brady 6467803858 Adjust the debug level of buffers exhausted and network condition messages. 2017-10-22 11:20:21 +02:00
Mike Brady d343a851c0 Some spring cleaning using clang-format 2017-10-05 17:48:24 +01:00
Mike Brady 139c18bf3e Add avahi code to look for the rmeote control information for the client and get the port number from it. 2017-10-05 17:39:32 +01:00
Mike Brady 1e07e1e0ef Add very very experimental and exploratory systembus dbus support -- subject to change or removal 2017-09-10 13:19:56 +01:00
Mike Brady 3001f39bc5 3.1.2 pretty-print using clang-format 2017-09-07 12:02:00 +01:00
Mike Brady f283f95dcb Fix an issue where it would terminate if it could not allocate an excessively large buffer. 2017-08-28 21:33:29 +01:00
Mike Brady ef507a0e70 Improve debug messages 2017-08-28 12:14:05 +01:00
Mike Brady 7d93af7d27 Quieten some debug messages. 2017-08-27 17:48:47 +01:00
Mike Brady 965d9f63b1 Quieten some debug messages. 2017-08-27 17:01:18 +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 06fa348504 Allow the player thread variable to be a null to indicate presence or absence of player thread 2017-08-25 21:59:52 +01:00
Mike Brady 15ba732458 Change behaviour when TEARDOWN is received -- don't close down the RTSP conversation, but wait for it to be closed. Add more debug messages. 2017-08-25 10:33:17 +01:00
Mike Brady 40e067863c Fix layout of playback complete output. 2017-08-15 22:18:41 +01:00
Mike Brady 23405e7891 Correct spelling error 2017-08-13 10:35:18 +01:00
Mike Brady e513e5330c Tidy up source using clang-format 2017-07-31 11:57:57 +02:00
Mike Brady ede276d4af Allow a zero silent lead-in time. 2017-07-22 17:37:02 +02:00
Mike Brady cf9e662668 Quieten a debug message. 2017-07-21 14:20:41 +02:00
Mike Brady b7864b4ecf Move common audio backend settings like buffer size and offsets to the "general" settings stanza. Improve the resync code a little. 2017-07-21 12:29:03 +02:00
Mike Brady 03887a0582 Quieten some debug messages. 2017-06-30 20:16:41 +01:00
Mike Brady 9ba3ed39a5 Add some settings to the new PulseAudio backend. Limit the silent lead-in time to pipe and stdout backends. Not tested much. 2017-06-30 20:05:48 +01:00
Mike Brady d9c0028f9c Try a different resync mechanism 2017-06-11 15:06:03 +01:00
Mike Brady 0e7bc655dc Restore player.c modifications specific to pa -- not needed now. 2017-05-18 10:25:15 +01:00
Mike Brady b3ae05ea60 Initial very rough full-fat pulseaudio backend 2017-05-17 08:49:40 +01:00
Mike Brady 3d5d39c841 Fix mixing of mono -- do 32-bit add and preserve all 17 bits for later dithering 2017-05-11 06:48:37 +01:00
Mike Brady c4fe414e94 Use hardware volume control only to mute when there is a mixer but no switch. 2017-05-05 17:04:08 +01:00
Mike Brady 721a624c53 Signal presence or absence of hardware volume and mute abilities properly. Fix software-only mute. 2017-05-04 14:06:24 +01:00
Mike Brady 0182cac749 Don't turn the software volume down to zero when muting 2017-05-03 21:48:48 +01:00
Mike Brady 74bbb9a3f2 Only set volume if it has been asked for externally. Clean up mute. Add ability do disable hardware mute 2017-04-30 15:29:02 +01: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 225efa127a Improve debug messages a little 2017-04-16 18:40:05 +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
Mike Brady c991054055 Fix issue where sound from the last play was still there with the next play. Make timing stuff threadsaf, handle volume_max_db correctly when ignore_volume_control is true 2017-04-07 20:18:03 +01:00
Mike Brady e4d5570eee Add rtp init and terminate, mirror all globals in the conn data structure 2017-03-16 13:19:38 +00:00
Mike Brady 728d3d4956 add conn to many procedure calls 2017-03-16 12:33:56 +00:00
Mike Brady 43fdb12aca Fix audio backend latency offset calculations 2017-03-15 21:19:31 +00:00
Mike Brady 684565679c Merge stability changes to develoment branch and its convolution additions 2017-03-11 14:18:52 +00:00
Mike Brady 5c48bfe0e9 De-globalise ab_read and ab_write. player thread now fully reentrant. 2017-03-10 19:57:02 +00:00