From 5328378132c7c100b8a17818862a3124affef1f8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Olivier=20Cr=C3=AAte?= Date: Sat, 14 May 2016 14:46:17 +0200 Subject: [PATCH] rtpjitterbuffer: Work with non-TIME segments With non-time segments, it now assumes that the arrival time of packets is not relevant and that only the RTP timestamp matter and it produces an output segment start at running time 0. https://bugzilla.gnome.org/show_bug.cgi?id=766438 --- gst/rtpmanager/gstrtpjitterbuffer.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/gst/rtpmanager/gstrtpjitterbuffer.c b/gst/rtpmanager/gstrtpjitterbuffer.c index aae4b28..d9ea04c 100644 --- a/gst/rtpmanager/gstrtpjitterbuffer.c +++ b/gst/rtpmanager/gstrtpjitterbuffer.c @@ -897,6 +897,7 @@ gst_rtp_jitter_buffer_init (GstRtpJitterBuffer * jitterbuffer) g_cond_init (&priv->jbuf_event); g_cond_init (&priv->jbuf_query); g_queue_init (&priv->gap_packets); + gst_segment_init (&priv->segment, GST_FORMAT_TIME); /* reset skew detection initialy */ rtp_jitter_buffer_reset_skew (priv->jbuf); @@ -1660,15 +1661,22 @@ queue_event (GstRtpJitterBuffer * jitterbuffer, GstEvent * event) break; } case GST_EVENT_SEGMENT: - gst_event_copy_segment (event, &priv->segment); + { + GstSegment segment; + gst_event_copy_segment (event, &segment); /* we need time for now */ - if (priv->segment.format != GST_FORMAT_TIME) - goto newseg_wrong_format; + if (segment.format != GST_FORMAT_TIME) { + GST_DEBUG_OBJECT (jitterbuffer, "ignoring non-TIME newsegment"); + gst_event_unref (event); - GST_DEBUG_OBJECT (jitterbuffer, - "segment: %" GST_SEGMENT_FORMAT, &priv->segment); + gst_segment_init (&segment, GST_FORMAT_TIME); + event = gst_event_new_segment (&segment); + } + + priv->segment = segment; break; + } case GST_EVENT_EOS: priv->eos = TRUE; rtp_jitter_buffer_disable_buffering (priv->jbuf, TRUE); @@ -1685,14 +1693,6 @@ queue_event (GstRtpJitterBuffer * jitterbuffer, GstEvent * event) JBUF_SIGNAL_EVENT (priv); return TRUE; - - /* ERRORS */ -newseg_wrong_format: - { - GST_ERROR_OBJECT (jitterbuffer, "rejecting non-TIME newsegment"); - gst_event_unref (event); - return FALSE; - } } static gboolean -- 2.7.4