basetsmux: Add explicit macro for GstClockTimeDiff handling

The checks in the other macro were useless for unsigned values

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8229>
This commit is contained in:
Edward Hervey 2025-01-05 11:42:22 +01:00 committed by GStreamer Marge Bot
parent 67c4c35fb7
commit 7a2aef9fa2

View file

@ -271,6 +271,8 @@ enum
#define TS_MUX_CLOCK_BASE (TSMUX_CLOCK_FREQ * 10 * 360)
#define GSTTIME_TO_MPEGTIME(time) \
(gst_util_uint64_scale (time, CLOCK_BASE, GST_MSECOND/10))
#define GSTTIMEDIFF_TO_MPEGTIME(time) \
(((time) > 0 ? (gint64) 1 : (gint64) -1) * \
(gint64) gst_util_uint64_scale (ABS(time), CLOCK_BASE, GST_MSECOND/10))
/* 27 MHz SCR conversions: */
@ -1677,7 +1679,7 @@ gst_base_ts_mux_aggregate_buffer (GstBaseTsMux * mux,
}
if (GST_CLOCK_STIME_IS_VALID (best->dts)) {
dts = GSTTIME_TO_MPEGTIME (best->dts);
dts = GSTTIMEDIFF_TO_MPEGTIME (best->dts);
GST_DEBUG_OBJECT (mux, "Buffer has DTS %" GST_STIME_FORMAT " dts %"
G_GINT64_FORMAT, GST_STIME_ARGS (best->dts), dts);
}
@ -2218,7 +2220,7 @@ handle_scte35_section (GstBaseTsMux * mux, GstEvent * event,
/* Account for offsets potentially introduced between the demuxer and us */
pts_adjust +=
GSTTIME_TO_MPEGTIME (gst_event_get_running_time_offset (event));
GSTTIMEDIFF_TO_MPEGTIME (gst_event_get_running_time_offset (event));
pts_adjust &= 0x1ffffffff;
section_data = g_memdup2 (section->data, section->section_length);