summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
Diffstat (limited to 'res')
-rw-r--r--res/res_rtp_multicast.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/res/res_rtp_multicast.c b/res/res_rtp_multicast.c
index 18256e90e..fc22ba388 100644
--- a/res/res_rtp_multicast.c
+++ b/res/res_rtp_multicast.c
@@ -89,7 +89,7 @@ struct multicast_rtp {
/*! Synchronization source value, used when creating/sending the RTP packet */
unsigned int ssrc;
/*! Sequence number, used when creating/sending the RTP packet */
- unsigned int seqno;
+ uint16_t seqno;
};
/* Forward Declarations */
@@ -228,10 +228,13 @@ static int multicast_rtp_write(struct ast_rtp_instance *instance, struct ast_fra
/* Construct an RTP header for our packet */
rtpheader = (unsigned char *)(f->data.ptr - hdrlen);
- put_unaligned_uint32(rtpheader, htonl((2 << 30) | (codec << 16) | (multicast->seqno++) | (0 << 23)));
+ put_unaligned_uint32(rtpheader, htonl((2 << 30) | (codec << 16) | (multicast->seqno)));
put_unaligned_uint32(rtpheader + 4, htonl(f->ts * 8));
put_unaligned_uint32(rtpheader + 8, htonl(multicast->ssrc));
+ /* Increment sequence number and wrap to 0 if it overflows 16 bits. */
+ multicast->seqno = 0xFFFF & (multicast->seqno + 1);
+
/* Finally send it out to the eager phones listening for us */
ast_rtp_instance_get_remote_address(instance, &remote_address);
res = ast_sendto(multicast->socket, (void *) rtpheader, f->datalen + hdrlen, 0, &remote_address);