diff options
author | Olivier CrĂȘte <olivier.crete@collabora.co.uk> | 2009-02-18 18:14:52 -0500 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2009-02-21 17:48:57 +0100 |
commit | 7a222b560eb5b30036b5bbd5719140cf6dbbbe6e (patch) | |
tree | d97dc5b82a3bf9acaa6cb4ee075fed9d0f95b1cd /gst | |
parent | d0c7c0fc6c1cc1085267d972db949f9ad2c85ea3 (diff) | |
download | gst-plugins-bad-7a222b560eb5b30036b5bbd5719140cf6dbbbe6e.tar.gz gst-plugins-bad-7a222b560eb5b30036b5bbd5719140cf6dbbbe6e.tar.bz2 gst-plugins-bad-7a222b560eb5b30036b5bbd5719140cf6dbbbe6e.zip |
[MOVED FROM GST-P-FARSIGHT] Protect the seqnum with object lock in rtpmux
Diffstat (limited to 'gst')
-rw-r--r-- | gst/rtpmux/gstrtpmux.c | 8 | ||||
-rw-r--r-- | gst/rtpmux/gstrtpmux.h | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/gst/rtpmux/gstrtpmux.c b/gst/rtpmux/gstrtpmux.c index 1b818135..dd8c6cd0 100644 --- a/gst/rtpmux/gstrtpmux.c +++ b/gst/rtpmux/gstrtpmux.c @@ -373,8 +373,10 @@ gst_rtp_mux_chain (GstPad * pad, GstBuffer * buffer) buffer = gst_buffer_make_writable(buffer); + GST_OBJECT_LOCK (rtp_mux); rtp_mux->seqnum++; gst_rtp_buffer_set_seq (buffer, rtp_mux->seqnum); + GST_OBJECT_UNLOCK (rtp_mux); GST_BUFFER_CAPS (buffer) = gst_caps_make_writable(GST_BUFFER_CAPS (buffer)); structure = gst_caps_get_structure (GST_BUFFER_CAPS (buffer), 0U); gst_structure_set (structure, "seqnum-base", G_TYPE_UINT, rtp_mux->seqnum_base, NULL); @@ -545,7 +547,9 @@ gst_rtp_mux_get_property (GObject * object, g_value_set_int (value, rtp_mux->seqnum_offset); break; case PROP_SEQNUM: + GST_OBJECT_LOCK (rtp_mux); g_value_set_uint (value, rtp_mux->seqnum); + GST_OBJECT_UNLOCK (rtp_mux); break; case PROP_SSRC: g_value_set_uint (value, rtp_mux->ssrc); @@ -583,6 +587,8 @@ gst_rtp_mux_set_property (GObject * object, static void gst_rtp_mux_ready_to_paused (GstRTPMux * rtp_mux) { + GST_OBJECT_LOCK (rtp_mux); + if (rtp_mux->ssrc == -1) rtp_mux->current_ssrc = g_random_int (); else @@ -599,6 +605,8 @@ gst_rtp_mux_ready_to_paused (GstRTPMux * rtp_mux) else rtp_mux->ts_base = rtp_mux->ts_offset; GST_DEBUG_OBJECT (rtp_mux, "set clock-base to %u", rtp_mux->ts_base); + + GST_OBJECT_UNLOCK (rtp_mux); } static GstStateChangeReturn diff --git a/gst/rtpmux/gstrtpmux.h b/gst/rtpmux/gstrtpmux.h index f76717a7..bf66e1e7 100644 --- a/gst/rtpmux/gstrtpmux.h +++ b/gst/rtpmux/gstrtpmux.h @@ -60,7 +60,7 @@ struct _GstRTPMux gint32 ts_offset; gint16 seqnum_offset; - guint16 seqnum; + guint16 seqnum; /* protected by object lock */ guint ssrc; guint current_ssrc; }; |