From 78d06832e7f87a276b185a77dead18fdca23d8b0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 2 Mar 2015 21:07:48 -0600 Subject: [PATCH] FS-7500: add force flag --- src/include/switch_types.h | 3 ++- src/switch_core_media.c | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 7cda2838a1..f54ec37661 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1769,7 +1769,8 @@ typedef uint32_t switch_file_flag_t; typedef enum { SWITCH_IO_FLAG_NONE = 0, SWITCH_IO_FLAG_NOBLOCK = (1 << 0), - SWITCH_IO_FLAG_SINGLE_READ = (1 << 1) + SWITCH_IO_FLAG_SINGLE_READ = (1 << 1), + SWITCH_IO_FLAG_FORCE = (1 << 2) } switch_io_flag_enum_t; typedef uint32_t switch_io_flag_t; diff --git a/src/switch_core_media.c b/src/switch_core_media.c index d87ed918ce..c1f8e7e9e0 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -4763,7 +4763,7 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi switch_mutex_unlock(mh->file_mutex); } else if (switch_channel_test_flag(channel, CF_VIDEO_DECODED_READ)) { fr.img = blank_img; - switch_core_session_write_video_frame(session, &fr, SWITCH_IO_FLAG_NONE, 0); + switch_core_session_write_video_frame(session, &fr, SWITCH_IO_FLAG_NONE, SWITCH_IO_FLAG_FORCE); } if (read_frame && (switch_channel_test_flag(channel, CF_VIDEO_ECHO))) { @@ -10037,6 +10037,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor return SWITCH_STATUS_SUCCESS; } + if (!(switch_channel_test_flag(session->channel, CF_VIDEO_READY) || (flags & SWITCH_IO_FLAG_FORCE))) { + return SWITCH_STATUS_SUCCESS; + } + if (!smh->video_init && smh->mparams->video_key_first && (now - smh->video_last_key_time) > smh->mparams->video_key_first) { switch_core_media_gen_key_frame(session);