]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
video tweaks for echo app
authorAnthony Minessale <anthm@freeswitch.org>
Mon, 10 Sep 2012 17:58:06 +0000 (12:58 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Mon, 10 Sep 2012 17:58:06 +0000 (12:58 -0500)
src/switch_ivr_async.c

index 4ab523a3a5e619745c196c921d6eed3f3db4735e..03f9839f7866657597b3f80556f520e15b23641d 100644 (file)
@@ -580,11 +580,24 @@ static void *SWITCH_THREAD_FUNC echo_video_thread(switch_thread_t *thread, void
        switch_channel_t *channel = switch_core_session_get_channel(session);
        switch_status_t status;
        switch_frame_t *read_frame;
+       switch_core_session_message_t msg = { 0 };
+
+
+       msg.from = __FILE__;
+       msg.message_id = SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ;
+       
+       switch_core_session_receive_message(session, &msg);
 
        eh->up = 1;
        while (switch_channel_ready(channel)) {
                status = switch_core_session_read_video_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
 
+
+               if (switch_channel_test_flag(channel, CF_VIDEO_REFRESH_REQ)) {
+                       switch_core_session_receive_message(session, &msg);
+                       switch_channel_clear_flag(channel, CF_VIDEO_REFRESH_REQ);
+               }
+
                if (!SWITCH_READ_ACCEPTABLE(status)) {
                        break;
                }
@@ -606,6 +619,8 @@ SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session, swi
        switch_status_t status;
        switch_frame_t *read_frame;
        switch_channel_t *channel = switch_core_session_get_channel(session);
+       int orig_vid = switch_channel_test_flag(channel, CF_VIDEO);
+
 #ifdef SWITCH_VIDEO_IN_THREADS
        struct echo_helper eh = { 0 };
        switch_thread_t *thread;
@@ -615,6 +630,9 @@ SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session, swi
        if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
                return;
        }
+
+ restart:
+
 #ifdef SWITCH_VIDEO_IN_THREADS
        if (switch_channel_test_flag(channel, CF_VIDEO)) {
                eh.session = session;
@@ -630,6 +648,12 @@ SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session, swi
                if (!SWITCH_READ_ACCEPTABLE(status)) {
                        break;
                }
+               
+               if (!orig_vid && switch_channel_test_flag(channel, CF_VIDEO)) {
+                       orig_vid = 1;
+                       goto restart;
+               }
+
 
                switch_ivr_parse_all_events(session);