From 52afedf23d59951c3ac7574af4e440cce7fa4a52 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 15 Sep 2015 12:14:09 -0500 Subject: [PATCH] FS-8053 addtl touchups --- src/include/switch_types.h | 1 + .../mod_conference/conference_video.c | 25 ++++++++++++++++--- .../mod_conference/mod_conference.c | 3 +++ src/switch_core_media.c | 4 +++ src/switch_rtp.c | 12 ++++----- 5 files changed, 34 insertions(+), 11 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index fc81c5b33d..98bdf94d48 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -752,6 +752,7 @@ typedef enum { SWITCH_RTP_FLAG_MUTE, SWITCH_RTP_FLAG_NACK, SWITCH_RTP_FLAG_TMMBR, + SWITCH_RTP_FLAG_GEN_TS_DELTA, SWITCH_RTP_FLAG_INVALID } switch_rtp_flag_t; diff --git a/src/mod/applications/mod_conference/conference_video.c b/src/mod/applications/mod_conference/conference_video.c index 7a81b92b0d..1660a380de 100644 --- a/src/mod/applications/mod_conference/conference_video.c +++ b/src/mod/applications/mod_conference/conference_video.c @@ -3264,13 +3264,27 @@ void conference_video_write_frame(conference_obj_t *conference, conference_membe switch_core_session_rwunlock(isession); } + + if (want_refresh) { + for (imember = conference->members; imember; imember = imember->next) { + switch_core_session_t *isession = imember->session; + + if (!isession || switch_core_session_read_lock(isession) != SWITCH_STATUS_SUCCESS) { + continue; + } + + if (!isession || !switch_channel_test_flag(imember->channel, CF_VIDEO) ) { + continue; + } + + switch_core_session_request_video_refresh(imember->session); + switch_core_session_rwunlock(isession); + } + } + switch_mutex_unlock(conference->member_mutex); switch_img_free(&tmp_frame.img); - - if (want_refresh && floor_holder->session) { - switch_core_session_request_video_refresh(floor_holder->session); - } } switch_status_t conference_video_thread_callback(switch_core_session_t *session, switch_frame_t *frame, void *user_data) @@ -3286,6 +3300,9 @@ switch_status_t conference_video_thread_callback(switch_core_session_t *session, return SWITCH_STATUS_SUCCESS; } + if (switch_core_session_media_flow(session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY) { + return SWITCH_STATUS_SUCCESS; + } if (switch_thread_rwlock_tryrdlock(member->conference->rwlock) != SWITCH_STATUS_SUCCESS) { return SWITCH_STATUS_FALSE; diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 2e69d76b4f..0802b95987 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -302,8 +302,11 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob if (imember->video_media_flow == SWITCH_MEDIA_FLOW_SENDONLY) { conference_utils_member_clear_flag(imember, MFLAG_CAN_BE_SEEN); + conference_video_find_floor(imember, SWITCH_FALSE); } else { conference_utils_member_set_flag(imember, MFLAG_CAN_BE_SEEN); + conference_video_find_floor(imember, SWITCH_TRUE); + switch_core_session_request_video_refresh(imember->session); } } diff --git a/src/switch_core_media.c b/src/switch_core_media.c index ac3f4d6ed7..389873fbda 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -5958,6 +5958,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi flags[SWITCH_RTP_FLAG_BYTESWAP] = 0; } + if ((val = switch_channel_get_variable(session->channel, "rtp_gen_ts_delta")) && switch_true(val)) { + flags[SWITCH_RTP_FLAG_GEN_TS_DELTA] = 1; + } + if (a_engine->rtp_session && switch_channel_test_flag(session->channel, CF_REINVITE)) { //const char *ip = switch_channel_get_variable(session->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE); //const char *port = switch_channel_get_variable(session->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE); diff --git a/src/switch_rtp.c b/src/switch_rtp.c index af7428646d..4ced6cbadb 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -6999,8 +6999,8 @@ static int rtp_common_write(switch_rtp_t *rtp_session, } } - /* TMP DISABLE DFF */ - if (switch_rtp_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO)) { + + if (switch_rtp_test_flag(rtp_session, SWITCH_RTP_FLAG_GEN_TS_DELTA) || switch_rtp_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO)) { /* Normalize the timestamps to our own base by generating a made up starting point then adding the measured deltas to that base so if the timestamps and ssrc of the source change, it will not break the other end's jitter bufffer / decoder etc *cough* CHROME *cough* */ @@ -7010,7 +7010,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session, } if (!rtp_session->ts_norm.last_ssrc || send_msg->header.ssrc != rtp_session->ts_norm.last_ssrc) { - //#define USE_DELTA +#define USE_DELTA #ifdef USE_DELTA if (rtp_session->ts_norm.last_ssrc) { rtp_session->ts_norm.delta_ct = 1; @@ -7028,10 +7028,8 @@ static int rtp_common_write(switch_rtp_t *rtp_session, if (ntohl(send_msg->header.ts) != rtp_session->ts_norm.last_frame) { #ifdef USE_DELTA int32_t delta = (int32_t) (ntohl(send_msg->header.ts) - rtp_session->ts_norm.last_frame); - if (delta > 0 && delta < 90000) { - rtp_session->ts_norm.delta = delta; - } - //printf("WTF %d\n", rtp_session->ts_norm.delta); + + rtp_session->ts_norm.delta = delta; rtp_session->ts_norm.ts += rtp_session->ts_norm.delta; #else switch_core_timer_sync(&rtp_session->timer);