diff options
author | Youness Alaoui <youness.alaoui@collabora.co.uk> | 2012-04-17 22:46:12 -0400 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@collabora.com> | 2012-04-18 15:41:57 -0400 |
commit | f1ec8fcb054355e6411bcc6473aae8b00577b5c5 (patch) | |
tree | 6c0362777f5dc18244117c0d2b3ad239d0d59b22 /gst/jpegformat | |
parent | 1059905237f28a5910221c34cc23a121cde175fe (diff) | |
download | gstreamer-plugins-bad-f1ec8fcb054355e6411bcc6473aae8b00577b5c5.tar.gz |
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.
Diffstat (limited to 'gst/jpegformat')
-rw-r--r-- | gst/jpegformat/gstjpegparse.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gst/jpegformat/gstjpegparse.c b/gst/jpegformat/gstjpegparse.c index d8367f8d7..240721380 100644 --- a/gst/jpegformat/gstjpegparse.c +++ b/gst/jpegformat/gstjpegparse.c @@ -928,7 +928,8 @@ gst_jpeg_parse_chain (GstPad * pad, GstBuffer * buf) if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (parse->priv->next_ts))) 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 */ 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: parse->priv->next_ts = GST_CLOCK_TIME_NONE; + parse->priv->duration = GST_CLOCK_TIME_NONE; parse->priv->last_offset = 0; parse->priv->last_entropy_len = 0; 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->next_ts = GST_CLOCK_TIME_NONE; + parse->priv->duration = GST_CLOCK_TIME_NONE; parse->priv->last_offset = 0; parse->priv->last_entropy_len = 0; |