mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
tsmux: Refactor get_current_pcr
No functional change. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1431>
This commit is contained in:
parent
d4caa1b3ae
commit
5a358b7687
1 changed files with 16 additions and 9 deletions
|
@ -1236,18 +1236,25 @@ tsmux_write_null_ts_header (guint8 * buf)
|
|||
*buf++ = 0x10;
|
||||
}
|
||||
|
||||
static gint64
|
||||
ts_to_pcr (gint64 ts)
|
||||
{
|
||||
if (ts == G_MININT64) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (ts - TSMUX_PCR_OFFSET) * (TSMUX_SYS_CLOCK_FREQ / TSMUX_CLOCK_FREQ);
|
||||
}
|
||||
|
||||
static gint64
|
||||
get_current_pcr (TsMux * mux, gint64 cur_ts)
|
||||
{
|
||||
if (mux->bitrate)
|
||||
return (CLOCK_BASE - TSMUX_PCR_OFFSET) * 300 +
|
||||
gst_util_uint64_scale (mux->n_bytes * 8, TSMUX_SYS_CLOCK_FREQ,
|
||||
mux->bitrate);
|
||||
else if (cur_ts != G_MININT64)
|
||||
return (cur_ts -
|
||||
TSMUX_PCR_OFFSET) * (TSMUX_SYS_CLOCK_FREQ / TSMUX_CLOCK_FREQ);
|
||||
else
|
||||
return 0;
|
||||
if (!mux->bitrate)
|
||||
return ts_to_pcr (cur_ts);
|
||||
|
||||
return ts_to_pcr (CLOCK_BASE) +
|
||||
gst_util_uint64_scale (mux->n_bytes * 8, TSMUX_SYS_CLOCK_FREQ,
|
||||
mux->bitrate);
|
||||
}
|
||||
|
||||
static gint64
|
||||
|
|
Loading…
Reference in a new issue