From a128d3179e9d85faed8045f89376abd37aa104c8 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 19 Apr 2006 16:44:01 +0000 Subject: [PATCH] update git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1198 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/include/switch_rtp.h | 2 +- src/mod/endpoints/mod_dingaling/mod_dingaling.c | 4 ++-- src/mod/endpoints/mod_exosip/mod_exosip.c | 6 ++++-- src/switch_rtp.c | 13 +++++++------ 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/include/switch_rtp.h b/src/include/switch_rtp.h index 4d4d89c32c..762e5b9802 100644 --- a/src/include/switch_rtp.h +++ b/src/include/switch_rtp.h @@ -283,7 +283,7 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp *rtp_session, switch_frame \param flags frame flags \return the number of bytes written */ -SWITCH_DECLARE(int) switch_rtp_write_payload(switch_rtp *rtp_session, void *data, uint16_t datalen, switch_payload_t payload, uint32_t ts, uint16_t mseq, switch_frame_flag *flags); +SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp *rtp_session, void *data, uint16_t datalen, uint8_t m, switch_payload_t payload, uint32_t ts, uint16_t mseq, switch_frame_flag *flags); /*! \brief Retrieve the SSRC from a given RTP session diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index e6d58b734c..ed43f307c1 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -812,7 +812,7 @@ static switch_status channel_write_frame(switch_core_session *session, switch_fr for (x = 0; x < loops; x++) { - switch_rtp_write_payload(tech_pvt->rtp_session, tech_pvt->out_digit_packet, 4, 101, ts, tech_pvt->out_digit_seq, &frame->flags); + switch_rtp_write_manual(tech_pvt->rtp_session, tech_pvt->out_digit_packet, 4, 0, 101, ts, tech_pvt->out_digit_seq, &frame->flags); /* printf("Send %s packet for [%c] ts=%d sofar=%u dur=%d\n", loops == 1 ? "middle" : "end", tech_pvt->out_digit, ts, tech_pvt->out_digit_sofar, duration); @@ -837,7 +837,7 @@ static switch_status channel_write_frame(switch_core_session *session, switch_fr ts = tech_pvt->timestamp_dtmf += samples; tech_pvt->out_digit_seq++; for (x = 0; x < 3; x++) { - switch_rtp_write_payload(tech_pvt->rtp_session, tech_pvt->out_digit_packet, 4, 101, ts, tech_pvt->out_digit_seq, &frame->flags); + switch_rtp_write_manual(tech_pvt->rtp_session, tech_pvt->out_digit_packet, 4, 1, 101, ts, tech_pvt->out_digit_seq, &frame->flags); /* printf("Send start packet for [%c] ts=%d sofar=%u dur=%d\n", tech_pvt->out_digit, ts, tech_pvt->out_digit_sofar, 0); diff --git a/src/mod/endpoints/mod_exosip/mod_exosip.c b/src/mod/endpoints/mod_exosip/mod_exosip.c index 68aaa0afe3..d17172e9cb 100644 --- a/src/mod/endpoints/mod_exosip/mod_exosip.c +++ b/src/mod/endpoints/mod_exosip/mod_exosip.c @@ -736,7 +736,9 @@ static switch_status exosip_write_frame(switch_core_session *session, switch_fra for (x = 0; x < loops; x++) { frame->flags = 0; - switch_rtp_write_payload(tech_pvt->rtp_session, tech_pvt->out_digit_packet, 4, 101, ts, tech_pvt->out_digit_seq, &frame->flags); + switch_rtp_write_manual(tech_pvt->rtp_session, + tech_pvt->out_digit_packet, 4, 0, 101, ts, + loops == 1 ? tech_pvt->out_digit_seq++ : tech_pvt->out_digit_seq, &frame->flags); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send %s packet for [%c] ts=%d sofar=%u dur=%d\n", loops == 1 ? "middle" : "end", tech_pvt->out_digit, @@ -764,7 +766,7 @@ static switch_status exosip_write_frame(switch_core_session *session, switch_fra tech_pvt->out_digit_seq++; for (x = 0; x < 3; x++) { frame->flags = 0; - switch_rtp_write_payload(tech_pvt->rtp_session, tech_pvt->out_digit_packet, 4, 101, ts, tech_pvt->out_digit_seq, &frame->flags); + switch_rtp_write_manual(tech_pvt->rtp_session, tech_pvt->out_digit_packet, 4, 1, 101, ts, tech_pvt->out_digit_seq, &frame->flags); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send start packet for [%c] ts=%d sofar=%u dur=%d\n", tech_pvt->out_digit, ts, tech_pvt->out_digit_sofar, 0); } diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 29cb86cd53..12e6130d2b 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -633,7 +633,7 @@ SWITCH_DECLARE(switch_status) switch_rtp_zerocopy_read(switch_rtp *rtp_session, return SWITCH_STATUS_SUCCESS; } -static int rtp_common_write(switch_rtp *rtp_session, void *data, uint32_t datalen, switch_payload_t payload, switch_frame_flag *flags) +static int rtp_common_write(switch_rtp *rtp_session, void *data, uint32_t datalen, uint8_t m, switch_payload_t payload, switch_frame_flag *flags) { switch_size_t bytes; uint8_t packetize = (rtp_session->packet_size > datalen && (payload == rtp_session->payload)) ? 1 : 0; @@ -645,7 +645,8 @@ static int rtp_common_write(switch_rtp *rtp_session, void *data, uint32_t datale send_msg = (rtp_msg_t *) data; } else { send_msg = &rtp_session->send_msg; - send_msg->header.pt = rtp_session->payload; + send_msg->header.pt = payload; + send_msg->header.m = m; if (packetize) { if (!rtp_session->packet_buffer) { if (switch_buffer_create(rtp_session->pool, &rtp_session->packet_buffer, rtp_session->packet_size * 2) != SWITCH_STATUS_SUCCESS) { @@ -703,7 +704,7 @@ SWITCH_DECLARE(int) switch_rtp_write(switch_rtp *rtp_session, void *data, uint32 rtp_session->send_msg.header.seq = rtp_session->seq; rtp_session->send_msg.header.ts = htonl(rtp_session->ts); - return rtp_common_write(rtp_session, data, datalen, rtp_session->payload, flags); + return rtp_common_write(rtp_session, data, datalen, 0, rtp_session->payload, flags); } @@ -731,11 +732,11 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp *rtp_session, switch_frame rtp_session->send_msg.header.ts = htonl(rtp_session->ts); } - return rtp_common_write(rtp_session, data, len, rtp_session->payload, &frame->flags); + return rtp_common_write(rtp_session, data, len, 0, rtp_session->payload, &frame->flags); } -SWITCH_DECLARE(int) switch_rtp_write_payload(switch_rtp *rtp_session, void *data, uint16_t datalen, uint8_t payload, uint32_t ts, uint16_t mseq, switch_frame_flag *flags) +SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp *rtp_session, void *data, uint16_t datalen, uint8_t m, uint8_t payload, uint32_t ts, uint16_t mseq, switch_frame_flag *flags) { if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO) || !rtp_session->remote_addr) { @@ -746,7 +747,7 @@ SWITCH_DECLARE(int) switch_rtp_write_payload(switch_rtp *rtp_session, void *data rtp_session->send_msg.header.seq = htons(mseq); rtp_session->send_msg.header.ts = htonl(rtp_session->ts); - return rtp_common_write(rtp_session, data, datalen, payload, flags); + return rtp_common_write(rtp_session, data, datalen, m, payload, flags); } SWITCH_DECLARE(uint32_t) switch_rtp_get_ssrc(switch_rtp *rtp_session)