Skip to content

Commit

Permalink
Send "last-chance retry" only once
Browse files Browse the repository at this point in the history
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, ...
  • Loading branch information
Stef Simoens committed Oct 10, 2011
1 parent 62607b2 commit 800453f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions hairtunes.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 800453f

Please sign in to comment.