From db1e95b3f384b79f06943af2a7e08f386af52b0f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 6 Mar 2017 14:35:19 -0600 Subject: [PATCH] FS-10098: [freeswitch-core] Issue with video media bug in patch mode #resolve --- src/switch_core_media.c | 11 ----------- src/switch_core_media_bug.c | 8 ++++++++ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 9fa2585126..cc18d18c74 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -14037,7 +14037,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core switch_io_event_hook_video_read_frame_t *ptr; uint32_t loops = 0; switch_media_handle_t *smh; - int patchers = 0; int is_keyframe = 0; switch_assert(session != NULL); @@ -14200,10 +14199,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core if (bp->callback && switch_test_flag(bp, SMBF_READ_VIDEO_PING)) { - if (switch_test_flag(bp, SMBF_READ_VIDEO_PATCH)) { - patchers++; - } - bp->video_ping_frame = *frame; if (bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_READ_VIDEO_PING) == SWITCH_FALSE @@ -14233,12 +14228,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core if ((*frame) && (*frame)->codec) { (*frame)->pmap = NULL; - - if (patchers) { - switch_set_flag((*frame)->codec, SWITCH_CODEC_FLAG_VIDEO_PATCHING); - } else { - switch_clear_flag((*frame)->codec, SWITCH_CODEC_FLAG_VIDEO_PATCHING); - } } if (status == SWITCH_STATUS_SUCCESS) { diff --git a/src/switch_core_media_bug.c b/src/switch_core_media_bug.c index df461ccf37..b23330541e 100644 --- a/src/switch_core_media_bug.c +++ b/src/switch_core_media_bug.c @@ -858,6 +858,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(switch_core_session_t switch_clear_flag(session, SSF_MEDIA_BUG_TAP_ONLY); } + if (switch_test_flag(bug, SMBF_READ_VIDEO_PATCH) && session->video_read_codec) { + switch_set_flag(session->video_read_codec, SWITCH_CODEC_FLAG_VIDEO_PATCHING); + } + if (switch_event_create(&event, SWITCH_EVENT_MEDIA_BUG_START) == SWITCH_STATUS_SUCCESS) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Media-Bug-Function", "%s", bug->function); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Media-Bug-Target", "%s", bug->target); @@ -1204,6 +1208,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_close(switch_media_bug_t * switch_thread_join(&st, bp->video_bug_thread); } + if (switch_test_flag(bp, SMBF_READ_VIDEO_PATCH) && bp->session->video_read_codec) { + switch_clear_flag(bp->session->video_read_codec, SWITCH_CODEC_FLAG_VIDEO_PATCHING); + } + switch_core_media_bug_destroy(bp); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(*bug)), SWITCH_LOG_DEBUG, "Removing BUG from %s\n", switch_channel_get_name(bp->session->channel));