mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 20:42:30 +00:00
tsmux: actually respect the PCR frequency we target
This commit is contained in:
parent
dc2b28d456
commit
4d53a7ac09
3 changed files with 10 additions and 8 deletions
|
@ -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) */
|
||||
|
|
Loading…
Reference in a new issue