matroskamux: Simplify timestamp comparison logic in find_best_pad()

If a buffer has no timestamp it is immediately muxed so we can directly break
the loop and simplify comparisons in the other cases.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7872>
This commit is contained in:
Sebastian Dröge 2024-11-15 10:29:39 +02:00 committed by GStreamer Marge Bot
parent a391728ad4
commit 2bbf095e5b

View file

@ -4215,8 +4215,11 @@ gst_matroska_mux_find_best_pad (GstMatroskaMux * mux, GstClockTime * best_time,
gst_matroska_track_get_buffer_timestamp (mux_pad->track, buffer); gst_matroska_track_get_buffer_timestamp (mux_pad->track, buffer);
gst_buffer_unref (buffer); gst_buffer_unref (buffer);
// GST_CLOCK_TIME_NONE < any other clock time // GST_CLOCK_TIME_NONE < any other clock time
if (best == NULL || !GST_CLOCK_TIME_IS_VALID (timestamp) || (best != NULL if (!GST_CLOCK_TIME_IS_VALID (timestamp)) {
&& GST_CLOCK_TIME_IS_VALID (best_ts) && timestamp < best_ts)) { best = mux_pad;
best_ts = timestamp;
break;
} else if (best == NULL || timestamp < best_ts) {
best = mux_pad; best = mux_pad;
best_ts = timestamp; best_ts = timestamp;
} }