Allow a great number of buffers and parameterise the fixed latency limits.

This commit is contained in:
Mike Brady
2018-05-15 09:11:50 +01:00
parent 8f76c853ed
commit 431586726d
2 changed files with 12 additions and 7 deletions
+10 -5
View File
@@ -512,11 +512,19 @@ void player_put_packet(seq_t seqno, uint32_t actual_timestamp, int64_t timestamp
}
// 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 <
@@ -1217,9 +1225,6 @@ static abuf_t *buffer_get_frame(rtsp_conn_info *conn) {
// 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++;
+2 -2
View File
@@ -1362,8 +1362,8 @@ int main(int argc, char **argv) {
"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 */