From 6cf39d4a00e5f2009ff2383bdbe56cad50260e1f Mon Sep 17 00:00:00 2001
From: Taruntej Kanakamalla <taruntej@asymptotic.io>
Date: Thu, 5 Dec 2024 17:23:26 +0530
Subject: [PATCH] webrtc: use the nick to set enum type properties on
 openh264enc

The properties `rate-control` and `complexity` are of enum types and passing
a gint value is resulting in a panic. So pass the corresponding nick of the enum
value instead

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1971>
---
 net/webrtc/src/webrtcsink/imp.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/webrtc/src/webrtcsink/imp.rs b/net/webrtc/src/webrtcsink/imp.rs
index f3116d734..6621c6120 100644
--- a/net/webrtc/src/webrtcsink/imp.rs
+++ b/net/webrtc/src/webrtcsink/imp.rs
@@ -619,8 +619,8 @@ fn configure_encoder(enc: &gst::Element, start_bitrate: u32) {
             "openh264enc" => {
                 enc.set_property("bitrate", start_bitrate);
                 enc.set_property("gop-size", 2560u32);
-                enc.set_property("rate-control", 1);
-                enc.set_property("complexity", 0);
+                enc.set_property_from_str("rate-control", "bitrate");
+                enc.set_property_from_str("complexity", "low");
                 enc.set_property("background-detection", false);
                 enc.set_property("scene-change-detection", false);
             }
-- 
GitLab