mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 23:06:49 +00:00
qtmux: use segment.start or last buffer end time in case of missing DTS
https://bugzilla.gnome.org/show_bug.cgi?id=707340
This commit is contained in:
parent
85728c04c4
commit
4e3c13c87c
1 changed files with 21 additions and 0 deletions
|
@ -2130,6 +2130,27 @@ gst_qt_mux_add_buffer (GstQTMux * qtmux, GstQTPad * pad, GstBuffer * buf)
|
|||
|
||||
last_buf = pad->last_buf;
|
||||
|
||||
/* if buffer has missing DTS, we take either segment start or previous buffer end time,
|
||||
which ever is later */
|
||||
if (buf && pad->have_dts && !GST_BUFFER_DTS_IS_VALID (buf)) {
|
||||
GstClockTime last_buf_duration = last_buf
|
||||
&& GST_BUFFER_DURATION_IS_VALID (last_buf) ?
|
||||
GST_BUFFER_DURATION (last_buf) : 0;
|
||||
|
||||
buf = gst_buffer_make_writable (buf);
|
||||
GST_BUFFER_DTS (buf) =
|
||||
gst_segment_to_running_time (&pad->collect.segment, GST_FORMAT_TIME,
|
||||
pad->collect.segment.start);
|
||||
if (GST_CLOCK_TIME_IS_VALID (pad->first_ts))
|
||||
check_and_subtract_ts (qtmux, &GST_BUFFER_DTS (buf), pad->first_ts);
|
||||
|
||||
if (last_buf
|
||||
&& (GST_BUFFER_DTS (last_buf) + last_buf_duration) >
|
||||
GST_BUFFER_DTS (buf)) {
|
||||
GST_BUFFER_DTS (buf) = GST_BUFFER_DTS (last_buf) + last_buf_duration;
|
||||
}
|
||||
}
|
||||
|
||||
if (last_buf == NULL) {
|
||||
#ifndef GST_DISABLE_GST_DEBUG
|
||||
if (buf == NULL) {
|
||||
|
|
Loading…
Reference in a new issue