jpegparse: Do not set the duration to the input buffer's duration unless valid
This causes a bug where the first buffer has ts = 0, dur=X, the second buffer has ts=X (because of ts += duration), dur=-1, then the following buffers will start having a non valid timestamp. The real duration is only calculated during the caps negociation when there is a framerate available and the buffer's duration is invalid.
This commit is contained in:
parent
1059905237
commit
f1ec8fcb05
@ -928,7 +928,8 @@ gst_jpeg_parse_chain (GstPad * pad, GstBuffer * buf)
|
|||||||
if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (parse->priv->next_ts)))
|
if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (parse->priv->next_ts)))
|
||||||
parse->priv->next_ts = timestamp;
|
parse->priv->next_ts = timestamp;
|
||||||
|
|
||||||
parse->priv->duration = duration;
|
if (G_LIKELY (GST_CLOCK_TIME_IS_VALID (duration)))
|
||||||
|
parse->priv->duration = duration;
|
||||||
|
|
||||||
/* check if we already have a EOI */
|
/* check if we already have a EOI */
|
||||||
len = gst_jpeg_parse_get_image_length (parse);
|
len = gst_jpeg_parse_get_image_length (parse);
|
||||||
@ -971,6 +972,7 @@ gst_jpeg_parse_sink_event (GstPad * pad, GstEvent * event)
|
|||||||
}
|
}
|
||||||
case GST_EVENT_FLUSH_STOP:
|
case GST_EVENT_FLUSH_STOP:
|
||||||
parse->priv->next_ts = GST_CLOCK_TIME_NONE;
|
parse->priv->next_ts = GST_CLOCK_TIME_NONE;
|
||||||
|
parse->priv->duration = GST_CLOCK_TIME_NONE;
|
||||||
parse->priv->last_offset = 0;
|
parse->priv->last_offset = 0;
|
||||||
parse->priv->last_entropy_len = 0;
|
parse->priv->last_entropy_len = 0;
|
||||||
parse->priv->last_resync = FALSE;
|
parse->priv->last_resync = FALSE;
|
||||||
@ -1039,6 +1041,7 @@ gst_jpeg_parse_change_state (GstElement * element, GstStateChange transition)
|
|||||||
parse->priv->new_segment = FALSE;
|
parse->priv->new_segment = FALSE;
|
||||||
|
|
||||||
parse->priv->next_ts = GST_CLOCK_TIME_NONE;
|
parse->priv->next_ts = GST_CLOCK_TIME_NONE;
|
||||||
|
parse->priv->duration = GST_CLOCK_TIME_NONE;
|
||||||
|
|
||||||
parse->priv->last_offset = 0;
|
parse->priv->last_offset = 0;
|
||||||
parse->priv->last_entropy_len = 0;
|
parse->priv->last_entropy_len = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user