Summary:ASTERISK-22567: [patch]MutlicastRTP does not set SSRC. SSRC is always set to 0
Reporter:Simone Camporeale (simone.camporeale)Labels:
Date Opened:2013-09-21 05:00:29Date Closed:2013-10-03 13:34:01
Versions:SVN 11.5.1 Frequency of
Environment:ALLAttachments:( 0) 22567_res_mulitcast_ssrc.patch
Description:I found a bug in res/res_rtp_multicast.c
RTP packets have always SSRC set to 0

I discovered this bug testing MulticastRTP app.

In order to reproduce this BUG activate a MulticastRTP session and sniff packets with WireShark.

In WireShark set protocol to RTP and filter by selected Multicast address.

This bug originates conflicts in mutlicast streams.

I noticed this bug using gstreamer. Gstreamer decodes first MulticastRTP session correctly but it is not able to decode second MulticastRTP session.

After some minutes first rtp session expires and gstreamers is able to decode rtp packet.

To fix this issue i edited this file:

Index: res/res_rtp_multicast.c
--- res/res_rtp_multicast.c     (revision 399617)
+++ res/res_rtp_multicast.c     (working copy)
@@ -260,14 +260,15 @@
       /* 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)));
-       put_unaligned_uint32(rtpheader + 4, htonl(multicast->lastts));

       if (ast_test_flag(f, AST_FRFLAG_HAS_TIMING_INFO)) {
               put_unaligned_uint32(rtpheader + 4, htonl(f->ts * 8));
       else {
-               put_unaligned_uint32(rtpheader + 8, htonl(multicast->ssrc));
+               put_unaligned_uint32(rtpheader + 4, htonl(multicast->lastts));
+       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);

Comments:By: Richard Mudgett (rmudgett) 2013-09-21 12:48:56.437-0500

Please attach patches in "diff -u" or "svn diff" format to issues after signing the contributer license agreement.  We cannot accept inline patches due to licensing issues.

By: Simone Camporeale (simone.camporeale) 2013-09-23 03:22:27.216-0500

I just signed the agreement.
I attach patch in "svn diff" format.
Is there any naming convention for patches ?

By: Simone Camporeale (simone.camporeale) 2013-09-23 03:23:49.532-0500

res/res_rtp_multicast.c patch in order to fix 0 SSRC in RTP packets.

By: Kinsey Moore (kmoore) 2013-10-03 13:33:46.543-0500

Thank you for the bug report and the patch! This is now committed to 1.8, 11, 12, and trunk.