]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[Core] Fix locking and a memory leak in switch_core_session_write_video_frame() and...
authorAndrey Volk <andywolk@gmail.com>
Fri, 24 Apr 2020 22:56:06 +0000 (02:56 +0400)
committerAndrey Volk <andywolk@gmail.com>
Wed, 6 May 2020 23:15:43 +0000 (03:15 +0400)
src/switch_core_media.c

index 936a0d5656d5039a5c456fc46d46e2e2f19db90f..011851686fccf539715a52c85e72e51e06badb91 100644 (file)
@@ -14562,7 +14562,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
 
        v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
        if (v_engine->thread_write_lock && v_engine->thread_write_lock != switch_thread_self()) {
-               return SWITCH_STATUS_SUCCESS;
+               switch_goto_status(SWITCH_STATUS_SUCCESS, done);
        }
 
        if (!smh->video_init && smh->mparams->video_key_first && (now - smh->video_last_key_time) > smh->mparams->video_key_first) {
@@ -14598,7 +14598,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
                if (vid_params.width && vid_params.height && ((vid_params.width != img->d_w) || (vid_params.height != img->d_h))) {
                        switch_img_letterbox(img, &dup_img, vid_params.width, vid_params.height, "#000000f");
                        if (!(img = dup_img)) {
-                               return SWITCH_STATUS_INUSE;
+                               switch_goto_status(SWITCH_STATUS_INUSE, done);
                        }
                }
        }
@@ -15509,7 +15509,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_text_frame(switch_core
 
                if (!switch_buffer_inuse(t_engine->tf->write_buffer)) {
                        t_engine->tf->write_empty++;
-                       return SWITCH_STATUS_BREAK;
+                       switch_goto_status(SWITCH_STATUS_BREAK, done);
                }
 
                frame = &t_engine->tf->text_write_frame;