1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2025-01-06 11:35:32 +00:00

sip: media: improve SDP offer/answer handling

This commit is contained in:
Evangelos Ribeiro Tzaras 2021-03-08 09:54:08 +01:00
parent 97a925ee39
commit dcff7538f2
3 changed files with 19 additions and 14 deletions

View file

@ -99,15 +99,20 @@ calls_sip_media_manager_static_capabilities (CallsSipMediaManager *self,
guint port,
gboolean use_srtp)
{
char *attribute_line = "rtpmap:0 PCMU/8000";
char *payload_type = use_srtp ? "SAVP" : "AVP";
g_autofree char *media_line = NULL;
g_autofree char *attribute_line = NULL;
MediaCodecInfo *codec;
g_return_val_if_fail (CALLS_IS_SIP_MEDIA_MANAGER (self), NULL);
media_line = g_strdup_printf ("audio %d RTP/%s 0", port, payload_type);
codec = get_best_codec (self);
/* TODO support multiplice codecs: f.e. audio 31337 RTP/AVP 9 8 0 96 */
media_line = g_strdup_printf ("audio %d RTP/%s %s",
port, payload_type, codec->payload_id);
attribute_line = g_strdup_printf ("rtpmap:%s %s/%s",
codec->payload_id, codec->name, codec->clock_rate);
/* TODO we can have multiple attribute lines (or media lines for that matter) */
/* TODO add attribute describing RTCP stream */
return g_strdup_printf ("v=0\r\n"
"m=%s\r\n"

View file

@ -28,11 +28,11 @@
/* TODO check available codecs during runtime */
static MediaCodecInfo gst_codecs[] = {
{0, "PCMU", 8000, 1, "rtppcmupay", "rtppcmudepay", "mulawenc", "mulawdec"},
{3, "GSM", 8000, 1, "rtpgsmpay", "rtpgsmdepay", "gsmenc", "gsmdec"},
{4, "G723", 8000, 1, "rtpg723pay", "rtpg723depay", "avenc_g723_1", "avdec_g723_1"}, // does not seem to work
{8, "PCMA", 8000, 1, "rtppcmapay", "rtppcmadepay", "alawenc", "alawdec"},
{9, "G722", 8000, 1, "rtpg722pay", "rtpg722depay", "avenc_g722", "avdec_g722"},
{"0", "PCMU", "8000", 1, "rtppcmupay", "rtppcmudepay", "mulawenc", "mulawdec"},
{"3", "GSM", "8000", 1, "rtpgsmpay", "rtpgsmdepay", "gsmenc", "gsmdec"},
{"4", "G723", "8000", 1, "rtpg723pay", "rtpg723depay", "avenc_g723_1", "avdec_g723_1"}, // does not seem to work
{"8", "PCMA", "8000", 1, "rtppcmapay", "rtppcmadepay", "alawenc", "alawdec"},
{"9", "G722", "8000", 1, "rtpg722pay", "rtpg722depay", "avenc_g722", "avdec_g722"},
};
@ -53,9 +53,9 @@ media_codec_by_name (const char *name)
gchar *
media_codec_get_gst_capabilities (MediaCodecInfo *codec)
{
return g_strdup_printf ("application/x-rtp,media=(string)audio,clock-rate=(int)%d"
",encoding-name=(string)%s,payload=(int)%d",
return g_strdup_printf ("application/x-rtp,media=(string)audio,clock-rate=(int)%s"
",encoding-name=(string)%s,payload=(int)%s",
codec->clock_rate,
codec->name,
codec->payload_type);
codec->payload_id);
}

View file

@ -32,9 +32,9 @@
*/
typedef struct {
gint payload_type;
gchar* name;
gint clock_rate;
char *payload_id;
char *name;
char *clock_rate;
gint channels;
char *gst_payloader_name;
char *gst_depayloader_name;