video tweaks for echo app

This commit is contained in:
Anthony Minessale 2012-09-10 12:58:06 -05:00
parent f71b67e02c
commit 0fd5d7696c
1 changed files with 24 additions and 0 deletions

View 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);