aboutsummaryrefslogtreecommitdiff
path: root/plugins/rtp/src
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2022-02-11 19:55:19 +0100
committerMarvin W <git@larma.de>2022-02-11 19:55:19 +0100
commite768c40e1122c4a8ef8785aef6a07044f6e869e1 (patch)
tree2ffb1b70a6ee9d64a132fc960733035683c5a0ea /plugins/rtp/src
parentdbc6d87cb9c26a5858ccf7400a43cdd4f6f26971 (diff)
downloaddino-e768c40e1122c4a8ef8785aef6a07044f6e869e1.tar.gz
dino-e768c40e1122c4a8ef8785aef6a07044f6e869e1.zip
RTP: Make codec and hardware support compile-time configurable
Diffstat (limited to 'plugins/rtp/src')
-rw-r--r--plugins/rtp/src/codec_util.vala61
-rw-r--r--plugins/rtp/src/device.vala1
-rw-r--r--plugins/rtp/src/module.vala24
-rw-r--r--plugins/rtp/src/stream.vala1
4 files changed, 64 insertions, 23 deletions
diff --git a/plugins/rtp/src/codec_util.vala b/plugins/rtp/src/codec_util.vala
index 443baa7e..ac8c7f98 100644
--- a/plugins/rtp/src/codec_util.vala
+++ b/plugins/rtp/src/codec_util.vala
@@ -97,11 +97,35 @@ public class Dino.Plugins.Rtp.CodecUtil {
} else if (media == "video") {
switch (codec) {
case "h264":
- return new string[] {/*"msdkh264enc", */"vaapih264enc", "x264enc"};
+ return new string[] {
+#if ENABLE_MSDK
+ "msdkh264enc",
+#endif
+#if ENABLE_VAAPI
+ "vaapih264enc",
+#endif
+ "x264enc"
+ };
case "vp9":
- return new string[] {/*"msdkvp9enc", */"vaapivp9enc", "vp9enc"};
+ return new string[] {
+#if ENABLE_MSDK
+ "msdkvp9enc",
+#endif
+#if ENABLE_VAAPI
+ "vaapivp9enc",
+#endif
+ "vp9enc"
+ };
case "vp8":
- return new string[] {/*"msdkvp8enc", */"vaapivp8enc", "vp8enc"};
+ return new string[] {
+#if ENABLE_MSDK
+ "msdkvp8enc",
+#endif
+#if ENABLE_VAAPI
+ "vaapivp8enc",
+#endif
+ "vp8enc"
+ };
}
}
return new string[0];
@@ -125,11 +149,35 @@ public class Dino.Plugins.Rtp.CodecUtil {
} else if (media == "video") {
switch (codec) {
case "h264":
- return new string[] {/*"msdkh264dec", */"vaapih264dec"};
+ return new string[] {
+#if ENABLE_MSDK
+ "msdkh264dec",
+#endif
+#if ENABLE_VAAPI
+ "vaapih264dec",
+#endif
+ null
+ };
case "vp9":
- return new string[] {/*"msdkvp9dec", */"vaapivp9dec", "vp9dec"};
+ return new string[] {
+#if ENABLE_MSDK
+ "msdkvp9dec",
+#endif
+#if ENABLE_VAAPI
+ "vaapivp9dec",
+#endif
+ "vp9dec"
+ };
case "vp8":
- return new string[] {/*"msdkvp8dec", */"vaapivp8dec", "vp8dec"};
+ return new string[] {
+#if ENABLE_MSDK
+ "msdkvp8dec",
+#endif
+#if ENABLE_VAAPI
+ "vaapivp8dec",
+#endif
+ "vp8dec"
+ };
}
}
return new string[0];
@@ -268,7 +316,6 @@ public class Dino.Plugins.Rtp.CodecUtil {
}
public string? get_decode_element_name(string media, string? codec) {
- if (codec == "vp9") return null; // Temporary unsupport VP9
if (get_depay_element_name(media, codec) == null) return null;
foreach (string candidate in get_decode_candidates(media, codec)) {
if (is_element_supported(candidate)) return candidate;
diff --git a/plugins/rtp/src/device.vala b/plugins/rtp/src/device.vala
index e97a0d04..aca97578 100644
--- a/plugins/rtp/src/device.vala
+++ b/plugins/rtp/src/device.vala
@@ -438,7 +438,6 @@ public class Dino.Plugins.Rtp.Device : MediaDevice, Object {
if (is_sink && media == "audio") {
mixer = (Gst.Base.Aggregator) Gst.ElementFactory.make("audiomixer", @"mixer_$id");
pipe.add(mixer);
- mixer.link(pipe);
if (plugin.echoprobe != null && !plugin.echoprobe.get_static_pad("src").is_linked()) {
mixer.link(plugin.echoprobe);
plugin.echoprobe.link(element);
diff --git a/plugins/rtp/src/module.vala b/plugins/rtp/src/module.vala
index ca1a6a5b..be153b10 100644
--- a/plugins/rtp/src/module.vala
+++ b/plugins/rtp/src/module.vala
@@ -147,19 +147,23 @@ public class Dino.Plugins.Rtp.Module : JingleRtp.Module {
yield add_if_supported(list, media, pcmu);
yield add_if_supported(list, media, pcma);
} else if (media == "video") {
- var h264 = new JingleRtp.PayloadType() { clockrate = 90000, name = "H264", id = 96 };
- var vp9 = new JingleRtp.PayloadType() { clockrate = 90000, name = "VP9", id = 97 };
- var vp8 = new JingleRtp.PayloadType() { clockrate = 90000, name = "VP8", id = 98 };
var rtcp_fbs = new ArrayList<JingleRtp.RtcpFeedback>();
rtcp_fbs.add(new JingleRtp.RtcpFeedback("goog-remb"));
rtcp_fbs.add(new JingleRtp.RtcpFeedback("ccm", "fir"));
rtcp_fbs.add(new JingleRtp.RtcpFeedback("nack"));
rtcp_fbs.add(new JingleRtp.RtcpFeedback("nack", "pli"));
+#if ENABLE_H264
+ var h264 = new JingleRtp.PayloadType() { clockrate = 90000, name = "H264", id = 96 };
+ yield add_if_supported(list, media, h264);
h264.rtcp_fbs.add_all(rtcp_fbs);
+#endif
+#if ENABLE_VP9
+ var vp9 = new JingleRtp.PayloadType() { clockrate = 90000, name = "VP9", id = 97 };
vp9.rtcp_fbs.add_all(rtcp_fbs);
- vp8.rtcp_fbs.add_all(rtcp_fbs);
- yield add_if_supported(list, media, h264);
yield add_if_supported(list, media, vp9);
+#endif
+ var vp8 = new JingleRtp.PayloadType() { clockrate = 90000, name = "VP8", id = 98 };
+ vp8.rtcp_fbs.add_all(rtcp_fbs);
yield add_if_supported(list, media, vp8);
} else {
warning("Unsupported media type: %s", media);
@@ -168,15 +172,7 @@ public class Dino.Plugins.Rtp.Module : JingleRtp.Module {
}
public override async JingleRtp.PayloadType? pick_payload_type(string media, Gee.List<JingleRtp.PayloadType> payloads) {
- if (media == "audio") {
- foreach (JingleRtp.PayloadType type in payloads) {
- if (yield is_payload_supported(media, type)) return adjust_payload_type(media, type.clone());
- }
- } else if (media == "video") {
- // We prefer H.264 (best support for hardware acceleration and good overall codec quality)
- JingleRtp.PayloadType? h264 = payloads.first_match((it) => it.name.up() == "H264");
- if (h264 != null && yield is_payload_supported(media, h264)) return adjust_payload_type(media, h264.clone());
- // Take first of the list that we do support otherwise
+ if (media == "audio" || media == "video") {
foreach (JingleRtp.PayloadType type in payloads) {
if (yield is_payload_supported(media, type)) return adjust_payload_type(media, type.clone());
}
diff --git a/plugins/rtp/src/stream.vala b/plugins/rtp/src/stream.vala
index 25a1ed2c..ef9ffe96 100644
--- a/plugins/rtp/src/stream.vala
+++ b/plugins/rtp/src/stream.vala
@@ -505,7 +505,6 @@ public class Dino.Plugins.Rtp.Stream : Xmpp.Xep.JingleRtp.Stream {
buffer_seq = rtp_buffer.get_seq();
rtp_buffer.unmap();
}
- debug("Received RTP %s buffer seq %u with SSRC %u", media, buffer_seq, buffer_ssrc);
}
#endif
if (push_recv_data) {