diff options
author | zeeshan.ali@nokia.com <zeeshan.ali@nokia.com> | 2007-03-29 13:36:22 +0000 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2009-02-21 17:48:53 +0100 |
commit | f224378822e841153d26f26b0a64871db795d25c (patch) | |
tree | 6a0587c990f03fbac5bce3d23015aab57c0a1a89 /gst | |
parent | 67c77c80298cdae2c018841989e989477161fc42 (diff) | |
download | gst-plugins-bad-f224378822e841153d26f26b0a64871db795d25c.tar.gz gst-plugins-bad-f224378822e841153d26f26b0a64871db795d25c.tar.bz2 gst-plugins-bad-f224378822e841153d26f26b0a64871db795d25c.zip |
[MOVED FROM GST-P-FARSIGHT] set SSRC on the packets
20070329133622-65035-1be6e0aa85a71389f7d257b9cd3e13a73d6b745b.gz
Diffstat (limited to 'gst')
-rw-r--r-- | gst/rtpmux/gstrtpmux.c | 26 | ||||
-rw-r--r-- | gst/rtpmux/gstrtpmux.h | 2 |
2 files changed, 24 insertions, 4 deletions
diff --git a/gst/rtpmux/gstrtpmux.c b/gst/rtpmux/gstrtpmux.c index b03bd6d2..22665562 100644 --- a/gst/rtpmux/gstrtpmux.c +++ b/gst/rtpmux/gstrtpmux.c @@ -57,13 +57,14 @@ enum PROP_CLOCK_RATE, PROP_TIMESTAMP_OFFSET, PROP_SEQNUM_OFFSET, - PROP_SEQNUM - /* FILL ME */ + PROP_SEQNUM, + PROP_SSRC }; #define DEFAULT_TIMESTAMP_OFFSET -1 -#define DEFAULT_SEQNUM_OFFSET -1 -#define DEFAULT_CLOCK_RATE 0 +#define DEFAULT_SEQNUM_OFFSET -1 +#define DEFAULT_SSRC -1 +#define DEFAULT_CLOCK_RATE 0 static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, @@ -169,6 +170,10 @@ gst_rtp_mux_class_init (GstRTPMuxClass * klass) g_param_spec_uint ("seqnum", "Sequence number", "The RTP sequence number of the last processed packet", 0, G_MAXUINT, 0, G_PARAM_READABLE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SSRC, + g_param_spec_uint ("ssrc", "SSRC", + "The SSRC of the packets (-1 == random)", + 0, G_MAXUINT, DEFAULT_SSRC, G_PARAM_READWRITE)); gstelement_class->request_new_pad = gst_rtp_mux_request_new_pad; gstelement_class->change_state = gst_rtp_mux_change_state; @@ -186,6 +191,7 @@ gst_rtp_mux_init (GstRTPMux * rtp_mux) "src"), "src"); gst_element_add_pad (GST_ELEMENT (rtp_mux), rtp_mux->srcpad); + rtp_mux->ssrc = DEFAULT_SSRC; rtp_mux->ts_offset = DEFAULT_TIMESTAMP_OFFSET; rtp_mux->seqnum_offset = DEFAULT_SEQNUM_OFFSET; rtp_mux->clock_rate = DEFAULT_CLOCK_RATE; @@ -322,6 +328,7 @@ gst_rtp_mux_chain (GstPad * pad, GstBuffer * buffer) rtp_mux->seqnum++; GST_LOG_OBJECT (rtp_mux, "setting RTP seqnum %d", rtp_mux->seqnum); gst_rtp_buffer_set_seq (buffer, rtp_mux->seqnum); + gst_rtp_buffer_set_ssrc (buffer, rtp_mux->current_ssrc); gst_rtp_mux_readjust_rtp_timestamp (rtp_mux, buffer); GST_DEBUG_OBJECT (rtp_mux, "Pushing packet size %d, seq=%d, ts=%u", GST_BUFFER_SIZE (buffer), rtp_mux->seqnum - 1); @@ -396,6 +403,9 @@ gst_rtp_mux_get_property (GObject * object, case PROP_SEQNUM: g_value_set_uint (value, rtp_mux->seqnum); break; + case PROP_SSRC: + g_value_set_uint (value, rtp_mux->ssrc); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -420,6 +430,9 @@ gst_rtp_mux_set_property (GObject * object, case PROP_SEQNUM_OFFSET: rtp_mux->seqnum_offset = g_value_get_int (value); break; + case PROP_SSRC: + rtp_mux->ssrc = g_value_get_uint (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -438,6 +451,11 @@ gst_rtp_mux_change_state (GstElement * element, GstStateChange transition) case GST_STATE_CHANGE_NULL_TO_READY: break; case GST_STATE_CHANGE_READY_TO_PAUSED: + if (rtp_mux->ssrc == -1) + rtp_mux->current_ssrc = g_random_int (); + else + rtp_mux->current_ssrc = rtp_mux->ssrc; + if (rtp_mux->seqnum_offset == -1) rtp_mux->seqnum_base = g_random_int_range (0, G_MAXUINT16); else diff --git a/gst/rtpmux/gstrtpmux.h b/gst/rtpmux/gstrtpmux.h index 93dc86df..fee43055 100644 --- a/gst/rtpmux/gstrtpmux.h +++ b/gst/rtpmux/gstrtpmux.h @@ -62,6 +62,8 @@ struct _GstRTPMux gint32 ts_offset; gint16 seqnum_offset; guint16 seqnum; + guint ssrc; + guint current_ssrc; guint32 clock_rate; }; |