mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
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
This commit is contained in:
parent
3aa69ca0bb
commit
2849ec2963
1 changed files with 6 additions and 5 deletions
|
@ -133,7 +133,7 @@ static void
|
||||||
handle_buffer_measuring (GstSplitMuxPartReader * reader,
|
handle_buffer_measuring (GstSplitMuxPartReader * reader,
|
||||||
GstSplitMuxPartPad * part_pad, GstBuffer * buf)
|
GstSplitMuxPartPad * part_pad, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
GstClockTime ts = GST_CLOCK_TIME_NONE;
|
GstClockTimeDiff ts = GST_CLOCK_STIME_NONE;
|
||||||
GstClockTimeDiff offset;
|
GstClockTimeDiff offset;
|
||||||
|
|
||||||
if (reader->prep_state == PART_STATE_PREPARING_COLLECT_STREAMS &&
|
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
|
GST_DEBUG_OBJECT (reader, "Pad %" GST_PTR_FORMAT
|
||||||
" incoming PTS %" GST_TIME_FORMAT
|
" incoming PTS %" GST_TIME_FORMAT
|
||||||
" DTS %" GST_TIME_FORMAT " offset by %" GST_STIME_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_DTS (buf)),
|
||||||
GST_TIME_ARGS (GST_BUFFER_PTS (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))
|
if (GST_BUFFER_DURATION_IS_VALID (buf))
|
||||||
ts += GST_BUFFER_DURATION (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;
|
part_pad->max_ts = ts;
|
||||||
GST_LOG_OBJECT (reader,
|
GST_LOG_OBJECT (reader,
|
||||||
"pad %" GST_PTR_FORMAT " max TS now %" GST_TIME_FORMAT, part_pad,
|
"pad %" GST_PTR_FORMAT " max TS now %" GST_TIME_FORMAT, part_pad,
|
||||||
|
|
Loading…
Reference in a new issue