summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Schmidt <jan@centricular.com>2017-02-07 13:10:18 +1100
committerJan Schmidt <jan@centricular.com>2017-02-07 13:13:48 +1100
commit2284fc579c1b9a7b0dba9abf4313803cd904bf16 (patch)
tree1361ab870447e70fe6cf7169cb2be062199231b8
parentcc1968e3e7995ae737e4d484ecf7b8b6139dac91 (diff)
downloadgstreamer-plugins-good-2284fc579c1b9a7b0dba9abf4313803cd904bf16.tar.gz
splitmuxsrc: Allow for buffers before the segment when measuring
Used signed calculations when measuring the max_ts of an input fragment, so as to calculate the correct duration and offset when buffers have timestamps preceding their segment
-rw-r--r--gst/multifile/gstsplitmuxpartreader.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gst/multifile/gstsplitmuxpartreader.c b/gst/multifile/gstsplitmuxpartreader.c
index 1753b3744..0573d69be 100644
--- a/gst/multifile/gstsplitmuxpartreader.c
+++ b/gst/multifile/gstsplitmuxpartreader.c
@@ -133,7 +133,7 @@ static void
handle_buffer_measuring (GstSplitMuxPartReader * reader,
GstSplitMuxPartPad * part_pad, GstBuffer * buf)
{
- GstClockTime ts = GST_CLOCK_TIME_NONE;
+ GstClockTimeDiff ts = GST_CLOCK_STIME_NONE;
GstClockTimeDiff offset;
if (reader->prep_state == PART_STATE_PREPARING_COLLECT_STREAMS &&
@@ -164,16 +164,17 @@ handle_buffer_measuring (GstSplitMuxPartReader * reader,
GST_DEBUG_OBJECT (reader, "Pad %" GST_PTR_FORMAT
" incoming PTS %" GST_TIME_FORMAT
" DTS %" GST_TIME_FORMAT " offset by %" GST_STIME_FORMAT
- " to %" GST_TIME_FORMAT, part_pad,
+ " to %" GST_STIME_FORMAT, part_pad,
GST_TIME_ARGS (GST_BUFFER_DTS (buf)),
GST_TIME_ARGS (GST_BUFFER_PTS (buf)),
- GST_STIME_ARGS (offset), GST_TIME_ARGS (ts));
+ GST_STIME_ARGS (offset), GST_STIME_ARGS (ts));
- if (GST_CLOCK_TIME_IS_VALID (ts)) {
+ if (GST_CLOCK_STIME_IS_VALID (ts)) {
if (GST_BUFFER_DURATION_IS_VALID (buf))
ts += GST_BUFFER_DURATION (buf);
- if (GST_CLOCK_TIME_IS_VALID (ts) && ts > part_pad->max_ts) {
+ if (GST_CLOCK_STIME_IS_VALID (ts)
+ && ts > (GstClockTimeDiff) part_pad->max_ts) {
part_pad->max_ts = ts;
GST_LOG_OBJECT (reader,
"pad %" GST_PTR_FORMAT " max TS now %" GST_TIME_FORMAT, part_pad,