From c1251ab861ff2fe688d87820109280034438d9a8 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Tue, 6 Jan 2015 18:44:15 -0300 Subject: [PATCH] adaptivedemux: only update segment if we have a valid PTS Otherwise we set the position to GST_CLOCK_TIME_NONE and it disrupts bitrate switching --- gst-libs/gst/adaptivedemux/gstadaptivedemux.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c index 0e70089a14..59dabc52fe 100644 --- a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c +++ b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c @@ -1229,7 +1229,8 @@ _src_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) GST_LOG_OBJECT (stream->pad, "set fragment pts=%" GST_TIME_FORMAT, GST_TIME_ARGS (GST_BUFFER_PTS (buffer))); - stream->segment.position = GST_BUFFER_PTS (buffer); + if (GST_BUFFER_PTS_IS_VALID (buffer)) + stream->segment.position = GST_BUFFER_PTS (buffer); } else { GST_BUFFER_PTS (buffer) = GST_CLOCK_TIME_NONE; @@ -1261,7 +1262,8 @@ _src_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) discont = TRUE; GST_BUFFER_PTS (buffer) = stream->fragment.timestamp; - stream->segment.position = GST_BUFFER_PTS (buffer); + if (GST_BUFFER_PTS_IS_VALID (buffer)) + stream->segment.position = GST_BUFFER_PTS (buffer); } else { GST_BUFFER_PTS (buffer) = GST_CLOCK_TIME_NONE; }