summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Santos <thiagoss@osg.samsung.com>2015-11-13 16:31:06 -0300
committerThiago Santos <thiagoss@osg.samsung.com>2015-11-16 08:49:24 -0300
commit2c475a035543efc0202ecdc52070295a421ed4b4 (patch)
treef15ecc8df4dfdf9add86808b56f1d6b31f7c2c0c
parent842ffa69b64067cc5003380b0083c5254fb10ae1 (diff)
downloadgstreamer-2c475a035543efc0202ecdc52070295a421ed4b4.tar.gz
baseparse: do not overwrite header buffer timestamps
baseparse tries to preserve timestamps from upstream if it is running on a time segment and write that to output buffers. It assumes the first DTS is going to be segment.start and sets that to the first buffers. In case the buffer is a header buffer, it had no timestamps and will have only the DTS set due to this mechanism. This patch prevents this by skipping this behavior for header buffers. https://bugzilla.gnome.org/show_bug.cgi?id=757961
-rw-r--r--libs/gst/base/gstbaseparse.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libs/gst/base/gstbaseparse.c b/libs/gst/base/gstbaseparse.c
index c9a57c5737..f8f4380010 100644
--- a/libs/gst/base/gstbaseparse.c
+++ b/libs/gst/base/gstbaseparse.c
@@ -980,16 +980,17 @@ static GstFlowReturn
gst_base_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
{
GstBuffer *buffer = frame->buffer;
+ gboolean is_header = GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_HEADER);
- if (!GST_BUFFER_PTS_IS_VALID (buffer) &&
+ if (!GST_BUFFER_PTS_IS_VALID (buffer) && !is_header &&
GST_CLOCK_TIME_IS_VALID (parse->priv->next_pts)) {
GST_BUFFER_PTS (buffer) = parse->priv->next_pts;
}
- if (!GST_BUFFER_DTS_IS_VALID (buffer) &&
+ if (!GST_BUFFER_DTS_IS_VALID (buffer) && !is_header &&
GST_CLOCK_TIME_IS_VALID (parse->priv->next_dts)) {
GST_BUFFER_DTS (buffer) = parse->priv->next_dts;
}
- if (!GST_BUFFER_DURATION_IS_VALID (buffer) &&
+ if (!GST_BUFFER_DURATION_IS_VALID (buffer) && !is_header &&
GST_CLOCK_TIME_IS_VALID (parse->priv->frame_duration)) {
GST_BUFFER_DURATION (buffer) = parse->priv->frame_duration;
}
@@ -2878,11 +2879,14 @@ gst_base_parse_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
gint skip = -1;
guint min_size, av;
GstClockTime pts, dts;
+ gboolean is_header;
parse = GST_BASE_PARSE (parent);
bclass = GST_BASE_PARSE_GET_CLASS (parse);
GST_DEBUG_OBJECT (parent, "chain");
+ is_header = buffer && GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_HEADER);
+
/* early out for speed, if we need to skip */
if (buffer && GST_BUFFER_IS_DISCONT (buffer))
parse->priv->skip = 0;
@@ -3078,7 +3082,7 @@ gst_base_parse_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
/* already inform subclass what timestamps we have planned,
* at least if provided by time-based upstream */
- if (parse->priv->upstream_format == GST_FORMAT_TIME) {
+ if (parse->priv->upstream_format == GST_FORMAT_TIME && !is_header) {
tmpbuf = gst_buffer_make_writable (tmpbuf);
GST_BUFFER_PTS (tmpbuf) = parse->priv->next_pts;
GST_BUFFER_DTS (tmpbuf) = parse->priv->next_dts;