]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-10098: [freeswitch-core] Issue with video media bug in patch mode #resolve
authorAnthony Minessale <anthm@freeswitch.org>
Mon, 6 Mar 2017 20:35:19 +0000 (14:35 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Mon, 6 Mar 2017 20:35:26 +0000 (14:35 -0600)
src/switch_core_media.c
src/switch_core_media_bug.c

index 9fa25851264a773f418d392aa35262f956d8c42d..cc18d18c7475daa9a1ab2188ac3a638d1076bfaa 100644 (file)
@@ -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) {
index df461ccf377db85195dc52a2148dfc226389aaa4..b23330541e5804c53015fb7c09f7e8e98bcc580b 100644 (file)
@@ -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));