Skip to content
Snippets Groups Projects
Commit 2284fc57 authored by Jan Schmidt's avatar Jan Schmidt
Browse files

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
parent cc1968e3
No related branches found
No related tags found
Loading
......@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment