From 09ea92848b92640420c5c9d610e0be4e47742633 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Fri, 11 Apr 2014 11:54:12 +0200 Subject: [PATCH] dvdec: Don't set bogus timestamp/duration This will happen if we have an incoming stream with a non-TIME segment Could be improved later to figure out proper pts/duration. CID #1199702 CID #1199703 --- ext/dv/gstdvdec.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ext/dv/gstdvdec.c b/ext/dv/gstdvdec.c index ea2ea417b1..7faeaa55aa 100644 --- a/ext/dv/gstdvdec.c +++ b/ext/dv/gstdvdec.c @@ -421,7 +421,7 @@ gst_dvdec_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) GstBuffer *outbuf; GstFlowReturn ret = GST_FLOW_OK; guint length; - guint64 cstart, cstop; + guint64 cstart = GST_CLOCK_TIME_NONE, cstop = GST_CLOCK_TIME_NONE; gboolean PAL, wide; dvdec = GST_DVDEC (parent); @@ -518,8 +518,15 @@ gst_dvdec_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) GST_BUFFER_OFFSET (outbuf) = GST_BUFFER_OFFSET (buf); GST_BUFFER_OFFSET_END (outbuf) = GST_BUFFER_OFFSET_END (buf); - GST_BUFFER_TIMESTAMP (outbuf) = cstart; - GST_BUFFER_DURATION (outbuf) = cstop - cstart; + + /* FIXME : Compute values when using non-TIME segments, + * but for the moment make sure we at least don't set bogus values + */ + if (GST_CLOCK_TIME_IS_VALID (cstart)) { + GST_BUFFER_TIMESTAMP (outbuf) = cstart; + if (GST_CLOCK_TIME_IS_VALID (cstop)) + GST_BUFFER_DURATION (outbuf) = cstop - cstart; + } ret = gst_pad_push (dvdec->srcpad, outbuf);