]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-7641 fix seg from wrongly nulling ping_frame
authorAnthony Minessale <anthm@freeswitch.org>
Sat, 13 Jun 2015 08:13:55 +0000 (03:13 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Sat, 13 Jun 2015 21:19:13 +0000 (16:19 -0500)
src/switch_core_media.c

index deba97131180e160a5800690c4545b6c057f2a14..b2f7e0dd4a6ef61d306cfeb24683e7a2f06c4509 100644 (file)
@@ -10476,20 +10476,21 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
                                switch_frame_t bug_frame = { 0 };
 
                                bug_frame.img = img;
-                               bp->ping_frame = &bug_frame;
-                               
+
                                if (bp->callback && switch_test_flag(bp, SMBF_WRITE_VIDEO_PING)) {
+                                       bp->ping_frame = &bug_frame;
                                        if (bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_WRITE_VIDEO_PING) == SWITCH_FALSE
                                                || (bp->stop_time && bp->stop_time <= switch_epoch_time_now(NULL))) {
                                                ok = SWITCH_FALSE;
                                        }
+                                       bp->ping_frame = NULL;
                                }
 
                                if (switch_core_media_bug_test_flag(bp, SMBF_SPY_VIDEO_STREAM_BLEG) && !patched) {
-                                       switch_core_media_bug_patch_spy_frame(bp, bp->ping_frame->img, SWITCH_RW_WRITE);
+                                       switch_core_media_bug_patch_spy_frame(bp, img, SWITCH_RW_WRITE);
                                }
 
-                               bp->ping_frame = NULL;
+                               
                        }
 
                        if (ok == SWITCH_FALSE) {
@@ -10704,21 +10705,20 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core
 
                        if (bp->ready && (*frame) && (*frame)->img && 
                                (switch_test_flag(bp, SMBF_READ_VIDEO_PING) || (switch_core_media_bug_test_flag(bp, SMBF_SPY_VIDEO_STREAM) && !patched))) {
-                               bp->ping_frame = *frame;
+                               
 
                                if (bp->callback && switch_test_flag(bp, SMBF_READ_VIDEO_PING)) {
+                                       bp->ping_frame = *frame;
                                        if (bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_READ_VIDEO_PING) == SWITCH_FALSE
                                                || (bp->stop_time && bp->stop_time <= switch_epoch_time_now(NULL))) {
                                                ok = SWITCH_FALSE;
                                        }
+                                       bp->ping_frame = NULL;
                                }
 
                                if (switch_core_media_bug_test_flag(bp, SMBF_SPY_VIDEO_STREAM) && !patched) {
                                        switch_core_media_bug_patch_spy_frame(bp, (*frame)->img, SWITCH_RW_READ);
                                }
-                               
-                               
-                               bp->ping_frame = NULL;
                        }
 
                        if (ok == SWITCH_FALSE) {