From: Mike Brady Date: Tue, 13 Feb 2018 17:20:08 +0000 (+0000) Subject: Check for missing packets only once, approximately 250 ms after they should have... X-Git-Tag: 3.2d29~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2bcf7528c54d011863002dcabf6aaa9a051ce6a;p=thirdparty%2Fshairport-sync.git Check for missing packets only once, approximately 250 ms after they should have arrived. They may take a good half second to be resent. --- diff --git a/player.c b/player.c index f937d48c..6a64ee97 100644 --- a/player.c +++ b/player.c @@ -528,7 +528,15 @@ void player_put_packet(seq_t seqno, int64_t timestamp, uint8_t *data, int len, } else if (seq_order(conn->ab_read, seqno, conn->ab_read)) { // late but not yet played conn->late_packets++; abuf = conn->audio_buffer + BUFIDX(seqno); + /* + if (abuf->ready) + debug(1,"Late apparently duplicate packet received that is %d packets late.",seq_diff(seqno, conn->ab_write, conn->ab_read)); + else + debug(1,"Late packet received that is %d packets late.",seq_diff(seqno, conn->ab_write, conn->ab_read)); + */ } else { // too late. + + // debug(1,"Too late packet received that is %d packets late.",seq_diff(seqno, conn->ab_write, conn->ab_read)); conn->too_late_packets++; } // pthread_mutex_unlock(&ab_mutex); @@ -1155,17 +1163,15 @@ static abuf_t *buffer_get_frame(rtsp_conn_info *conn) { // packets have arrived... last-chance resend if (!conn->ab_buffering) { - // check at half second intervals - // for (i = 500000/7982 ; i < (seq_diff(conn->ab_read, conn->ab_write, conn->ab_read)); i += 500000/7982) { - // check once, after a second has elapsed, assuming 352 frames per packet - i = 44100/352; + // check once, after a short period of has elapsed, assuming 352 frames per packet + i = ((250*44100)/352)/1000; // approx 250 ms if (iab_read, conn->ab_write, conn->ab_read)) { seq_t next = seq_sum(conn->ab_read, i); abuf = conn->audio_buffer + BUFIDX(next); if (!abuf->ready) { if (config.disable_resend_requests == 0) { rtp_request_resend(next, 1, conn); - // debug(1,"Resend %u.",next); + // debug(1,"Resend request for packet %u.",next); conn->resend_requests++; } }