summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Nauwelaerts <mnauw@users.sourceforge.net>2013-02-09 12:32:02 +0100
committerMark Nauwelaerts <mnauw@users.sourceforge.net>2013-02-09 12:32:02 +0100
commit314400d45af1a9718a7209a9c162c7a7ee9d95f7 (patch)
tree09170970c477ab42ccb057395da5401ff0b41cd7
parent0b671cd05b983982f7bf303c644ebb4cfb3e1410 (diff)
baseparse: improve PTS interpolating
... and tracking of DTS. Fixes cases where PTS is locked on to the DTS of an incoming buffer with no PTS with invalid data, leading to no outgoing PTS (since it is not allowed smaller than DTS). Fixes https://bugzilla.gnome.org/show_bug.cgi?id=691481
-rw-r--r--libs/gst/base/gstbaseparse.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libs/gst/base/gstbaseparse.c b/libs/gst/base/gstbaseparse.c
index 4f1bdaf488..3a1487e2b3 100644
--- a/libs/gst/base/gstbaseparse.c
+++ b/libs/gst/base/gstbaseparse.c
@@ -731,7 +731,7 @@ gst_base_parse_reset (GstBaseParse * parse)
parse->priv->first_frame_offset = -1;
parse->priv->estimated_duration = -1;
parse->priv->estimated_drift = 0;
- parse->priv->next_pts = 0;
+ parse->priv->next_pts = GST_CLOCK_TIME_NONE;
parse->priv->next_dts = 0;
parse->priv->syncable = TRUE;
parse->priv->passthrough = FALSE;
@@ -1034,8 +1034,6 @@ gst_base_parse_sink_event_default (GstBaseParse * parse, GstEvent * event)
parse->priv->offset = offset;
parse->priv->sync_offset = offset;
parse->priv->next_dts = next_dts;
- if (parse->priv->pts_interpolate)
- parse->priv->next_pts = next_dts;
parse->priv->last_pts = GST_CLOCK_TIME_NONE;
parse->priv->last_dts = GST_CLOCK_TIME_NONE;
parse->priv->discont = TRUE;
@@ -1984,6 +1982,12 @@ gst_base_parse_handle_and_push_frame (GstBaseParse * parse,
}
}
+ /* interpolating and no valid pts yet,
+ * start with dts and carry on from there */
+ if (parse->priv->pts_interpolate &&
+ !GST_CLOCK_TIME_IS_VALID (parse->priv->next_pts))
+ parse->priv->next_pts = parse->priv->next_dts;
+
/* again use default handler to add missing metadata;
* we may have new information on frame properties */
gst_base_parse_parse_frame (parse, frame);
@@ -4094,8 +4098,6 @@ gst_base_parse_handle_seek (GstBaseParse * parse, GstEvent * event)
parse->priv->seen_keyframe = FALSE;
parse->priv->discont = TRUE;
parse->priv->next_dts = start_ts;
- if (parse->priv->pts_interpolate)
- parse->priv->next_pts = start_ts;
parse->priv->last_dts = GST_CLOCK_TIME_NONE;
parse->priv->last_pts = GST_CLOCK_TIME_NONE;
parse->priv->sync_offset = seekpos;