Improve codec support

This commit is contained in:
Marvin W 2021-11-09 22:06:46 +01:00 committed by fiaxh
parent aae13b9ea6
commit 72569ea52f

View file

@ -146,7 +146,7 @@ public class Dino.Plugins.Rtp.CodecUtil {
// VP8 // VP8
if (encode == "msdkvp8enc") return " rate-control=vbr"; if (encode == "msdkvp8enc") return " rate-control=vbr";
if (encode == "vaapivp8enc") return " rate-control=vbr"; if (encode == "vaapivp8enc") return " rate-control=vbr";
if (encode == "vp8enc") return " deadline=1 error-resilient=1"; if (encode == "vp8enc") return " deadline=1 error-resilient=3 lag-in-frames=0 resize-allowed=true threads=8 dropframe-threshold=30";
// OPUS // OPUS
if (encode == "opusenc") { if (encode == "opusenc") {
@ -159,7 +159,8 @@ public class Dino.Plugins.Rtp.CodecUtil {
public static string? get_encode_suffix(string media, string codec, string encode, JingleRtp.PayloadType? payload_type) { public static string? get_encode_suffix(string media, string codec, string encode, JingleRtp.PayloadType? payload_type) {
// H264 // H264
if (media == "video" && codec == "h264") return " ! video/x-h264,profile=constrained-baseline ! h264parse"; if (media == "video" && codec == "h264") return " ! capsfilter caps=video/x-h264,profile=constrained-baseline ! h264parse";
if (media == "video" && codec == "vp8" && encode == "vp8enc") return " ! capsfilter caps=video/x-vp8,profile=(string)1";
return null; return null;
} }
@ -171,17 +172,18 @@ public class Dino.Plugins.Rtp.CodecUtil {
if (encode_name == null) return 0; if (encode_name == null) return 0;
Gst.Element encode = encode_bin.get_by_name(@"$(encode_bin.name)_encode"); Gst.Element encode = encode_bin.get_by_name(@"$(encode_bin.name)_encode");
bitrate = uint.min(2048000, bitrate);
switch (encode_name) { switch (encode_name) {
case "msdkh264enc": case "msdkh264enc":
case "vaapih264enc": case "vaapih264enc":
case "x264enc": case "x264enc":
case "msdkvp9enc":
case "vaapivp9enc":
case "msdkvp8enc": case "msdkvp8enc":
case "vaapivp8enc": case "vaapivp8enc":
bitrate = uint.min(2048000, bitrate); bitrate = uint.min(2048000, bitrate);
encode.set("bitrate", bitrate); encode.set("bitrate", bitrate);
return bitrate; return bitrate;
case "vp9enc":
case "vp8enc": case "vp8enc":
bitrate = uint.min(2147483, bitrate); bitrate = uint.min(2147483, bitrate);
encode.set("target-bitrate", bitrate * 1000); encode.set("target-bitrate", bitrate * 1000);
@ -198,6 +200,7 @@ public class Dino.Plugins.Rtp.CodecUtil {
public static string? get_decode_args(string media, string codec, string decode, JingleRtp.PayloadType? payload_type) { public static string? get_decode_args(string media, string codec, string decode, JingleRtp.PayloadType? payload_type) {
if (decode == "opusdec" && payload_type != null && payload_type.parameters.has("useinbandfec", "1")) return " use-inband-fec=true"; if (decode == "opusdec" && payload_type != null && payload_type.parameters.has("useinbandfec", "1")) return " use-inband-fec=true";
if (decode == "vaapivp9dec" || decode == "vaapivp8dec" || decode == "vaapih264dec") return " max-errors=100"; if (decode == "vaapivp9dec" || decode == "vaapivp8dec" || decode == "vaapih264dec") return " max-errors=100";
if (decode == "vp8dec") return " threads=8";
return null; return null;
} }