mpegtsmux: Mux timestampless buffers immediately

Instead of leaving them queued indefinitely, or until we're timing out
and it's the only buffer queued.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7870>
This commit is contained in:
Jan Alexander Steffens (heftig) 2021-07-01 13:09:04 +02:00 committed by GStreamer Marge Bot
parent 3971f8b86c
commit d0543444d8

View file

@ -2642,6 +2642,7 @@ gst_base_ts_mux_find_best_pad (GstAggregator * aggregator,
GstBaseTsMuxPad *tpad = GST_BASE_TS_MUX_PAD (l->data); GstBaseTsMuxPad *tpad = GST_BASE_TS_MUX_PAD (l->data);
GstAggregatorPad *apad = GST_AGGREGATOR_PAD_CAST (tpad); GstAggregatorPad *apad = GST_AGGREGATOR_PAD_CAST (tpad);
GstBuffer *buffer; GstBuffer *buffer;
GstClockTime ts;
buffer = gst_aggregator_pad_peek_buffer (apad); buffer = gst_aggregator_pad_peek_buffer (apad);
if (!buffer) { if (!buffer) {
@ -2652,15 +2653,20 @@ gst_base_ts_mux_find_best_pad (GstAggregator * aggregator,
} }
continue; continue;
} }
if (best_ts == GST_CLOCK_TIME_NONE) {
ts = GST_BUFFER_DTS_OR_PTS (buffer);
if (!GST_CLOCK_TIME_IS_VALID (ts)) {
GST_WARNING_OBJECT (apad, "Buffer has no timestamp: %" GST_PTR_FORMAT,
buffer);
best = tpad; best = tpad;
best_ts = GST_BUFFER_DTS_OR_PTS (buffer); best_ts = ts;
} else if (GST_BUFFER_DTS_OR_PTS (buffer) != GST_CLOCK_TIME_NONE) { gst_buffer_unref (buffer);
GstClockTime t = GST_BUFFER_DTS_OR_PTS (buffer); break;
if (t < best_ts) { }
best = tpad;
best_ts = t; if (!GST_CLOCK_TIME_IS_VALID (best_ts) || ts < best_ts) {
} best = tpad;
best_ts = ts;
} }
gst_buffer_unref (buffer); gst_buffer_unref (buffer);
} }