Commit 9996ae9a authored by Mathieu Duponchelle's avatar Mathieu Duponchelle 🐸 Committed by Mathieu Duponchelle

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
parent 15f149a9
Pipeline #46781 passed with stages
in 48 minutes and 30 seconds
......@@ -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);
......
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