Commit 0091eeea authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Add test on RTP version to be able to send STUN packets using the RTP sending functions.

parent b1590514
......@@ -891,23 +891,26 @@ __rtp_session_sendm_with_ts (RtpSession * session, mblk_t *mp, uint32_t packet_t
rtp=(rtp_header_t*)mp->b_rptr;
packsize = msgdsize(mp) ;
rtp->timestamp=packet_ts;
if (session->snd.telephone_events_pt==rtp->paytype)
{
rtp->seq_number = session->rtp.snd_seq;
session->rtp.snd_seq++;
}
else
session->rtp.snd_seq=rtp->seq_number+1;
session->rtp.snd_last_ts = packet_ts;
if (rtp->version == 0) {
/* We are probably trying to send a STUN packet so don't change its content. */
} else {
rtp->timestamp=packet_ts;
if (session->snd.telephone_events_pt==rtp->paytype)
{
rtp->seq_number = session->rtp.snd_seq;
session->rtp.snd_seq++;
}
else
session->rtp.snd_seq=rtp->seq_number+1;
session->rtp.snd_last_ts = packet_ts;
ortp_global_stats.sent += packsize;
stream->sent_payload_bytes+=packsize-RTP_FIXED_HEADER_SIZE;
stream->stats.sent += packsize;
ortp_global_stats.packet_sent++;
stream->stats.packet_sent++;
ortp_global_stats.sent += packsize;
stream->sent_payload_bytes+=packsize-RTP_FIXED_HEADER_SIZE;
stream->stats.sent += packsize;
ortp_global_stats.packet_sent++;
stream->stats.packet_sent++;
}
error = rtp_session_rtp_send (session, mp);
/*send RTCP packet if needed */
......
......@@ -998,12 +998,16 @@ rtp_session_rtp_send (RtpSession * session, mblk_t * m)
ortp_socket_t sockfd=session->rtp.socket;
hdr = (rtp_header_t *) m->b_rptr;
/* perform host to network conversions */
hdr->ssrc = htonl (hdr->ssrc);
hdr->timestamp = htonl (hdr->timestamp);
hdr->seq_number = htons (hdr->seq_number);
for (i = 0; i < hdr->cc; i++)
hdr->csrc[i] = htonl (hdr->csrc[i]);
if (hdr->version == 0) {
/* We are probably trying to send a STUN packet so don't change its content. */
} else {
/* perform host to network conversions */
hdr->ssrc = htonl (hdr->ssrc);
hdr->timestamp = htonl (hdr->timestamp);
hdr->seq_number = htons (hdr->seq_number);
for (i = 0; i < hdr->cc; i++)
hdr->csrc[i] = htonl (hdr->csrc[i]);
}
if (session->flags & RTP_SOCKET_CONNECTED) {
destaddr=NULL;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment