Increase the RTSP idle timeout to ten seconds, and confine its operation to realtime and classic AirPlay only.:

This commit is contained in:
Mike Brady
2022-09-22 16:25:57 +01:00
parent cae9492d0a
commit a6e02449fb
+11 -7
View File
@@ -1275,14 +1275,11 @@ void clear_ptp_clock() {
ssize_t read_from_rtsp_connection(rtsp_conn_info *conn, void *buf, size_t count) {
// first try to read with a timeout, to see if there is any traffic...
ssize_t response = timed_read_from_rtsp_connection(conn, 4000000000L, buf, count);
ssize_t response = timed_read_from_rtsp_connection(conn, 10000000000L, buf, count);
if ((response == -1) && ((errno == EAGAIN) || (errno == EWOULDBLOCK))) {
if (conn->rtsp_link_is_idle == 0) {
debug(1, "Connection %d: RTSP connection is idle.", conn->connection_number);
conn->rtsp_link_is_idle = 1;
#ifdef CONFIG_AIRPLAY_2
clear_ptp_clock();
#endif
conn->udp_clock_sender_is_initialised = 0;
conn->udp_clock_is_initialised = 0;
}
@@ -1291,15 +1288,22 @@ ssize_t read_from_rtsp_connection(rtsp_conn_info *conn, void *buf, size_t count)
if (conn->rtsp_link_is_idle == 1) {
conn->rtsp_link_is_idle = 0;
debug(1, "Connection %d: RTSP connection traffic has resumed.", conn->connection_number);
#ifdef CONFIG_AIRPLAY_2
if (conn->airplay_stream_type == realtime_stream) {
conn->last_anchor_info_is_valid = 0;
conn->anchor_remote_info_is_valid = 0;
conn->first_packet_timestamp = 0;
conn->input_frame_rate_starting_point_is_valid = 0;
ab_resync(conn);
}
#else
conn->last_anchor_info_is_valid = 0;
conn->anchor_remote_info_is_valid = 0;
conn->local_to_remote_time_difference_measurement_time = 0;
conn->local_to_remote_time_difference = 0;
conn->first_packet_timestamp = 0;
conn->input_frame_rate_starting_point_is_valid = 0;
ab_resync(conn);
#ifdef CONFIG_AIRPLAY_2
conn->last_anchor_info_is_valid = 0;
set_client_as_ptp_clock(conn);
#endif
}
return response;