Commit 4d53a7ac authored by Mathieu Duponchelle's avatar Mathieu Duponchelle 🐸 Committed by Mathieu Duponchelle

tsmux: actually respect the PCR frequency we target

parent dc2b28d4
......@@ -1067,14 +1067,16 @@ tsmux_write_stream_packet (TsMux * mux, TsMuxStream * stream)
}
/* Need to decide whether to write a new PCR in this packet */
if (stream->last_pcr == -1 ||
(cur_pcr - stream->last_pcr >
(TSMUX_SYS_CLOCK_FREQ / TSMUX_DEFAULT_PCR_FREQ))) {
if (stream->next_pcr == -1 || cur_pcr > stream->next_pcr) {
stream->pi.flags |=
TSMUX_PACKET_FLAG_ADAPTATION | TSMUX_PACKET_FLAG_WRITE_PCR;
stream->pi.pcr = cur_pcr;
stream->last_pcr = cur_pcr;
if (stream->next_pcr == -1)
stream->next_pcr =
cur_pcr + TSMUX_SYS_CLOCK_FREQ / TSMUX_DEFAULT_PCR_FREQ;
else
stream->next_pcr += TSMUX_SYS_CLOCK_FREQ / TSMUX_DEFAULT_PCR_FREQ;
} else {
cur_pcr = -1;
}
......
......@@ -228,7 +228,7 @@ tsmux_stream_new (guint16 pid, TsMuxStreamType stream_type)
stream->last_dts = GST_CLOCK_STIME_NONE;
stream->pcr_ref = 0;
stream->last_pcr = -1;
stream->next_pcr = -1;
return stream;
}
......
......@@ -199,8 +199,8 @@ struct TsMuxStream {
/* count of programs using this as PCR */
gint pcr_ref;
/* last time PCR written */
gint64 last_pcr;
/* Next time PCR should be written */
gint64 next_pcr;
/* audio parameters for stream
* (used in stream descriptor) */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment