webrtcsink: add nvh265enc support

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1980>
This commit is contained in:
Mathieu Duponchelle 2024-12-10 19:31:21 +01:00 committed by GStreamer Marge Bot
parent b44174b180
commit 8886cceaf0

View file

@ -767,7 +767,7 @@ fn configure_encoder(enc: &gst::Element, start_bitrate: u32) {
enc.set_property("background-detection", false); enc.set_property("background-detection", false);
enc.set_property("scene-change-detection", false); enc.set_property("scene-change-detection", false);
} }
"nvh264enc" => { "nvh264enc" | "nvh265enc" => {
enc.set_property("bitrate", start_bitrate / 1000); enc.set_property("bitrate", start_bitrate / 1000);
enc.set_property("gop-size", 2560i32); enc.set_property("gop-size", 2560i32);
enc.set_property_from_str("rc-mode", "cbr-ld-hq"); enc.set_property_from_str("rc-mode", "cbr-ld-hq");
@ -1039,6 +1039,7 @@ impl VideoEncoder {
| "x264enc" | "x264enc"
| "openh264enc" | "openh264enc"
| "nvh264enc" | "nvh264enc"
| "nvh265enc"
| "vaapih264enc" | "vaapih264enc"
| "vaapivp8enc" | "vaapivp8enc"
| "qsvh264enc" | "qsvh264enc"
@ -1057,8 +1058,10 @@ impl VideoEncoder {
let bitrate = match self.factory_name.as_str() { let bitrate = match self.factory_name.as_str() {
"vp8enc" | "vp9enc" => self.element.property::<i32>("target-bitrate"), "vp8enc" | "vp9enc" => self.element.property::<i32>("target-bitrate"),
"av1enc" => (self.element.property::<u32>("target-bitrate") * 1000) as i32, "av1enc" => (self.element.property::<u32>("target-bitrate") * 1000) as i32,
"x264enc" | "nvh264enc" | "vaapih264enc" | "vaapivp8enc" | "qsvh264enc" "x264enc" | "nvh264enc" | "nvh265enc" | "vaapih264enc" | "vaapivp8enc"
| "nvav1enc" | "vpuenc_h264" => (self.element.property::<u32>("bitrate") * 1000) as i32, | "qsvh264enc" | "nvav1enc" | "vpuenc_h264" => {
(self.element.property::<u32>("bitrate") * 1000) as i32
}
"openh264enc" | "nvv4l2h264enc" | "nvv4l2vp8enc" | "nvv4l2vp9enc" | "rav1enc" "openh264enc" | "nvv4l2h264enc" | "nvv4l2vp8enc" | "nvv4l2vp9enc" | "rav1enc"
| "nvv4l2av1enc" => (self.element.property::<u32>("bitrate")) as i32, | "nvv4l2av1enc" => (self.element.property::<u32>("bitrate")) as i32,
_ => return Err(WebRTCSinkError::BitrateNotSupported), _ => return Err(WebRTCSinkError::BitrateNotSupported),
@ -1091,8 +1094,8 @@ impl VideoEncoder {
"av1enc" => self "av1enc" => self
.element .element
.set_property("target-bitrate", (bitrate / 1000) as u32), .set_property("target-bitrate", (bitrate / 1000) as u32),
"x264enc" | "nvh264enc" | "vaapih264enc" | "vaapivp8enc" | "qsvh264enc" "x264enc" | "nvh264enc" | "nvh265enc" | "vaapih264enc" | "vaapivp8enc"
| "nvav1enc" | "vpuenc_h264" => { | "qsvh264enc" | "nvav1enc" | "vpuenc_h264" => {
self.element self.element
.set_property("bitrate", (bitrate / 1000) as u32); .set_property("bitrate", (bitrate / 1000) as u32);
} }