summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2016-11-22 15:59:19 +0200
committerSebastian Dröge <sebastian@centricular.com>2016-11-23 18:17:06 +0200
commit351f2fca0a39cad58436ab83ae76ea6439de11e8 (patch)
tree8a8eae6645c997baab97755f7a33cf6ed9bb6334
parent9acc0b5d0eaf90aac845d5519ab78c613bd75692 (diff)
downloadgstreamer-plugins-good-351f2fca0a39cad58436ab83ae76ea6439de11e8.tar.gz
qtmux: Revert commits that set DTS and duration on buffers unconditionally
39f7e52266fde3b3c035e22cbcbb2bb1fa207b17 was setting the buffer duration to 0 if is not valid, under the assumption that this is "the last" buffer and no others are coming next. This is wrong, last_buf is the previous buffer and not the very last one. 4e3c13c87c258c9c95e2217d32ab314d12b5fffc was setting DTS to 0 if there was none. This will set DTS to 0 for all e.g. audio streams, completely messing up calculations if streams don't start at 0. https://bugzilla.gnome.org/show_bug.cgi?id=774840
-rw-r--r--gst/isomp4/gstqtmux.c30
1 files changed, 2 insertions, 28 deletions
diff --git a/gst/isomp4/gstqtmux.c b/gst/isomp4/gstqtmux.c
index 61362d907..bfeaf6643 100644
--- a/gst/isomp4/gstqtmux.c
+++ b/gst/isomp4/gstqtmux.c
@@ -3184,35 +3184,8 @@ gst_qt_mux_add_buffer (GstQTMux * qtmux, GstQTPad * pad, GstBuffer * buf)
last_buf = pad->last_buf;
- /* DTS delta is used to calculate sample duration.
- * If buffer has missing DTS, we take either segment start or
- * previous buffer end time, whichever is later.
- * This must only be done for non sparse streams, sparse streams
- * can have gaps between buffers (which is handled later by adding
- * extra empty buffer with duration that fills the gap). */
- if (!pad->sparse && buf && !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) = 0; /* running-time 0 */
-
- 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;
- }
- }
-
ret = gst_qt_mux_check_and_update_timecode (qtmux, pad, buf, ret);
- if (last_buf && !buf && !GST_BUFFER_DURATION_IS_VALID (last_buf)) {
- /* this is last buffer; there is no next buffer so we need valid number as duration */
- last_buf = gst_buffer_make_writable (last_buf);
- GST_BUFFER_DURATION (last_buf) = 0;
- }
-
if (last_buf == NULL) {
#ifndef GST_DISABLE_GST_DEBUG
if (buf == NULL) {
@@ -3227,8 +3200,9 @@ gst_qt_mux_add_buffer (GstQTMux * qtmux, GstQTPad * pad, GstBuffer * buf)
#endif
pad->last_buf = buf;
goto exit;
- } else
+ } else {
gst_buffer_ref (last_buf);
+ }
/* if this is the first buffer, store the timestamp */
if (G_UNLIKELY (pad->first_ts == GST_CLOCK_TIME_NONE) && last_buf) {