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
This commit is contained in:
Mark Nauwelaerts 2013-02-09 12:32:02 +01:00
parent 0b671cd05b
commit 314400d45a

View file

@ -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;