mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-02-09 09:17:34 +00:00
add video update req thingybob
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7538 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
260bf885e1
commit
ba6bd092a7
@ -436,6 +436,7 @@ typedef enum {
|
|||||||
SWITCH_MESSAGE_INDICATE_BROADCAST - indicate media broadcast
|
SWITCH_MESSAGE_INDICATE_BROADCAST - indicate media broadcast
|
||||||
SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT - indicate media broadcast
|
SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT - indicate media broadcast
|
||||||
SWITCH_MESSAGE_INDICATE_DEFLECT - indicate deflect
|
SWITCH_MESSAGE_INDICATE_DEFLECT - indicate deflect
|
||||||
|
SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ - indicate video refresh request
|
||||||
</pre>
|
</pre>
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -455,7 +456,8 @@ typedef enum {
|
|||||||
SWITCH_MESSAGE_INDICATE_RESPOND,
|
SWITCH_MESSAGE_INDICATE_RESPOND,
|
||||||
SWITCH_MESSAGE_INDICATE_BROADCAST,
|
SWITCH_MESSAGE_INDICATE_BROADCAST,
|
||||||
SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT,
|
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;
|
} switch_core_session_message_types_t;
|
||||||
|
|
||||||
|
|
||||||
|
@ -736,7 +736,7 @@ static void *SWITCH_THREAD_FUNC conference_video_thread_run(switch_thread_t *thr
|
|||||||
conference_member_t *imember, *last_member = NULL;
|
conference_member_t *imember, *last_member = NULL;
|
||||||
switch_frame_t *vid_frame;
|
switch_frame_t *vid_frame;
|
||||||
switch_status_t status;
|
switch_status_t status;
|
||||||
int has_vid = 1;
|
int has_vid = 1, req_iframe = 0;
|
||||||
|
|
||||||
conference->video_running = 1;
|
conference->video_running = 1;
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Video thread started for conference %s\n", conference->name);
|
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)) {
|
if (!SWITCH_READ_ACCEPTABLE(status)) {
|
||||||
conference->floor_holder = NULL;
|
conference->floor_holder = NULL;
|
||||||
|
req_iframe = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -759,9 +760,23 @@ static void *SWITCH_THREAD_FUNC conference_video_thread_run(switch_thread_t *thr
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!conference->floor_holder) {
|
||||||
|
req_iframe = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (conference->floor_holder != last_member) {
|
if (conference->floor_holder != last_member) {
|
||||||
int iframe = 0;
|
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 */
|
if (vid_frame->codec->implementation->ianacode == 34) { /* h.263 */
|
||||||
iframe = (*((int16_t*)vid_frame->data) >> 12 == 6);
|
iframe = (*((int16_t*)vid_frame->data) >> 12 == 6);
|
||||||
} else if (vid_frame->codec->implementation->ianacode == 115) { /* h.263-1998 */
|
} 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) {
|
if (!iframe) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
req_iframe = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
last_member = conference->floor_holder;
|
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_set_flag_locked(member, MFLAG_FLUSH_BUFFER);
|
||||||
switch_mutex_lock(member->conference->member_mutex);
|
switch_mutex_lock(member->conference->member_mutex);
|
||||||
if (!member->conference->floor_holder ||
|
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) {
|
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
|
||||||
conference_add_event_member_data(member, event);
|
conference_add_event_member_data(member, event);
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "floor-change");
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "floor-change");
|
||||||
|
@ -712,6 +712,27 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (msg->message_id) {
|
switch (msg->message_id) {
|
||||||
|
case SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ:
|
||||||
|
{
|
||||||
|
const char *pl =
|
||||||
|
"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n"
|
||||||
|
" <media_control>\r\n"
|
||||||
|
" <vc_primitive>\r\n"
|
||||||
|
" <to_encoder>\r\n"
|
||||||
|
" <picture_fast_update>\r\n"
|
||||||
|
" </picture_fast_update>\r\n"
|
||||||
|
" </to_encoder>\r\n"
|
||||||
|
" </vc_primitive>\r\n"
|
||||||
|
" </media_control>\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: {
|
case SWITCH_MESSAGE_INDICATE_BROADCAST: {
|
||||||
const char *ip = NULL, *port = NULL;
|
const char *ip = NULL, *port = NULL;
|
||||||
ip = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE);
|
ip = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user