From 800453f62b50bfd0c0aff988972b08082ac64b09 Mon Sep 17 00:00:00 2001 From: Stef Simoens Date: Mon, 10 Oct 2011 09:23:19 +0200 Subject: [PATCH] Send "last-chance retry" only once The last-chance resend was sometimes fired up to 6 times (probably while receiving multiple new packets while playing the same buffer-data). The following patch corrects this: only one retry is sent out. For this to happen, I change abuf->ready to -1 ("1 retry sent out") and by changing the other comparisons of abuf->ready to != 1. Probably, this could be improved, by implementing a first check at t-30, t-20, t-10, ... --- hairtunes.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hairtunes.c b/hairtunes.c index 28b49069..4b54915a 100644 --- a/hairtunes.c +++ b/hairtunes.c @@ -393,8 +393,10 @@ void buffer_put_packet(seq_t seqno, char *data, int len) { // check if the t+10th packet has arrived... last-chance resend read = ab_read + 10; abuf = audio_buffer + BUFIDX(read); - if (!abuf->ready) + if (abuf->ready != 1) { rtp_request_resend(read, read); + abuf->ready = -1; + } } } @@ -671,7 +673,7 @@ short *buffer_get_frame(void) { bf_est_update(buf_fill); volatile abuf_t *curframe = audio_buffer + BUFIDX(read); - if (!curframe->ready) { + if (curframe->ready != 1) { fprintf(stderr, "\nmissing frame.\n"); memset(curframe->data, 0, FRAME_BYTES); }