]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-7500: fix some regressions regarding passthru video
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 27 Mar 2015 19:02:07 +0000 (14:02 -0500)
committerMichael Jerris <mike@jerris.com>
Thu, 28 May 2015 17:47:14 +0000 (12:47 -0500)
src/switch_channel.c
src/switch_core_media.c
src/switch_ivr_bridge.c

index 10a2af61ec7c9f2c93005ef0859554b77b6ae238..41f4ca1c9941536425788a9baeb436f162600c29 100644 (file)
@@ -1966,8 +1966,11 @@ SWITCH_DECLARE(void) switch_channel_clear_flag(switch_channel_t *channel, switch
                ACTIVE = 1;
        }
 
-       if (flag == CF_VIDEO_PASSIVE && channel->flags[flag]) {
-               CLEAR = 1;
+       if (flag == CF_VIDEO_PASSIVE) {
+               channel->flags[CF_VIDEO_READY] = 1;
+               if (channel->flags[flag]) {
+                       CLEAR = 1;
+               }
        }
 
        channel->flags[flag] = 0;
index a043fb9e55252ec4dc8e3e7522bf64dd03ce7907..a80472a81bff0dd869654b1a01c8180eb16b12d8 100644 (file)
@@ -4698,6 +4698,10 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi
                        xloops = 0;
                }
 
+               if (!switch_channel_test_flag(channel, CF_VIDEO_DECODED_READ) && (xloops > 20 || switch_channel_test_flag(channel, CF_VIDEO_PASSIVE))) {
+                       switch_channel_set_flag(channel, CF_VIDEO_READY);
+               }
+       
                if (switch_channel_test_flag(channel, CF_VIDEO_PASSIVE) || do_sleep) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Video thread paused. Echo is %s\n", 
                                                          switch_channel_get_name(session->channel), switch_channel_test_flag(channel, CF_VIDEO_ECHO) ? "on" : "off");
@@ -4742,24 +4746,22 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi
 
                if (!smh->video_write_fh || !switch_channel_test_flag(channel, CF_VIDEO_READY)) {
                        status = switch_core_session_read_video_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
-               
+
                        if (!SWITCH_READ_ACCEPTABLE(status)) {
                                switch_cond_next();
                                continue;
                        }
-
+                       
                        if (switch_test_flag(read_frame, SFF_CNG)) {
                                continue;
                        }
-                       
+
                        if (read_frame->img) {
                                if (++viloops > 10) {
                                        switch_channel_set_flag(channel, CF_VIDEO_READY);
                                        smh->vid_params.width = read_frame->img->d_w;
                                        smh->vid_params.height = read_frame->img->d_h;
                                }
-                       } else if (read_frame->datalen > 2 && !switch_channel_test_flag(channel, CF_VIDEO_DECODED_READ) && vloops > 20) {
-                               switch_channel_set_flag(channel, CF_VIDEO_READY);
                        }
                }
 
@@ -4770,7 +4772,7 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi
                
                vloops++;
 
-               if (!buf) {
+               if (!buf && switch_channel_test_flag(channel, CF_VIDEO_DECODED_READ)) {
                        int buflen = SWITCH_RECOMMENDED_BUFFER_SIZE * 4;
                        buf = switch_core_session_alloc(session, buflen);
                        fr.packet = buf;
index 22bf827f269b0176beb938106351f4bfe1646361..68b1efd300531c4c569c64ce49efb3561240b14e 100644 (file)
@@ -63,7 +63,6 @@ static void video_bridge_thread(switch_core_session_t *session, void *obj)
        switch_core_session_request_video_refresh(vh->session_b);
 
        while (switch_channel_up_nosig(channel) && switch_channel_up_nosig(b_channel) && vh->up == 1) {
-
                if (switch_channel_media_up(channel)) {
                        switch_codec_t *a_codec = switch_core_session_get_video_read_codec(vh->session_a);
                        switch_codec_t *b_codec = switch_core_session_get_video_write_codec(vh->session_b);
@@ -92,7 +91,6 @@ static void video_bridge_thread(switch_core_session_t *session, void *obj)
                                continue;
                        }
                }
-
        }
 
        switch_core_session_kill_channel(vh->session_b, SWITCH_SIG_BREAK);