FS-11750: JB fix: avoid infinite loop when chan var rtp_nack_buffer_size is small (initial max_packet_len)

This commit is contained in:
Dragos Oancea 2019-04-03 13:56:59 +00:00 committed by Andrey Volk
parent 385769344b
commit f2e7e69be3
1 changed files with 5 additions and 2 deletions

View File

@ -1256,11 +1256,14 @@ SWITCH_DECLARE(switch_status_t) switch_jb_put_packet(switch_jb_t *jb, switch_rtp
add_node(jb, packet, len);
if (switch_test_flag(jb, SJB_QUEUE_ONLY) && jb->max_packet_len
&& jb->allocated_nodes > jb->max_frame_len * 2 - 1) {
if (switch_test_flag(jb, SJB_QUEUE_ONLY) && jb->max_packet_len && jb->max_frame_len * 2 > jb->max_packet_len &&
jb->allocated_nodes > jb->max_frame_len * 2 - 1) {
while ((jb->max_frame_len * 2 - jb->visible_nodes) < jb->max_packet_len) {
drop_oldest_frame(jb);
}
} else if (switch_test_flag(jb, SJB_QUEUE_ONLY) && jb->max_packet_len && jb->max_frame_len * 2 < jb->max_packet_len) {
/* rtp_nack_buffer_size less than initial max_packet_len */
drop_oldest_frame(jb);
}
switch_mutex_unlock(jb->mutex);