Assigning SSRC of RTP Packets dynamically

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Assigning SSRC of RTP Packets dynamically

priyanka kataria
Hello All,

I want to assign the SSRC of RTP Packets dynamically.

The scenario is as below:
I have funneled multiple streams into one. At runtime I check if the frame is 1st input source, I assign SSRC as 1, if the frame is from 2nd input source, I assign SSRC as 2 and so on..

To assign the SSRC, I use probe on "src" pad of "rtph264pay" element.
The code snippet for the probe is shown below:

static GstPadProbeReturn setssrc(GstPad *pad, GstPadProbeInfo *info, gpointer user_data)
{
 GstBuffer *buffer = NULL;
 buffer = GST_PAD_PROBE_INFO_BUFFER(info);
 GstRTPBuffer rtpBuffer;
 memset(&rtpBuffer, 0, sizeof(GstRTPBuffer));
 if (buffer != NULL)
 {
  if (gst_rtp_buffer_map(buffer, (GstMapFlags)GST_MAP_READWRITE, &rtpBuffer))
  {
   g_print("buffer mapped\n");
   gst_rtp_buffer_set_ssrc(&rtpBuffer, 222);
   gst_rtp_buffer_unmap(&rtpBuffer);
  }
  else
   g_print("buffer not mapped\n");
 }
 return GST_PAD_PROBE_OK;
}

This code sets SSRC only for some of the packets and the output at the receiver side (by using gst_rtp_buffer_get_ssrc)) is as below:
-145555887
222
222
222
222
-145555887
-145555887
-145555887
-145555887

Can anyone please tell me where is the problem and how to resolve it?

Thanks,
Priyanka

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Assigning SSRC of RTP Packets dynamically

Marc Leeman


By doing this, you are breaking the RFC, IIRC, the SSRC should be random.

On Wed, 5 Jun 2019 at 06:11, priyanka kataria <[hidden email]> wrote:
Hello All,

I want to assign the SSRC of RTP Packets dynamically.

The scenario is as below:
I have funneled multiple streams into one. At runtime I check if the frame is 1st input source, I assign SSRC as 1, if the frame is from 2nd input source, I assign SSRC as 2 and so on..

To assign the SSRC, I use probe on "src" pad of "rtph264pay" element.
The code snippet for the probe is shown below:

static GstPadProbeReturn setssrc(GstPad *pad, GstPadProbeInfo *info, gpointer user_data)
{
 GstBuffer *buffer = NULL;
 buffer = GST_PAD_PROBE_INFO_BUFFER(info);
 GstRTPBuffer rtpBuffer;
 memset(&rtpBuffer, 0, sizeof(GstRTPBuffer));
 if (buffer != NULL)
 {
  if (gst_rtp_buffer_map(buffer, (GstMapFlags)GST_MAP_READWRITE, &rtpBuffer))
  {
   g_print("buffer mapped\n");
   gst_rtp_buffer_set_ssrc(&rtpBuffer, 222);
   gst_rtp_buffer_unmap(&rtpBuffer);
  }
  else
   g_print("buffer not mapped\n");
 }
 return GST_PAD_PROBE_OK;
}

This code sets SSRC only for some of the packets and the output at the receiver side (by using gst_rtp_buffer_get_ssrc)) is as below:
-145555887
222
222
222
222
-145555887
-145555887
-145555887
-145555887

Can anyone please tell me where is the problem and how to resolve it?

Thanks,
Priyanka
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


--
g. Marc

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel