aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2021-11-09 22:06:47 +0100
committerfiaxh <git@lightrise.org>2021-11-10 11:05:34 +0100
commit083f73b0ca1f1a10b5773942841c0f9e3cc78f27 (patch)
treeed2bb7340ead829107dd13c8115a827fbf5a9ce0
parent72569ea52faf9895b4a897feffd37fa7fe3e2116 (diff)
downloaddino-083f73b0ca1f1a10b5773942841c0f9e3cc78f27.tar.gz
dino-083f73b0ca1f1a10b5773942841c0f9e3cc78f27.zip
Split payloader off encoder chain
-rw-r--r--plugins/rtp/src/codec_util.vala43
1 files changed, 39 insertions, 4 deletions
diff --git a/plugins/rtp/src/codec_util.vala b/plugins/rtp/src/codec_util.vala
index 8299fc51..4c68985f 100644
--- a/plugins/rtp/src/codec_util.vala
+++ b/plugins/rtp/src/codec_util.vala
@@ -273,7 +273,7 @@ public class Dino.Plugins.Rtp.CodecUtil {
string decode_suffix = get_decode_suffix(media, codec, decode, payload_type) ?? "";
string depay_args = get_depay_args(media, codec, decode, payload_type) ?? "";
string resample = media == "audio" ? @" ! audioresample name=$(base_name)_resample" : "";
- return @"$depay$depay_args name=$(base_name)_rtp_depay ! $decode_prefix$decode$decode_args name=$(base_name)_$(codec)_decode$decode_suffix ! $(media)convert name=$(base_name)_convert$resample";
+ return @"queue ! $depay$depay_args name=$(base_name)_rtp_depay ! $decode_prefix$decode$decode_args name=$(base_name)_$(codec)_decode$decode_suffix ! $(media)convert name=$(base_name)_convert$resample";
}
public Gst.Element? get_decode_bin(string media, JingleRtp.PayloadType payload_type, string? name = null) {
@@ -288,16 +288,29 @@ public class Dino.Plugins.Rtp.CodecUtil {
}
public string? get_encode_bin_description(string media, string? codec, JingleRtp.PayloadType? payload_type, string? element_name = null, string? name = null) {
+ string? desc1 = get_encode_bin_without_payloader_description(media, codec, payload_type, element_name, name);
+ string? desc2 = get_payloader_bin_description(media, codec, payload_type, name);
+ return @"$desc1 ! $desc2";
+ }
+
+ public string? get_payloader_bin_description(string media, string? codec, JingleRtp.PayloadType? payload_type, string? name = null) {
if (codec == null) return null;
string base_name = name ?? @"encode_$(codec)_$(Random.next_int())";
string? pay = get_pay_element_name(media, codec);
+ if (pay == null) return null;
+ return @"$pay pt=$(payload_type != null ? payload_type.id : 96) name=$(base_name)_rtp_pay";
+ }
+
+ public string? get_encode_bin_without_payloader_description(string media, string? codec, JingleRtp.PayloadType? payload_type, string? element_name = null, string? name = null) {
+ if (codec == null) return null;
+ string base_name = name ?? @"encode_$(codec)_$(Random.next_int())";
string? encode = element_name ?? get_encode_element_name(media, codec);
- if (pay == null || encode == null) return null;
+ if (encode == null) return null;
string encode_prefix = get_encode_prefix(media, codec, encode, payload_type) ?? "";
string encode_args = get_encode_args(media, codec, encode, payload_type) ?? "";
string encode_suffix = get_encode_suffix(media, codec, encode, payload_type) ?? "";
string resample = media == "audio" ? @" ! audioresample name=$(base_name)_resample" : "";
- return @"$(media)convert name=$(base_name)_convert$resample ! $encode_prefix$encode$encode_args name=$(base_name)_encode$encode_suffix ! $pay pt=$(payload_type != null ? payload_type.id : 96) name=$(base_name)_rtp_pay";
+ return @"$(media)convert name=$(base_name)_convert$resample ! queue ! $encode_prefix$encode$encode_args name=$(base_name)_encode$encode_suffix";
}
public Gst.Element? get_encode_bin(string media, JingleRtp.PayloadType payload_type, string? name = null) {
@@ -311,4 +324,26 @@ public class Dino.Plugins.Rtp.CodecUtil {
return bin;
}
-} \ No newline at end of file
+ public Gst.Element? get_encode_bin_without_payloader(string media, JingleRtp.PayloadType payload_type, string? name = null) {
+ string? codec = get_codec_from_payload(media, payload_type);
+ string base_name = name ?? @"encode_$(codec)_$(Random.next_int())";
+ string? desc = get_encode_bin_without_payloader_description(media, codec, payload_type, null, base_name);
+ if (desc == null) return null;
+ debug("Pipeline to encode %s %s without payloader: %s", media, codec, desc);
+ Gst.Element bin = Gst.parse_bin_from_description(desc, true);
+ bin.name = name;
+ return bin;
+ }
+
+ public Gst.Element? get_payloader_bin(string media, JingleRtp.PayloadType payload_type, string? name = null) {
+ string? codec = get_codec_from_payload(media, payload_type);
+ string base_name = name ?? @"encode_$(codec)_$(Random.next_int())";
+ string? desc = get_payloader_bin_description(media, codec, payload_type, base_name);
+ if (desc == null) return null;
+ debug("Pipeline to payload %s %s: %s", media, codec, desc);
+ Gst.Element bin = Gst.parse_bin_from_description(desc, true);
+ bin.name = name;
+ return bin;
+ }
+
+}