From 41241681e3593c69e9cdfe074a377cf64a719d6a Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Mon, 23 Apr 2018 13:09:44 +0100 Subject: [PATCH] Make resend error backoff work better and set it to 0.5 seconds. Quieten some routine debug messages. --- dacp.c | 2 +- player.c | 2 +- rtp.c | 11 +++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/dacp.c b/dacp.c index c92c6f05d..53b766163 100644 --- a/dacp.c +++ b/dacp.c @@ -430,7 +430,7 @@ void *dacp_monitor_thread_code(__attribute__((unused)) void *na) { else idle_scan_count = 0; - debug(2, "Scan Result: %d, Bad Scan Count: %d, Idle Scan Count: %d.", result, bad_result_count, + debug(3, "Scan Result: %d, Bad Scan Count: %d, Idle Scan Count: %d.", result, bad_result_count, idle_scan_count); if ((bad_result_count == config.scan_max_bad_response_count) || diff --git a/player.c b/player.c index 704a23dcd..d3dcb0db4 100644 --- a/player.c +++ b/player.c @@ -527,7 +527,7 @@ void player_put_packet(seq_t seqno, uint32_t actual_timestamp, int64_t timestamp check_buf->resend_level = j; if (config.disable_resend_requests == 0) { rtp_request_resend(next, 1, conn); - if (j >= 3) + if (j >= 6) debug(2, "Resend request level #%d for packet %u in range %u to %u.", j, next, conn->ab_read, conn->ab_write); conn->resend_requests++; diff --git a/rtp.c b/rtp.c index 446ba53f2..a6cf22292 100644 --- a/rtp.c +++ b/rtp.c @@ -969,8 +969,8 @@ void rtp_request_resend(seq_t first, uint32_t count, rtsp_conn_info *conn) { } #endif uint64_t time_of_sending_fp = get_absolute_time_in_fp(); - uint64_t resend_error_backoff_time = (uint64_t)10 << 32; // ten seconds - if ((conn->rtp_time_of_last_resend_request_error_fp) || + uint64_t resend_error_backoff_time = (uint64_t)1 << (32-1); // half a second + if ((conn->rtp_time_of_last_resend_request_error_fp==0) || ((time_of_sending_fp - conn->rtp_time_of_last_resend_request_error_fp) > resend_error_backoff_time)) { if ((config.diagnostic_drop_packet_fraction == 0.0) || @@ -979,14 +979,17 @@ void rtp_request_resend(seq_t first, uint32_t count, rtsp_conn_info *conn) { (struct sockaddr *)&conn->rtp_client_control_socket, msgsize) == -1) { char em[1024]; strerror_r(errno, em, sizeof(em)); - debug(1, "Error %d using send-to to an audio socket: \"%s\". ", errno, em); + debug(1, "Error %d using send-to to an audio socket: \"%s\". Backing off for 0.5 seconds.", errno, em); conn->rtp_time_of_last_resend_request_error_fp = time_of_sending_fp; } else { conn->rtp_time_of_last_resend_request_error_fp = 0; } } else { - debug(3, "Dropping resend request packet to simulate a bad network."); + debug(3, "Dropping resend request packet to simulate a bad network. Backing off for 0.5 seconds."); + conn->rtp_time_of_last_resend_request_error_fp = time_of_sending_fp; } + } else { + debug(3,"Backing off sending resend requests due to a previous send-to error"); } } else { // if (!request_sent) {