RTP: Add support for G.722

This commit is contained in:
Marvin W 2022-02-05 23:56:55 +01:00
parent 51dc414631
commit bfd089516a
No known key found for this signature in database
GPG key ID: 072E9235DB996F2A
2 changed files with 11 additions and 5 deletions

View file

@ -91,6 +91,8 @@ public class Dino.Plugins.Rtp.CodecUtil {
return new string[] {"alawenc"}; return new string[] {"alawenc"};
case "pcmu": case "pcmu":
return new string[] {"mulawenc"}; return new string[] {"mulawenc"};
case "g722":
return new string[] {"avenc_g722"};
} }
} else if (media == "video") { } else if (media == "video") {
switch (codec) { switch (codec) {
@ -117,6 +119,8 @@ public class Dino.Plugins.Rtp.CodecUtil {
return new string[] {"alawdec"}; return new string[] {"alawdec"};
case "pcmu": case "pcmu":
return new string[] {"mulawdec"}; return new string[] {"mulawdec"};
case "g722":
return new string[] {"avdec_g722"};
} }
} else if (media == "video") { } else if (media == "video") {
switch (codec) { switch (codec) {

View file

@ -131,17 +131,19 @@ public class Dino.Plugins.Rtp.Module : JingleRtp.Module {
public override async Gee.List<JingleRtp.PayloadType> get_supported_payloads(string media) { public override async Gee.List<JingleRtp.PayloadType> get_supported_payloads(string media) {
Gee.List<JingleRtp.PayloadType> list = new ArrayList<JingleRtp.PayloadType>(JingleRtp.PayloadType.equals_func); Gee.List<JingleRtp.PayloadType> list = new ArrayList<JingleRtp.PayloadType>(JingleRtp.PayloadType.equals_func);
if (media == "audio") { if (media == "audio") {
var opus = new JingleRtp.PayloadType() { channels = 1, clockrate = 48000, name = "opus", id = 99 }; var opus = new JingleRtp.PayloadType() { channels = 1, clockrate = 48000, name = "opus", id = 111 };
opus.parameters["useinbandfec"] = "1"; opus.parameters["useinbandfec"] = "1";
var speex32 = new JingleRtp.PayloadType() { channels = 1, clockrate = 32000, name = "speex", id = 100 }; var speex32 = new JingleRtp.PayloadType() { channels = 1, clockrate = 32000, name = "speex", id = 112 };
var speex16 = new JingleRtp.PayloadType() { channels = 1, clockrate = 16000, name = "speex", id = 101 }; var speex16 = new JingleRtp.PayloadType() { channels = 1, clockrate = 16000, name = "speex", id = 113 };
var speex8 = new JingleRtp.PayloadType() { channels = 1, clockrate = 8000, name = "speex", id = 102 }; var speex8 = new JingleRtp.PayloadType() { channels = 1, clockrate = 8000, name = "speex", id = 114 };
var g722 = new JingleRtp.PayloadType() { channels = 1, clockrate = 8000, name = "G722", id = 9 };
var pcmu = new JingleRtp.PayloadType() { channels = 1, clockrate = 8000, name = "PCMU", id = 0 }; var pcmu = new JingleRtp.PayloadType() { channels = 1, clockrate = 8000, name = "PCMU", id = 0 };
var pcma = new JingleRtp.PayloadType() { channels = 1, clockrate = 8000, name = "PCMA", id = 8 }; var pcma = new JingleRtp.PayloadType() { channels = 1, clockrate = 8000, name = "PCMA", id = 8 };
yield add_if_supported(list, media, opus); yield add_if_supported(list, media, opus);
yield add_if_supported(list, media, speex32); yield add_if_supported(list, media, speex32);
yield add_if_supported(list, media, speex16); yield add_if_supported(list, media, speex16);
yield add_if_supported(list, media, speex8); yield add_if_supported(list, media, speex8);
yield add_if_supported(list, media, g722);
yield add_if_supported(list, media, pcmu); yield add_if_supported(list, media, pcmu);
yield add_if_supported(list, media, pcma); yield add_if_supported(list, media, pcma);
} else if (media == "video") { } else if (media == "video") {
@ -234,4 +236,4 @@ public class Dino.Plugins.Rtp.Module : JingleRtp.Module {
Crypto.randomize(key_and_salt); Crypto.randomize(key_and_salt);
return remote.rekey(key_and_salt); return remote.rekey(key_and_salt);
} }
} }