Fix a bug to ensure a silent frame is supplied to replace a missing frame.

This commit is contained in:
Mike Brady
2017-03-08 16:17:35 +00:00
parent 7d672bcf56
commit cbcda67f64
+3 -11
View File
@@ -1166,8 +1166,7 @@ static abuf_t *buffer_get_frame(void) {
if (!curframe->ready) {
// debug(1, "Supplying a silent frame for frame %u", read);
missing_packets++;
memset(curframe->data, 0, input_bytes_per_frame * max_frames_per_packet);
curframe->timestamp = 0;
curframe->timestamp = 0; // indicate a silent frame should be substituted
}
curframe->ready = 0;
ab_read = SUCCESSOR(ab_read);
@@ -1698,19 +1697,11 @@ static void *player_thread_func(void *arg) {
inbuflength = inframe->length;
if (inbuf) {
play_number++;
// if it's a supplied silent frame, let us know...
if (inframe->timestamp == 0) {
// debug(1,"Player has a supplied silent frame.");
last_seqno_read =
(SUCCESSOR(last_seqno_read) & 0xffff); // manage the packet out of sequence minder
if (inbuf == NULL)
debug(1, "NULL inbuf to play -- skipping it.");
else {
if (inbuflength == 0)
debug(1, "empty frame to play -- skipping it (1).");
else
config.output->play(inbuf, inbuflength);
}
config.output->play(silence, max_frames_per_packet * output_sample_ratio);
} else {
int enable_dither = 0;
@@ -2067,6 +2058,7 @@ static void *player_thread_func(void *arg) {
}
}
}
// mark the frame as finished
inframe->timestamp = 0;