gstreamer/subprojects/gst-plugins-bad/gst/mpegtsmux
Jordan Yelloz f11735c97b tsmux: Adjust byte counter when adjusting bitrate
When configured in constant bitrate mode, the muxer computes timing information
using the configured bitrate and the byte counter (now = bytes sent / byterate).

When an application changes the bitrate in CBR mode during playback, the
relationship between bytes sent and bitrate is no longer valid so new timing
values will be off by the ratio of the old bitrate to the new bitrate.
Furthermore, it will upset the way that padding is generated.

pad_stream() works by trying to fit the byte counter to now * byterate.
The result is that when decreasing bitrate, the muxer stalls, waiting until the
byte counter is in agreement with now * byterate. Also, when increasing
bitrate, the padding will spike in volume until the byte counter fits with
now * byterate.

If the byte counter is scaled by the ratio of new bitrate / old bitrate when
adjusting bitrate, then padding is generated in a way that applications would
more likely expect.

One detail this change doesn't yet address is whether the next PCR will match up
optimally with the previous PCR right after the byte counter is scaled. In that
case, some correction may be necessary. Also, perhaps the user should be
prevented from changing from bitrate=0 to bitrate=nonzero during playback since
it's not straightforward how to scale the byte counter in that case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7158>
2024-07-25 15:02:11 +00:00
..
tsmux tsmux: Adjust byte counter when adjusting bitrate 2024-07-25 15:02:11 +00:00
gstatscmux.c tsmux: Fix default get_es_descrs_func 2023-10-19 22:34:28 +00:00
gstatscmux.h tsmux: Separate DVB and ATSC AC3 descriptors 2023-05-23 14:00:11 +00:00
gstbasetsmux.c mpegtsmux: mux meta/x-id3 2024-07-03 08:40:21 +00:00
gstbasetsmux.h mpegtsmux: add stream-number property on GstBaseTsMuxPad 2023-06-15 10:34:25 +00:00
gstbasetsmuxaac.c Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00
gstbasetsmuxaac.h Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00
gstbasetsmuxjpeg2000.c Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00
gstbasetsmuxjpeg2000.h Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00
gstbasetsmuxopus.c Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00
gstbasetsmuxopus.h Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00
gstbasetsmuxttxt.c Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00
gstbasetsmuxttxt.h Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00
gstmpegtsmux.c mpegtsmux: mux meta/x-id3 2024-07-03 08:40:21 +00:00
gstmpegtsmux.h Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00
gstmpegtsmuxplugin.c Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00
meson.build meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00