collectpads: handle buffer with dts-only when mapping to running time

Otherwise the buffer was left with the original values and later would
be compared with other buffers that were converted to runninn time,
leading to bad interleaving of multiple streams.

https://bugzilla.gnome.org/show_bug.cgi?id=757961
This commit is contained in:
Thiago Santos 2015-11-13 20:44:57 -03:00
parent 971ac61c36
commit 42d45a0f40

View file

@ -505,22 +505,27 @@ gst_collect_pads_clip_running_time (GstCollectPads * pads,
GstCollectData * cdata, GstBuffer * buf, GstBuffer ** outbuf,
gpointer user_data)
{
GstClockTime time;
*outbuf = buf;
time = GST_BUFFER_PTS (buf);
/* invalid left alone and passed */
if (G_LIKELY (GST_CLOCK_TIME_IS_VALID (time))) {
time = gst_segment_to_running_time (&cdata->segment, GST_FORMAT_TIME, time);
if (G_LIKELY (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DTS_OR_PTS (buf)))) {
GstClockTime time;
GstClockTime buf_dts, abs_dts;
gint dts_sign;
time = GST_BUFFER_PTS (buf);
if (GST_CLOCK_TIME_IS_VALID (time)) {
time =
gst_segment_to_running_time (&cdata->segment, GST_FORMAT_TIME, time);
if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (time))) {
GST_DEBUG_OBJECT (cdata->pad, "clipping buffer on pad outside segment %"
GST_TIME_FORMAT, GST_TIME_ARGS (GST_BUFFER_PTS (buf)));
gst_buffer_unref (buf);
*outbuf = NULL;
} else {
GstClockTime buf_dts, abs_dts;
gint dts_sign;
return GST_FLOW_OK;
}
}
GST_LOG_OBJECT (cdata->pad, "buffer pts %" GST_TIME_FORMAT " -> %"
GST_TIME_FORMAT " running time",
@ -546,7 +551,6 @@ gst_collect_pads_clip_running_time (GstCollectPads * pads,
GST_STIME_FORMAT " running time", GST_TIME_ARGS (buf_dts),
GST_STIME_ARGS (GST_COLLECT_PADS_DTS (cdata)));
}
}
return GST_FLOW_OK;
}