#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)
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,
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);
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++;
}
}
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)));
}
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;
}
}
}
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;
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);
if (((*flags) & SFF_RTP_HEADER)) {
rtp_session->last_write_ts = ts;
+ rtp_session->flags[SWITCH_RTP_FLAG_RESET] = 0;
}
ret = (int) bytes;