diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 112c387748..dc0c08ec10 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -436,6 +436,7 @@ typedef enum { SWITCH_MESSAGE_INDICATE_BROADCAST - indicate media broadcast SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT - indicate media broadcast SWITCH_MESSAGE_INDICATE_DEFLECT - indicate deflect + SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ - indicate video refresh request */ typedef enum { @@ -455,7 +456,8 @@ typedef enum { SWITCH_MESSAGE_INDICATE_RESPOND, SWITCH_MESSAGE_INDICATE_BROADCAST, SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT, - SWITCH_MESSAGE_INDICATE_DEFLECT + SWITCH_MESSAGE_INDICATE_DEFLECT, + SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ } switch_core_session_message_types_t; diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 53dca94fc0..814cefc35c 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -736,7 +736,7 @@ static void *SWITCH_THREAD_FUNC conference_video_thread_run(switch_thread_t *thr conference_member_t *imember, *last_member = NULL; switch_frame_t *vid_frame; switch_status_t status; - int has_vid = 1; + int has_vid = 1, req_iframe = 0; conference->video_running = 1; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Video thread started for conference %s\n", conference->name); @@ -752,6 +752,7 @@ static void *SWITCH_THREAD_FUNC conference_video_thread_run(switch_thread_t *thr if (!SWITCH_READ_ACCEPTABLE(status)) { conference->floor_holder = NULL; + req_iframe = 0; continue; } @@ -759,9 +760,23 @@ static void *SWITCH_THREAD_FUNC conference_video_thread_run(switch_thread_t *thr continue; } + if (!conference->floor_holder) { + req_iframe = 0; + continue; + } + if (conference->floor_holder != last_member) { int iframe = 0; - + switch_core_session_message_t msg = { 0 }; + + if (!req_iframe) { + /* Tell the channel to request a fresh vid frame */ + msg.from = __FILE__; + msg.message_id = SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ; + switch_core_session_receive_message(conference->floor_holder->session, &msg); + req_iframe = 1; + } + if (vid_frame->codec->implementation->ianacode == 34) { /* h.263 */ iframe = (*((int16_t*)vid_frame->data) >> 12 == 6); } else if (vid_frame->codec->implementation->ianacode == 115) { /* h.263-1998 */ @@ -776,6 +791,8 @@ static void *SWITCH_THREAD_FUNC conference_video_thread_run(switch_thread_t *thr if (!iframe) { continue; } + + req_iframe = 0; } last_member = conference->floor_holder; @@ -1500,7 +1517,8 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t * thread, switch_set_flag_locked(member, MFLAG_FLUSH_BUFFER); switch_mutex_lock(member->conference->member_mutex); if (!member->conference->floor_holder || - !switch_test_flag(member->conference->floor_holder, MFLAG_TALKING) || member->score > member->conference->floor_holder->score) { + !switch_test_flag(member->conference->floor_holder, MFLAG_TALKING) || member->score > + member->conference->floor_holder->score + 200) { if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { conference_add_event_member_data(member, event); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "floor-change"); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index c41aa09f56..e96b54eea8 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -712,6 +712,27 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi } switch (msg->message_id) { + case SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ: + { + const char *pl = + "\r\n" + " \r\n" + " \r\n" + " \r\n" + " \r\n" + " \r\n" + " \r\n" + " \r\n" + " \r\n"; + + nua_info(tech_pvt->nh, + SIPTAG_CONTENT_TYPE_STR("application/media_control+xml"), + SIPTAG_PAYLOAD_STR(pl), + TAG_END()); + + + } + break; case SWITCH_MESSAGE_INDICATE_BROADCAST: { const char *ip = NULL, *port = NULL; ip = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE);