Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions plugins/rtp/src/codec_util.vala
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ public class Dino.Plugins.Rtp.CodecUtil {
"msdkh264enc",
#endif
#if ENABLE_VAAPI
"vah264lpenc",
"vah264enc",
"vaapih264enc",
#endif
"x264enc"
Expand All @@ -122,6 +124,7 @@ public class Dino.Plugins.Rtp.CodecUtil {
"msdkvp8enc",
#endif
#if ENABLE_VAAPI
"vavp8enc",
"vaapivp8enc",
#endif
"vp8enc"
Expand Down Expand Up @@ -154,16 +157,18 @@ public class Dino.Plugins.Rtp.CodecUtil {
"msdkh264dec",
#endif
#if ENABLE_VAAPI
"vah264dec",
"vaapih264dec",
#endif
null
"avdec_h264"
};
case "vp9":
return new string[] {
#if ENABLE_MSDK
"msdkvp9dec",
#endif
#if ENABLE_VAAPI
"vavp9dec",
"vaapivp9dec",
#endif
"vp9dec"
Expand All @@ -174,6 +179,7 @@ public class Dino.Plugins.Rtp.CodecUtil {
"msdkvp8dec",
#endif
#if ENABLE_VAAPI
"vavp8dec",
"vaapivp8dec",
#endif
"vp8dec"
Expand All @@ -185,18 +191,18 @@ public class Dino.Plugins.Rtp.CodecUtil {

public static string? get_encode_prefix(string media, string codec, string encode, JingleRtp.PayloadType? payload_type) {
if (encode == "msdkh264enc") return "capsfilter caps=video/x-raw,format=NV12 ! ";
if (encode == "vaapih264enc") return "capsfilter caps=video/x-raw,format=NV12 ! ";
if (encode == "vah264lpenc" || encode == "vah264enc" || encode == "vaapih264enc") return "capsfilter caps=video/x-raw,format=NV12 ! ";
return null;
}

public static string? get_encode_args(string media, string codec, string encode, JingleRtp.PayloadType? payload_type) {
// H264
if (encode == "msdkh264enc") return @" rate-control=vbr";
if (encode == "vaapih264enc") return @" rate-control=vbr";
if (encode == "vah264lpenc" || encode == "vah264enc" || encode == "vaapih264enc") return @" rate-control=vbr";
if (encode == "x264enc") return @" byte-stream=1 speed-preset=ultrafast tune=zerolatency bframes=0 cabac=false dct8x8=false";

// VP8
if (encode == "vaapivp8enc" || encode == "msdkvp8enc") return " rate-control=vbr target-percentage=90";
if (encode == "vavp8enc" || encode == "vaapivp8enc" || encode == "msdkvp8enc") return " rate-control=vbr target-percentage=90";
if (encode == "vp8enc") return " deadline=1 error-resilient=3 lag-in-frames=0 resize-allowed=true threads=8 dropframe-threshold=30 end-usage=vbr cpu-used=4";

// VP9
Expand Down Expand Up @@ -229,11 +235,14 @@ public class Dino.Plugins.Rtp.CodecUtil {

switch (encode_name) {
case "msdkh264enc":
case "vah264enc":
case "vah264lpenc":
case "vaapih264enc":
case "x264enc":
case "msdkvp9enc":
case "vaapivp9enc":
case "msdkvp8enc":
case "vavp8enc":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is missing vavp9enc - however I think the vp9 elements will fail the tests anyway without vp9parse for both en- and decoding (vp8 is one of the only codecs not needing that).

Given that vavp9enc is

  1. only supported by a very limited set of devices (Intel only)
  2. pretty unlikely to be used as vah264enc is usually present

I suggest to drop it from the PR altogether and only leave the decoding/vavp9dec parts (even though that'll likely need vp9parse in get_decode_prefix() , see rmader@829a5c3

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P.S.: not sure if that actually makes sense as vp9 encoding would still be broken/problematic. Maybe it's better to just drop vp9 altogether - vp8 is the better fallback and h264 is the better default anyway.

I.e. leaving it out in this PR and then do a follow-up PR dropping support for vp9 and the legacy vaapi* elements.

case "vaapivp8enc":
bitrate = uint.min(2048000, bitrate);
encode.set("bitrate", bitrate);
Expand Down Expand Up @@ -270,7 +279,7 @@ public class Dino.Plugins.Rtp.CodecUtil {

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 == "vaapivp9dec" || decode == "vaapivp8dec" || decode == "vaapih264dec") return " max-errors=100";
if (decode == "vavp9dec" || decode == "vaapivp9dec" || decode == "vavp8dec" || decode == "vaapivp8dec" || decode == "vah264dec" || decode == "vaapih264dec") return " max-errors=100";
if (decode == "vp8dec" || decode == "vp9dec") return " threads=8";
return null;
}
Expand Down