summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hervey <edward@centricular.com>2016-11-27 11:14:13 +0100
committerEdward Hervey <bilboed@bilboed.com>2016-11-27 11:15:49 +0100
commit91f5b4eaa2fcd874361d16bdf80497c3cdd12d13 (patch)
tree519cd6cd085083e63066287ad2eb8b7b3174a0b7
parentda025dc8109a0d0cee9b65ad5a4a67eb3fd01d35 (diff)
rtprtxsend: Update statistics before pushing
If an element queries the number of retransmission buffers pushed *while* the push is still taking place (and before the object lock is taken just after) it would end up with the wrong statistic being reported. Increment it just before the push, avoids races when getting statistics https://bugzilla.gnome.org/show_bug.cgi?id=768723
-rw-r--r--gst/rtpmanager/gstrtprtxsend.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gst/rtpmanager/gstrtprtxsend.c b/gst/rtpmanager/gstrtprtxsend.c
index 5fb400d76..2412c6440 100644
--- a/gst/rtpmanager/gstrtprtxsend.c
+++ b/gst/rtpmanager/gstrtprtxsend.c
@@ -767,11 +767,12 @@ gst_rtp_rtx_send_src_loop (GstRtpRtxSend * rtx)
GST_LOG_OBJECT (rtx, "pushing rtx buffer %p", data->object);
if (G_LIKELY (GST_IS_BUFFER (data->object))) {
- gst_pad_push (rtx->srcpad, GST_BUFFER (data->object));
-
GST_OBJECT_LOCK (rtx);
+ /* Update statistics just before pushing. */
rtx->num_rtx_packets++;
GST_OBJECT_UNLOCK (rtx);
+
+ gst_pad_push (rtx->srcpad, GST_BUFFER (data->object));
} else if (GST_IS_EVENT (data->object)) {
gst_pad_push_event (rtx->srcpad, GST_EVENT (data->object));