From 303883752eb4e611d7f58814e59a74badc15be4c Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Thu, 6 Mar 2014 16:37:51 +0100 Subject: [PATCH] flvdemux: set RESYNC buffer flag when bridging large PTS gaps So downstream gets notified when this happens. https://bugzilla.gnome.org/show_bug.cgi?id=725903 --- gst/flv/gstflvdemux.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/gst/flv/gstflvdemux.c b/gst/flv/gstflvdemux.c index 2e84f26..d90069f 100644 --- a/gst/flv/gstflvdemux.c +++ b/gst/flv/gstflvdemux.c @@ -885,10 +885,11 @@ gst_flv_demux_push_tags (GstFlvDemux * demux) } } -static void +static gboolean gst_flv_demux_update_resync (GstFlvDemux * demux, guint32 pts, gboolean discont, guint32 * last, GstClockTime * offset) { + gboolean ret = FALSE; gint32 dpts = pts - *last; if (!discont && ABS (dpts) >= RESYNC_THRESHOLD) { /* Theoretically, we should use substract the duration of the last buffer, @@ -898,8 +899,12 @@ gst_flv_demux_update_resync (GstFlvDemux * demux, guint32 pts, gboolean discont, GST_WARNING_OBJECT (demux, "Large pts gap (%" G_GINT32_FORMAT " ms), assuming resync, offset now %" GST_TIME_FORMAT "", dpts, GST_TIME_ARGS (*offset)); + + ret = TRUE; } *last = pts; + + return ret; } static GstFlowReturn @@ -1099,8 +1104,10 @@ gst_flv_demux_parse_tag_audio (GstFlvDemux * demux, GstBuffer * buffer) } /* detect (and deem to be resyncs) large pts gaps */ - gst_flv_demux_update_resync (demux, pts, demux->audio_need_discont, - &demux->last_audio_pts, &demux->audio_time_offset); + if (gst_flv_demux_update_resync (demux, pts, demux->audio_need_discont, + &demux->last_audio_pts, &demux->audio_time_offset)) { + GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_RESYNC); + } /* Fill buffer with data */ GST_BUFFER_TIMESTAMP (outbuf) = pts * GST_MSECOND + demux->audio_time_offset; @@ -1484,8 +1491,10 @@ gst_flv_demux_parse_tag_video (GstFlvDemux * demux, GstBuffer * buffer) } /* detect (and deem to be resyncs) large pts gaps */ - gst_flv_demux_update_resync (demux, pts, demux->video_need_discont, - &demux->last_video_pts, &demux->video_time_offset); + if (gst_flv_demux_update_resync (demux, pts, demux->video_need_discont, + &demux->last_video_pts, &demux->video_time_offset)) { + GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_RESYNC); + } /* Fill buffer with data */ GST_BUFFER_TIMESTAMP (outbuf) = pts * GST_MSECOND + demux->video_time_offset; -- 2.7.4