mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-01 17:31:10 +00:00
identity: Handle PTS and DTS separately
https://bugzilla.gnome.org/show_bug.cgi?id=601853
This commit is contained in:
parent
8e6561be91
commit
f2992654ca
1 changed files with 16 additions and 6 deletions
|
@ -502,7 +502,8 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
GstIdentity *identity = GST_IDENTITY (trans);
|
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;
|
GstClockTime ts, duration;
|
||||||
gsize size;
|
gsize size;
|
||||||
|
|
||||||
|
@ -553,9 +554,12 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
|
||||||
if (identity->signal_handoffs)
|
if (identity->signal_handoffs)
|
||||||
g_signal_emit (identity, gst_identity_signals[SIGNAL_HANDOFF], 0, buf);
|
g_signal_emit (identity, gst_identity_signals[SIGNAL_HANDOFF], 0, buf);
|
||||||
|
|
||||||
if (trans->segment.format == GST_FORMAT_TIME)
|
if (trans->segment.format == GST_FORMAT_TIME) {
|
||||||
runtimestamp = gst_segment_to_running_time (&trans->segment,
|
rundts = gst_segment_to_running_time (&trans->segment,
|
||||||
GST_FORMAT_TIME, GST_BUFFER_TIMESTAMP (buf));
|
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)) {
|
if ((identity->sync) && (trans->segment.format == GST_FORMAT_TIME)) {
|
||||||
GstClock *clock;
|
GstClock *clock;
|
||||||
|
@ -565,7 +569,12 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
|
||||||
GstClockReturn cret;
|
GstClockReturn cret;
|
||||||
GstClockTime timestamp;
|
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 */
|
/* save id if we need to unlock */
|
||||||
identity->clock_id = gst_clock_new_single_shot_id (clock, timestamp);
|
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)
|
if (identity->single_segment && (trans->segment.format == GST_FORMAT_TIME)
|
||||||
&& (ret == GST_FLOW_OK)) {
|
&& (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 (buf) = GST_CLOCK_TIME_NONE;
|
||||||
GST_BUFFER_OFFSET_END (buf) = GST_CLOCK_TIME_NONE;
|
GST_BUFFER_OFFSET_END (buf) = GST_CLOCK_TIME_NONE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue