Commit Graph
200 Commits
Author SHA1 Message Date
Mike Brady 66e29394c1 Add some infrastructure to print message contents and so send reply messages with content. Add compatability with Swinsian 2017-12-12 11:56:47 +00:00
Mike Brady 86f76ad6ce Improve the sync between AirPlay and movies like YouTube. Not sure we understand the negotiation for syncing. 2017-12-10 22:26:19 +00:00
Mike Brady 42b2a8c597 Fix bug in ooutput of 'flsr' metadata item -- remove the leading equals sign. 2017-12-04 08:36:11 +00:00
Mike Brady bafdd94e33 Clang-format 2017-11-19 21:41:11 +00: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 afa3238829 Fixed EINTR handling in rtsp_read_request()
EINTR is an error code written to errno, not returned by read().
2017-10-31 23:19:22 +01:00
Belbo a704b2fe0b handle_announce() waits for playing_conn to stop if it's already shutting down
- If playing_conn is already stopping, handle_announce() waits one second for it to stop. This gives the current RTSP connection a better chance to get the player, if it has been started very quickly after the previous RTSP connection had decided to stop. iTunes can sometimes be very quick in starting a new RTSP connection after tearing down the previous one, but shairport_sync unfortunately needs at least 100ms to shut down the old connection.
- cleanup_threads() sets playing_conn to NULL if it points to the removed thread, otherwise playing_conn would be a dangling pointer, which is bad, because handle_announce() dereferences it unless it is NULL.
2017-10-31 23:19:22 +01:00
Mike Brady 338831455b Oops -- a little typo. 2017-10-15 14:38:52 +01:00
Mike Brady 3cb86f400b Add the 'dapo' metadata message, giving the DACP port number when found 2017-10-15 14:23:09 +01: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 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 ef507a0e70 Improve debug messages 2017-08-28 12:14:05 +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 8cf8ca7b79 Change some debug messages. 2017-08-26 09:44:03 +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 4a77f45c1c Add extra codes to outcome of rtsp read, add more diagnostics 2017-08-23 18:04:23 +01:00
Mike Brady ee8629be2b Add more thread numbers 2017-08-23 12:45:57 +01:00
Mike Brady ce262b7b53 Add index numbers for each RTSP conversation thread, to help figure debug messages out better. 2017-08-21 18:19:09 +02:00
Mike Brady abd342553a Add index numbers for each RTSP conversation thread, to help figure debug messages out better. 2017-08-21 18:08:41 +02:00
Mike Brady 931a650b7c Revert "Terminate the player thread synchronously, properly, before returning an OK on TEARDOWN request. Stop using one second time period."
This reverts commit 15ac884cb6.

This change isn't fully baked yet. Causes problems in FreeBSD.
2017-08-16 14:05:39 +01:00
Mike Brady 15ac884cb6 Terminate the player thread synchronously, properly, before returning an OK on TEARDOWN request. Stop using one second time period. 2017-08-15 22:20:04 +01:00
Mike Brady 2508853332 Wait for play session to fully terminate before acknowledging a TEARDOWN request. 2017-08-14 13:20:10 +01:00
Mike Brady e513e5330c Tidy up source using clang-format 2017-07-31 11:57:57 +02:00
Mike Brady 5663858c63 Tidy up and/or suppress some debug messages 2017-07-22 18:09:39 +02:00
Mike Brady f347f97979 Add a brief comment about the chunking sub-protocol 2017-06-04 15:39:42 +01:00
Paul Guyot 30d05a7937 Send metadata too large for UDP maximum message size into chunks. 2017-06-04 14:15:13 +00:00
Paul Guyot c0748d36cd Make sure socket send buffer is large enough for all metadata. 2017-06-04 14:13:31 +00:00
Mike Brady a705a3d709 Modify a debug message 2017-04-30 15:29:44 +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 6009d43abf Move the code to cehck for ignoring volume control to player.c 2017-04-07 18:39:09 +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 e122fde2fb Add some debug messages around requests to stop and wathc out for double announcements 2017-03-16 08:47:26 +00:00
Mike Brady 0d22130081 Add specific metadat message when a FLUSH message is received. Also add diabnostic for fmtp parameters. 2017-03-15 14:49:02 +00:00
Mike Brady 10f3bc1eab Clean up creation of conversation thread -- no functional difference. 2017-03-14 10:38:48 +00:00
Mike Brady 2b6a9420a9 Add a memory barrier after initialising the rtsp_conn record. Stop a potential race condition. 2017-03-14 09:45:06 +00:00
Mike Brady f06e638d24 de-globalise flowcontrol ab_mutex,flush_mutex, first_packet_time_to_play, time_since_play_started 2017-03-09 17:22:48 +00:00
Mike Brady 7d672bcf56 Untested, probably not working 2017-03-07 22:42:23 +00:00
Mike Brady cf29625d2c Clang Format 2017-02-11 12:12:07 +00:00
Mike Brady 62aaf07478 Add support for mbed TLS and deprecate polarssl support 2017-01-30 08:21:12 +00:00
jneubrand 5c85e614c0 Merge fix-clip 2016-11-26 11:48:03 -08:00
Mike Brady 622549c7df If sync disabled on the alsa device, don't keep asking for buffer length. Also emit sender IP number as metadata. 2016-09-21 20:57:33 +01:00
Mike Brady 064bd293c5 Tidy up with a clang-format 2016-09-11 10:35:53 +01:00