summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Santos <thiagoss@osg.samsung.com>2015-04-07 00:53:35 -0300
committerThiago Santos <thiagoss@osg.samsung.com>2015-04-10 10:05:24 -0300
commit5780afe1313caa08ffb2c2d36c153d9a6b297c3e (patch)
treeca967ed0c542673b49a031d5a9c3a95151c7a5c7
parent9f7c659ff0c1023777d8c9a08191b01263565145 (diff)
qtmux: remove subtraction that makes PTS/DTS start from 0
As qt uses durations, it doesn't matter, only the difference between consecutive buffers is important. Also, collectpads already replaces PTS/DTS with the running times for them.
-rw-r--r--gst/isomp4/gstqtmux.c40
1 files changed, 2 insertions, 38 deletions
diff --git a/gst/isomp4/gstqtmux.c b/gst/isomp4/gstqtmux.c
index a8054a178..898d38f04 100644
--- a/gst/isomp4/gstqtmux.c
+++ b/gst/isomp4/gstqtmux.c
@@ -2330,21 +2330,6 @@ init:
return ret;
}
-static void
-check_and_subtract_ts (GstQTMux * qtmux, GstClockTime * ts_a, GstClockTime ts_b)
-{
- if (G_LIKELY (GST_CLOCK_TIME_IS_VALID (*ts_a))) {
- if (G_LIKELY (*ts_a >= ts_b)) {
- *ts_a -= ts_b;
- } else {
- *ts_a = 0;
- GST_WARNING_OBJECT (qtmux, "Subtraction would result in negative value, "
- "using 0 as result");
- }
- }
-}
-
-
static GstFlowReturn
gst_qt_mux_register_and_push_sample (GstQTMux * qtmux, GstQTPad * pad,
GstBuffer * buffer, gboolean is_last_buffer, guint nsamples,
@@ -2408,13 +2393,6 @@ gst_qt_mux_add_buffer (GstQTMux * qtmux, GstQTPad * pad, GstBuffer * buf)
buf = pad->prepare_buf_func (pad, buf, qtmux);
}
- if (G_LIKELY (buf != NULL && GST_CLOCK_TIME_IS_VALID (pad->first_ts) &&
- pad->first_ts != 0)) {
- buf = gst_buffer_make_writable (buf);
- check_and_subtract_ts (qtmux, &GST_BUFFER_DTS (buf), pad->first_ts);
- check_and_subtract_ts (qtmux, &GST_BUFFER_PTS (buf), pad->first_ts);
- }
-
last_buf = pad->last_buf;
/* DTS delta is used to calculate sample duration.
@@ -2429,11 +2407,7 @@ gst_qt_mux_add_buffer (GstQTMux * qtmux, GstQTPad * pad, GstBuffer * 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);
+ GST_BUFFER_DTS (buf) = 0; /* running-time 0 */
if (last_buf
&& (GST_BUFFER_DTS (last_buf) + last_buf_duration) >
@@ -2471,7 +2445,6 @@ gst_qt_mux_add_buffer (GstQTMux * qtmux, GstQTPad * pad, GstBuffer * buf)
/* if this is the first buffer, store the timestamp */
if (G_UNLIKELY (pad->first_ts == GST_CLOCK_TIME_NONE) && last_buf) {
if (GST_BUFFER_DTS_IS_VALID (last_buf)) {
- /* first pad always has DTS. If it was not provided by upstream it was set to segment start */
pad->first_ts = GST_BUFFER_DTS (last_buf);
} else if (GST_BUFFER_PTS_IS_VALID (last_buf)) {
pad->first_ts = GST_BUFFER_PTS (last_buf);
@@ -2479,23 +2452,14 @@ gst_qt_mux_add_buffer (GstQTMux * qtmux, GstQTPad * pad, GstBuffer * buf)
if (GST_CLOCK_TIME_IS_VALID (pad->first_ts)) {
GST_DEBUG ("setting first_ts to %" G_GUINT64_FORMAT, pad->first_ts);
- last_buf = gst_buffer_make_writable (last_buf);
- check_and_subtract_ts (qtmux, &GST_BUFFER_DTS (last_buf), pad->first_ts);
- check_and_subtract_ts (qtmux, &GST_BUFFER_PTS (last_buf), pad->first_ts);
- if (buf) {
- buf = gst_buffer_make_writable (buf);
- check_and_subtract_ts (qtmux, &GST_BUFFER_DTS (buf), pad->first_ts);
- check_and_subtract_ts (qtmux, &GST_BUFFER_PTS (buf), pad->first_ts);
- }
} else {
- GST_ERROR_OBJECT (qtmux, "First buffer for pad %s has no timestamp, "
+ GST_WARNING_OBJECT (qtmux, "First buffer for pad %s has no timestamp, "
"using 0 as first timestamp", GST_PAD_NAME (pad->collect.pad));
pad->first_ts = 0;
}
GST_DEBUG_OBJECT (qtmux, "Stored first timestamp for pad %s %"
GST_TIME_FORMAT, GST_PAD_NAME (pad->collect.pad),
GST_TIME_ARGS (pad->first_ts));
-
}
if (last_buf && buf && GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DTS (buf)) &&