From 2bbf095e5b6748e993cc4755761c3fa021bef922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 15 Nov 2024 10:29:39 +0200 Subject: [PATCH] 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: --- subprojects/gst-plugins-good/gst/matroska/matroska-mux.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/subprojects/gst-plugins-good/gst/matroska/matroska-mux.c b/subprojects/gst-plugins-good/gst/matroska/matroska-mux.c index aeaebc8b63..68e5732290 100644 --- a/subprojects/gst-plugins-good/gst/matroska/matroska-mux.c +++ b/subprojects/gst-plugins-good/gst/matroska/matroska-mux.c @@ -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_buffer_unref (buffer); // GST_CLOCK_TIME_NONE < any other clock time - if (best == NULL || !GST_CLOCK_TIME_IS_VALID (timestamp) || (best != NULL - && GST_CLOCK_TIME_IS_VALID (best_ts) && timestamp < best_ts)) { + if (!GST_CLOCK_TIME_IS_VALID (timestamp)) { + best = mux_pad; + best_ts = timestamp; + break; + } else if (best == NULL || timestamp < best_ts) { best = mux_pad; best_ts = timestamp; }