FS-9586 #resolve [local_stream video queue stuck when not being read from] %backport=1.6

This commit is contained in:
Anthony Minessale 2016-09-28 10:38:15 -05:00 committed by Brian West
parent 6e02ca919f
commit 024602ae2c
1 changed files with 19 additions and 1 deletions

View File

@ -71,6 +71,7 @@ struct local_stream_context {
int newres;
int serno;
int pop_count;
int video_flushes;
switch_size_t blank;
switch_image_t *banner_img;
switch_time_t banner_timeout;
@ -635,7 +636,17 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
switch_mutex_lock(source->mutex);
if (source->context_list) {
if (source->total == 1) {
switch_queue_push(source->context_list->video_q, img);
if (switch_queue_trypush(source->context_list->video_q, img) != SWITCH_STATUS_SUCCESS) {
flush_video_queue(source->context_list->video_q);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Flushing video queue\n");
if (++source->context_list->video_flushes > 1) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Disconnecting file\n");
source->context_list->ready = 0;
}
} else {
source->context_list->video_flushes = 0;
}
} else {
for (cp = source->context_list; cp && RUNNING; cp = cp->next) {
@ -649,6 +660,13 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
if (imgcp) {
if (switch_queue_trypush(cp->video_q, imgcp) != SWITCH_STATUS_SUCCESS) {
flush_video_queue(cp->video_q);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Flushing video queue\n");
if (++cp->video_flushes > 1) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Disconnecting file\n");
cp->ready = 0;
}
} else {
cp->video_flushes = 0;
}
}
}