Commit Graph
104 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 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 455d93485d Quieten a warning from clang on FreeBSD 2017-11-25 20:46:37 +00:00
Mike Brady 3198ec4265 Improve dbus and add some dacp services 2017-11-12 14:26:10 +01:00
Mike Brady 827fa5a5b0 Clean up rtp_send_client_command a little 2017-11-06 09:05:22 +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
Mike Brady 6467803858 Adjust the debug level of buffers exhausted and network condition messages. 2017-10-22 11:20:21 +02:00
Mike Brady 415b3f4ba9 Generalise volumeup to any command. 2017-10-15 13:08:21 +01:00
Mike Brady b3a90f9d6d Make the volumeup command work with IPv6 -- use the scope_id 2017-10-13 22:16:50 +01:00
Mike Brady ce06d45033 Hook up "volumeup" remote control command -- doesn't work on ipv6, it seems 2017-10-09 22:14:34 +01:00
Mike Brady 1e0d0944c0 Tidy up configure.ac and drop old pulseaudio back end 2017-10-09 09:38:35 +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 3001f39bc5 3.1.2 pretty-print using clang-format 2017-09-07 12:02:00 +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 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 ee8629be2b Add more thread numbers 2017-08-23 12:45:57 +01: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 e513e5330c Tidy up source using clang-format 2017-07-31 11:57:57 +02:00
Mike Brady 555c0c738b Fix off-by-one error in enumatering UDP ports in the port_range. Make the error message a little more useful. 2017-04-16 17:09:59 +01:00
Mike Brady 9a8a0f0764 Make this threadsafe and modify the clock drift diagnostics 2017-04-07 18:37:44 +01:00
Mike Brady 672c84c728 Make rtp stuff thread-safe -- remove all globals 2017-03-16 15:47:07 +00:00
Mike Brady 04cb1d0998 deglobalise sockets and reference timestamp 2017-03-16 15:29:16 +00:00
Mike Brady 9efeefdda7 deglobalise self_scope_id for ipv6 2017-03-16 15:09:03 +00:00
Mike Brady 4fdc9d70eb deglobalise client_ip_string and self_ip_string 2017-03-16 15:05:55 +00:00
Mike Brady f3d85bc71a Deglobalise rtp_running, make rtp timing sender use the conn data strucutre 2017-03-16 15:01:08 +00: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 755e95904c De globalise everything except ab_read and ab_write and the volume control stuff 2017-03-10 17:44:50 +00:00
Mike Brady 05305e1581 De-globalise input_bytes_per_frame,output_bytes_per_frame,output_sample_ratio,max_frame_size_change,decoder_info,shutdown_requested,connection_state_to_output,player_thread_please_stop 2017-03-09 16:10:39 +00:00
Mike Brady 7d672bcf56 Untested, probably not working 2017-03-07 22:42:23 +00:00
Mike Brady 9e43f8a7d6 Move to version 3.0 2017-02-24 21:39:02 +00:00
Mike BradyandGitHub 71e7dc0e93 Fix small bug
Thanks to @jief666 for the fix.
2017-01-21 17:30:11 +00:00
Jief 21025440af clock_drift could be left uninitialized.
clock_drift redeclared instead of initialized with "uint64_t clock_drift
= 0".
I think this is the correction.
2016-11-11 19:16:47 +01:00
Jief cf56dc3707 Using Macro instead of LL to make it portable. 2016-11-02 14:58:02 +01:00
Jief d6f1b35748 constant 0x100000000 should be 0x100000000LL to avoid warning 2016-11-01 13:52:38 +01:00
Mike Brady 064bd293c5 Tidy up with a clang-format 2016-09-11 10:35:53 +01:00
Mike Brady ef851a927b Enable 64-bit monotonic rtptime calculations 2016-09-02 16:53:52 +01:00
Edward Barnard f2c784c74d Ensure scope_id is set correctly for ipv6 timing and control sockets 2016-07-09 18:38:36 +02:00
Mike Brady 284dfb94bf Add scope_id to information used to bind an outgoing IPv6 port. Makes it work with link-local addresses. 2016-05-13 16:32:13 +00:00
Mike Brady 76724fd06d Fix omitted line.
Thanks to https://github.com/ejurgensen
2016-05-02 21:46:08 +01:00
Mike Brady bbff2d1efb Get IPv6 working properly 2016-05-02 13:58:17 +01:00
Mike Brady 1fd794af71 tidy up diagnostic messages 2016-05-02 09:45:44 +01:00
Mike Brady 5028cd1f9f Add information about local ip address so we can send back connections to the client from the same ip number it used to contact us 2016-05-01 22:37:57 +01:00
Mike Brady a7682415f1 Comment out the use of the delay() function, and update is to the new signature anyway. 2016-03-29 16:08:15 +00:00
Mike Brady 1dde99daff demote debug info about network 2016-03-27 16:32:24 +00:00
Mike Brady 1805fdb867 Get packet stats at debug level 1 2016-03-26 22:26:52 +00:00
Mike Brady b608655c71 Add comment that get_reference_timestamp_stuff is okay type-wise 2016-03-26 21:42:14 +00:00
Mike Brady 95f1689858 Quieten an out-of-sequence message 2016-02-29 15:15:55 +00:00