From 8c2c565fd859acd0edb1e9f7a4bef510012ed0f4 Mon Sep 17 00:00:00 2001 From: Iason Paraskevopoulos Date: Fri, 27 Sep 2024 09:52:39 +0100 Subject: [PATCH] Fix enconding presets Fixes an issue with compute_appropriate_encoding, where the last preset in the list with the highest FPS wasn't considered. Changes the order in into_rtp_encodings to have the highest quality first. --- livekit/src/room/options.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/livekit/src/room/options.rs b/livekit/src/room/options.rs index 76577e14..e17ac214 100644 --- a/livekit/src/room/options.rs +++ b/livekit/src/room/options.rs @@ -179,7 +179,7 @@ pub fn compute_appropriate_encoding( for preset in presets { encoding = preset.encoding.clone(); - if preset.width >= size { + if preset.width > size { break; } } @@ -257,6 +257,7 @@ pub fn into_rtp_encodings( }) } + encodings.reverse(); encodings }