videodecoder: subtract time difference with GST_CLOCK_DIFF
authorLuis de Bethencourt <luisbg@osg.samsung.com>
Mon, 2 Nov 2015 12:09:42 +0000 (12:09 +0000)
committerLuis de Bethencourt <luisbg@osg.samsung.com>
Mon, 2 Nov 2015 12:09:45 +0000 (12:09 +0000)
To ensure the subtraction of two GstClockTime values (which are guint64)
can be negative. Use GST_CLOCK_DIFF which returns a gint64.

CID 1338049

gst-libs/gst/video/gstvideodecoder.c

index 08f9a28..03e31b7 100644 (file)
@@ -2699,7 +2699,8 @@ gst_video_decoder_prepare_finish_frame (GstVideoDecoder *
       GST_DEBUG_OBJECT (decoder,
           "sync timestamp %" GST_TIME_FORMAT " diff %" GST_STIME_FORMAT,
           GST_TIME_ARGS (frame->pts),
-          GST_STIME_ARGS (frame->pts - decoder->output_segment.start));
+          GST_STIME_ARGS (GST_CLOCK_DIFF (frame->pts,
+                  decoder->output_segment.start)));
       priv->base_timestamp = frame->pts;
       priv->base_picture_number = frame->decode_frame_number;
     }