[gst-plugins-farsight/master] Protect the seqnum with object lock in rtpmux
Olivier Crête
olivier.crete at collabora.co.uk
Wed Feb 18 15:14:52 PST 2009
---
gst/rtpmux/gstrtpmux.c | 8 ++++++++
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 1b81813..dd8c6cd 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 f76717a..bf66e1e 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;
};
--
1.5.6.5
More information about the farsight-commits
mailing list