From 157dc1fffb66707c23e413f01819159a2b7e176a Mon Sep 17 00:00:00 2001 From: Evangelos Ribeiro Tzaras Date: Wed, 7 Apr 2021 23:53:34 +0200 Subject: [PATCH] sip: media: use number types for payload id and clock rate This is needed for the next commits where we check the received SDP offers/answers. --- plugins/sip/calls-sip-media-manager.c | 4 ++-- plugins/sip/gst-rfc3551.c | 14 +++++++------- plugins/sip/gst-rfc3551.h | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/plugins/sip/calls-sip-media-manager.c b/plugins/sip/calls-sip-media-manager.c index d8c3cb5..b3ad183 100644 --- a/plugins/sip/calls-sip-media-manager.c +++ b/plugins/sip/calls-sip-media-manager.c @@ -121,9 +121,9 @@ calls_sip_media_manager_static_capabilities (CallsSipMediaManager *self, for (node = self->supported_codecs; node != NULL; node = node->next) { MediaCodecInfo *codec = node->data; - g_string_append_printf (media_line, " %s", codec->payload_id); + g_string_append_printf (media_line, " %u", codec->payload_id); g_string_append_printf (attribute_lines, - "a=rtpmap:%s %s/%s%s", + "a=rtpmap:%u %s/%u%s", codec->payload_id, codec->name, codec->clock_rate, diff --git a/plugins/sip/gst-rfc3551.c b/plugins/sip/gst-rfc3551.c index 80b20bb..780873a 100644 --- a/plugins/sip/gst-rfc3551.c +++ b/plugins/sip/gst-rfc3551.c @@ -28,11 +28,11 @@ /* Use the following codecs in order of preference */ static MediaCodecInfo gst_codecs[] = { - {"8", "PCMA", "8000", 1, "rtppcmapay", "rtppcmadepay", "alawenc", "alawdec"}, - {"0", "PCMU", "8000", 1, "rtppcmupay", "rtppcmudepay", "mulawenc", "mulawdec"}, - {"3", "GSM", "8000", 1, "rtpgsmpay", "rtpgsmdepay", "gsmenc", "gsmdec"}, - {"9", "G722", "8000", 1, "rtpg722pay", "rtpg722depay", "avenc_g722", "avdec_g722"}, - {"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"}, + {0, "PCMU", 8000, 1, "rtppcmupay", "rtppcmudepay", "mulawenc", "mulawdec"}, + {3, "GSM", 8000, 1, "rtpgsmpay", "rtpgsmdepay", "gsmenc", "gsmdec"}, + {9, "G722", 8000, 1, "rtpg722pay", "rtpg722depay", "avenc_g722", "avdec_g722"}, + {4, "G723", 8000, 1, "rtpg723pay", "rtpg723depay", "avenc_g723_1", "avdec_g723_1"}, // does not seem to work }; @@ -58,8 +58,8 @@ 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)%s" - ",encoding-name=(string)%s,payload=(int)%s", + return g_strdup_printf ("application/x-rtp,media=(string)audio,clock-rate=(int)%u" + ",encoding-name=(string)%s,payload=(int)%u", codec->clock_rate, codec->name, codec->payload_id); diff --git a/plugins/sip/gst-rfc3551.h b/plugins/sip/gst-rfc3551.h index eca0c03..4ecde6c 100644 --- a/plugins/sip/gst-rfc3551.h +++ b/plugins/sip/gst-rfc3551.h @@ -32,9 +32,9 @@ */ typedef struct { - char *payload_id; + guint payload_id; char *name; - char *clock_rate; + gint clock_rate; gint channels; char *gst_payloader_name; char *gst_depayloader_name;