FS-9719 still not quite right, and enable support to auto engage this feature for pass-thru video
This commit is contained in:
parent
ade33ae472
commit
917d9b44c4
|
@ -775,6 +775,7 @@ typedef enum {
|
|||
SWITCH_RTP_FLAG_NACK,
|
||||
SWITCH_RTP_FLAG_TMMBR,
|
||||
SWITCH_RTP_FLAG_GEN_TS_DELTA,
|
||||
SWITCH_RTP_FLAG_GEN_TS_MANUAL,
|
||||
SWITCH_RTP_FLAG_DETECT_SSRC,
|
||||
SWITCH_RTP_FLAG_TEXT,
|
||||
SWITCH_RTP_FLAG_INVALID
|
||||
|
|
|
@ -7416,10 +7416,6 @@ 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_audio")) && switch_true(val)) {
|
||||
flags[SWITCH_RTP_FLAG_GEN_TS_DELTA] = 1;
|
||||
}
|
||||
|
||||
if (a_engine->rtp_session && is_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);
|
||||
|
@ -7509,10 +7505,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
|
|||
flags[SWITCH_RTP_FLAG_AUTOADJ]++;
|
||||
}
|
||||
|
||||
if ((val = switch_channel_get_variable(session->channel, "rtp_gen_ts_delta_video")) && switch_true(val)) {
|
||||
flags[SWITCH_RTP_FLAG_GEN_TS_DELTA] = 1;
|
||||
}
|
||||
|
||||
timer_name = NULL;
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
|
||||
|
@ -7535,6 +7527,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if ((val = switch_channel_get_variable(session->channel, "rtp_gen_ts_delta_audio")) && switch_true(val)) {
|
||||
flags[SWITCH_RTP_FLAG_GEN_TS_MANUAL] = 1;
|
||||
flags[SWITCH_RTP_FLAG_GEN_TS_DELTA] = 1;
|
||||
}
|
||||
|
||||
if (switch_channel_up(session->channel)) {
|
||||
switch_channel_set_variable(session->channel, "rtp_use_timer_name", timer_name);
|
||||
|
||||
|
@ -8241,6 +8239,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
|
|||
flags[SWITCH_RTP_FLAG_AUTOADJ]++;
|
||||
}
|
||||
|
||||
if ((val = switch_channel_get_variable(session->channel, "rtp_gen_ts_delta_video")) && switch_true(val)) {
|
||||
flags[SWITCH_RTP_FLAG_GEN_TS_MANUAL] = 1;
|
||||
flags[SWITCH_RTP_FLAG_GEN_TS_DELTA] = 1;
|
||||
}
|
||||
|
||||
if (switch_channel_test_flag(session->channel, CF_PROXY_MEDIA)) {
|
||||
flags[SWITCH_RTP_FLAG_PROXY_MEDIA]++;
|
||||
}
|
||||
|
@ -13047,7 +13050,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
|
|||
switch_image_t *dup_img = NULL, *img = frame->img;
|
||||
switch_status_t encode_status;
|
||||
switch_frame_t write_frame = {0};
|
||||
//switch_rtp_engine_t *v_engine;
|
||||
switch_rtp_engine_t *v_engine;
|
||||
|
||||
switch_assert(session);
|
||||
|
||||
|
@ -13081,7 +13084,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
|
|||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
//v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
|
||||
v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
|
||||
if (smh->write_mutex[SWITCH_MEDIA_TYPE_VIDEO] && switch_mutex_trylock(smh->write_mutex[SWITCH_MEDIA_TYPE_VIDEO]) != SWITCH_STATUS_SUCCESS) {
|
||||
/* return CNG, another thread is already writing */
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG1, "%s is already being written to for %s\n",
|
||||
|
@ -13105,8 +13108,18 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
|
|||
}
|
||||
|
||||
if (!img) {
|
||||
switch_status_t vstatus = switch_core_session_write_encoded_video_frame(session, frame, flags, stream_id);
|
||||
switch_status_t vstatus;
|
||||
|
||||
if (!switch_rtp_test_flag(v_engine->rtp_session, SWITCH_RTP_FLAG_GEN_TS_MANUAL)) {
|
||||
switch_rtp_set_flag(v_engine->rtp_session, SWITCH_RTP_FLAG_GEN_TS_DELTA);
|
||||
}
|
||||
|
||||
vstatus = switch_core_session_write_encoded_video_frame(session, frame, flags, stream_id);
|
||||
switch_goto_status(vstatus, done);
|
||||
} else {
|
||||
if (!switch_rtp_test_flag(v_engine->rtp_session, SWITCH_RTP_FLAG_GEN_TS_MANUAL)) {
|
||||
switch_rtp_clear_flag(v_engine->rtp_session, SWITCH_RTP_FLAG_GEN_TS_DELTA);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7603,17 +7603,24 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
|
|||
|
||||
|
||||
if (ntohl(send_msg->header.ts) != rtp_session->ts_norm.last_frame) {
|
||||
if (switch_rtp_test_flag(rtp_session, SWITCH_RTP_FLAG_GEN_TS_DELTA)) {
|
||||
int32_t delta = (int32_t) (ntohl(send_msg->header.ts) - rtp_session->ts_norm.last_frame);
|
||||
int32_t delta = (int32_t) (ntohl(send_msg->header.ts) - rtp_session->ts_norm.last_frame);
|
||||
|
||||
if (switch_rtp_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO) && delta > 0 && delta < 90000) {
|
||||
rtp_session->ts_norm.delta = delta;
|
||||
}
|
||||
|
||||
if (switch_rtp_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO) && delta > 0 && delta < 90000) {
|
||||
rtp_session->ts_norm.delta = delta;
|
||||
}
|
||||
|
||||
if (switch_rtp_test_flag(rtp_session, SWITCH_RTP_FLAG_GEN_TS_DELTA)) {
|
||||
rtp_session->ts_norm.ts += rtp_session->ts_norm.delta;
|
||||
} else {
|
||||
switch_core_timer_sync(&rtp_session->timer);
|
||||
rtp_session->ts_norm.ts = rtp_session->timer.samplecount;
|
||||
if (rtp_session->ts_norm.ts == rtp_session->timer.samplecount) {
|
||||
rtp_session->ts_norm.ts = rtp_session->timer.samplecount + 1;
|
||||
} else {
|
||||
rtp_session->ts_norm.ts = rtp_session->timer.samplecount;
|
||||
}
|
||||
if (send_msg->header.m) {
|
||||
rtp_session->ts_norm.last_frame++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue