FS-5895 --resolve

This commit is contained in:
Anthony Minessale 2014-03-01 04:55:04 +05:00
parent 2c1a25d5f8
commit 719850e508
2 changed files with 12 additions and 9 deletions

View File

@ -706,6 +706,7 @@ typedef enum {
SWITCH_RTP_FLAG_PAUSE,
SWITCH_RTP_FLAG_FIR,
SWITCH_RTP_FLAG_PLI,
SWITCH_RTP_FLAG_RESET,
SWITCH_RTP_FLAG_INVALID
} switch_rtp_flag_t;

View File

@ -67,7 +67,6 @@
#define MASTER_KEY_LEN 30
#define RTP_MAGIC_NUMBER 42
#define MAX_SRTP_ERRS 10
#define RTP_TS_RESET 1
#define DTMF_SANITY (rtp_session->one_second * 30)
@ -4273,7 +4272,8 @@ static void do_2833(switch_rtp_t *rtp_session)
rtp_session->dtmf_data.timestamp_dtmf = rtp_session->last_write_ts + samples;
rtp_session->last_write_ts = rtp_session->dtmf_data.timestamp_dtmf;
rtp_session->flags[SWITCH_RTP_FLAG_RESET] = 0;
wrote = switch_rtp_write_manual(rtp_session,
rtp_session->dtmf_data.out_digit_packet,
4,
@ -4306,7 +4306,7 @@ SWITCH_DECLARE(void) rtp_flush_read_buffer(switch_rtp_t *rtp_session, switch_rtp
if (switch_rtp_ready(rtp_session)) {
rtp_session->last_write_ts = RTP_TS_RESET;
rtp_session->flags[SWITCH_RTP_FLAG_RESET] = 1;
rtp_session->flags[SWITCH_RTP_FLAG_FLUSH] = 1;
reset_jitter_seq(rtp_session);
@ -6048,7 +6048,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
if ((rtp_session->rtp_bugs & RTP_BUG_NEVER_SEND_MARKER)) {
m = 0;
} else {
if ((rtp_session->last_write_ts != RTP_TS_RESET && rtp_session->ts > (rtp_session->last_write_ts + (rtp_session->samples_per_interval * 10)))
if ((!rtp_session->flags[SWITCH_RTP_FLAG_RESET] && rtp_session->ts > (rtp_session->last_write_ts + (rtp_session->samples_per_interval * 10)))
|| rtp_session->ts == rtp_session->samples_per_interval) {
m++;
}
@ -6075,13 +6075,13 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
}
if (m) {
rtp_session->last_write_ts = RTP_TS_RESET;
rtp_session->flags[SWITCH_RTP_FLAG_RESET] = 1;
rtp_session->ts = 0;
}
/* If the marker was set, and the timestamp seems to have started over - set a new SSRC, to indicate this is a new stream */
if (m && !switch_rtp_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND) && (rtp_session->rtp_bugs & RTP_BUG_CHANGE_SSRC_ON_MARKER) &&
(rtp_session->last_write_ts == RTP_TS_RESET || (rtp_session->ts <= rtp_session->last_write_ts && rtp_session->last_write_ts > 0))) {
(rtp_session->flags[SWITCH_RTP_FLAG_RESET] || (rtp_session->ts <= rtp_session->last_write_ts && rtp_session->last_write_ts > 0))) {
switch_rtp_set_ssrc(rtp_session, (uint32_t) ((intptr_t) rtp_session + (uint32_t) switch_epoch_time_now(NULL)));
}
@ -6269,11 +6269,11 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
this_ts = ntohl(send_msg->header.ts);
if (abs(rtp_session->last_write_ts - this_ts) > 16000) {
rtp_session->last_write_ts = RTP_TS_RESET;
rtp_session->flags[SWITCH_RTP_FLAG_RESET] = 1;
}
if (!switch_rtp_ready(rtp_session) || rtp_session->sending_dtmf || !this_ts ||
(rtp_session->last_write_ts > RTP_TS_RESET && this_ts < rtp_session->last_write_ts)) {
(!rtp_session->flags[SWITCH_RTP_FLAG_RESET] && this_ts < rtp_session->last_write_ts)) {
send = 0;
}
}
@ -6386,6 +6386,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
}
rtp_session->last_write_ts = this_ts;
rtp_session->flags[SWITCH_RTP_FLAG_RESET] = 0;
if (rtp_session->queue_delay) {
rtp_session->delay_samples = rtp_session->queue_delay;
@ -6597,7 +6598,7 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "Generating RTP locally but timestamp passthru is configured, disabling....\n");
rtp_session->flags[SWITCH_RTP_FLAG_RAW_WRITE] = 0;
rtp_session->last_write_ts = RTP_TS_RESET;
rtp_session->flags[SWITCH_RTP_FLAG_RESET] = 1;
}
switch_assert(frame != NULL);
@ -6782,6 +6783,7 @@ SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session,
if (((*flags) & SFF_RTP_HEADER)) {
rtp_session->last_write_ts = ts;
rtp_session->flags[SWITCH_RTP_FLAG_RESET] = 0;
}
ret = (int) bytes;