}
// here, we should check for missing frames
+ const int number_of_resend_attempts = 8;
if (!conn->ab_buffering) {
int j;
- for (j = 1; j <= 8; j++) {
+ for (j = 1; j <= number_of_resend_attempts; j++) {
// check j times, after a short period of has elapsed, assuming 352 frames per packet
- int back_step = (((250 * 44100) / 352) / 1000) * (j); // approx 250 ms intervals
+ // int back_step = (((250 * 44100) / 352) / 1000) * (j); // approx 250 ms intervals
+ // int back_step = ((BUFFER_FRAMES-(22050/352)) / number_of_resend_attempts) * j;
+ int back_step = ((seq_diff(conn->ab_read, conn->ab_write,
+ conn->ab_read)-(22050/352)) / number_of_resend_attempts) * j;
+ if (back_step<(((190 * 44100) / 352) / 1000) * j) {
+ // debug(1,"resend request back_step %d is too small. Reset to %d.",back_step,(((190 * 44100) / 352) / 1000) * j);
+ back_step = (((190 * 44100) / 352) / 1000) * j;
+ }
int k;
for (k = -2; k <= 2; k++) {
if (back_step <
// seq_t read = conn->ab_read;
- // check if t+8, t+16, t+32, t+64, t+128, ... (buffer_start_fill / 2)
- // packets have arrived... last-chance resend
-
if (!curframe->ready) {
// debug(1, "Supplying a silent frame for frame %u", read);
conn->missing_packets++;
"latency from the source.");
inform("Please remove this setting and use the relevant audio_backend_latency_offset setting, "
"if necessary, to compensate for delays elsewhere.");
- if ((config.userSuppliedLatency!=0) && ((config.userSuppliedLatency<4410) || (config.userSuppliedLatency>154350)))
- die("An out-of-range fixed latency has been specified. It must be between 4,410 and 154,350.");
+ if ((config.userSuppliedLatency!=0) && ((config.userSuppliedLatency<4410) || (config.userSuppliedLatency>BUFFER_FRAMES*352-22050)))
+ die("An out-of-range fixed latency has been specified. It must be between 4410 and %d (at 44100 frames per second).",BUFFER_FRAMES*352-22050);
}
/* print out version */