mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
tsmux: output smoothly increasing PTS when in CBR mode
Thanks to that, when its output is plugged into eg a udp sink, the outgoing data can be output in a smoother way, reducing burstiness
This commit is contained in:
parent
15f149a990
commit
9996ae9ae0
2 changed files with 6 additions and 1 deletions
|
@ -1017,7 +1017,8 @@ new_packet_cb (GstBuffer * buf, void *user_data, gint64 new_pcr)
|
|||
|
||||
gst_buffer_map (buf, &map, GST_MAP_READWRITE);
|
||||
|
||||
GST_BUFFER_PTS (buf) = mux->last_ts;
|
||||
if (!GST_CLOCK_TIME_IS_VALID (GST_BUFFER_PTS (buf)))
|
||||
GST_BUFFER_PTS (buf) = mux->last_ts;
|
||||
|
||||
/* do common init (flags and streamheaders) */
|
||||
new_packet_common_init (mux, buf, map.data, map.size);
|
||||
|
|
|
@ -660,6 +660,10 @@ tsmux_packet_out (TsMux * mux, GstBuffer * buf, gint64 pcr)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
if (mux->bitrate)
|
||||
GST_BUFFER_PTS (buf) =
|
||||
gst_util_uint64_scale (mux->n_bytes * 8, GST_SECOND, mux->bitrate);
|
||||
|
||||
mux->n_bytes += gst_buffer_get_size (buf);
|
||||
|
||||
return mux->write_func (buf, mux->write_func_data, pcr);
|
||||
|
|
Loading…
Reference in a new issue