From: Olivier CrĂȘte Date: Mon, 20 Apr 2015 23:07:27 +0000 (-0400) Subject: identity: Handle PTS and DTS separately X-Git-Tag: 1.6.1~350 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f2992654ca82d85dd5a1b2249abf76b5a2fc446f;p=platform%2Fupstream%2Fgstreamer.git identity: Handle PTS and DTS separately https://bugzilla.gnome.org/show_bug.cgi?id=601853 --- diff --git a/plugins/elements/gstidentity.c b/plugins/elements/gstidentity.c index 8f564cf..b541350 100644 --- a/plugins/elements/gstidentity.c +++ b/plugins/elements/gstidentity.c @@ -502,7 +502,8 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf) { GstFlowReturn ret = GST_FLOW_OK; GstIdentity *identity = GST_IDENTITY (trans); - GstClockTime runtimestamp = G_GINT64_CONSTANT (0); + GstClockTime rundts = GST_CLOCK_TIME_NONE; + GstClockTime runpts = GST_CLOCK_TIME_NONE; GstClockTime ts, duration; gsize size; @@ -553,9 +554,12 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf) if (identity->signal_handoffs) g_signal_emit (identity, gst_identity_signals[SIGNAL_HANDOFF], 0, buf); - if (trans->segment.format == GST_FORMAT_TIME) - runtimestamp = gst_segment_to_running_time (&trans->segment, - GST_FORMAT_TIME, GST_BUFFER_TIMESTAMP (buf)); + if (trans->segment.format == GST_FORMAT_TIME) { + rundts = gst_segment_to_running_time (&trans->segment, + GST_FORMAT_TIME, GST_BUFFER_DTS (buf)); + runpts = gst_segment_to_running_time (&trans->segment, + GST_FORMAT_TIME, GST_BUFFER_PTS (buf)); + } if ((identity->sync) && (trans->segment.format == GST_FORMAT_TIME)) { GstClock *clock; @@ -565,7 +569,12 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf) GstClockReturn cret; GstClockTime timestamp; - timestamp = runtimestamp + GST_ELEMENT (identity)->base_time; + if (GST_CLOCK_TIME_IS_VALID (rundts)) + timestamp = rundts + GST_ELEMENT (identity)->base_time; + else if (GST_CLOCK_TIME_IS_VALID (runpts)) + timestamp = runpts + GST_ELEMENT (identity)->base_time; + else + timestamp = 0; /* save id if we need to unlock */ identity->clock_id = gst_clock_new_single_shot_id (clock, timestamp); @@ -591,7 +600,8 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf) if (identity->single_segment && (trans->segment.format == GST_FORMAT_TIME) && (ret == GST_FLOW_OK)) { - GST_BUFFER_PTS (buf) = GST_BUFFER_DTS (buf) = runtimestamp; + GST_BUFFER_DTS (buf) = rundts; + GST_BUFFER_PTS (buf) = runpts; GST_BUFFER_OFFSET (buf) = GST_CLOCK_TIME_NONE; GST_BUFFER_OFFSET_END (buf) = GST_CLOCK_TIME_NONE; }