1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2025-01-08 04:45:31 +00:00

sip: media: Allow specifying SRTP for GStreamer capabilities

When using SRTP the GstCaps must be set accordingly.
This commit is contained in:
Evangelos Ribeiro Tzaras 2022-04-07 11:42:18 +02:00
parent 7ac862155b
commit 58f9f5cb62
3 changed files with 8 additions and 4 deletions

View file

@ -656,7 +656,7 @@ pipeline_setup_codecs (CallsSipMediaPipeline *self,
} }
/* UDP src capabilities */ /* UDP src capabilities */
caps_string = media_codec_get_gst_capabilities (codec); caps_string = media_codec_get_gst_capabilities (codec, FALSE);
g_debug ("Capabilities:\n%s", caps_string); g_debug ("Capabilities:\n%s", caps_string);
caps = gst_caps_from_string (caps_string); caps = gst_caps_from_string (caps_string);

View file

@ -106,15 +106,18 @@ media_codec_by_payload_id (guint payload_id)
/* media_codec_get_gst_capabilities: /* media_codec_get_gst_capabilities:
* *
* @codec: A #MediaCodecInfo * @codec: A #MediaCodecInfo
* @use_srtp: Whether to use SRTP
* *
* Returns: (transfer full): The capability string describing GstCaps. * Returns: (transfer full): The capability string describing GstCaps.
* Used for the RTP source element. * Used for the RTP source element.
*/ */
gchar * gchar *
media_codec_get_gst_capabilities (MediaCodecInfo *codec) media_codec_get_gst_capabilities (MediaCodecInfo *codec,
gboolean use_srtp)
{ {
return g_strdup_printf ("application/x-rtp,media=(string)audio,clock-rate=(int)%u" return g_strdup_printf ("application/%s,media=(string)audio,clock-rate=(int)%u"
",encoding-name=(string)%s,payload=(int)%u", ",encoding-name=(string)%s,payload=(int)%u",
use_srtp ? "x-srtp" : "x-rtp",
codec->clock_rate, codec->clock_rate,
codec->name, codec->name,
codec->payload_id); codec->payload_id);

View file

@ -47,5 +47,6 @@ typedef struct {
gboolean media_codec_available_in_gst (MediaCodecInfo *codec); gboolean media_codec_available_in_gst (MediaCodecInfo *codec);
MediaCodecInfo *media_codec_by_name (const char *name); MediaCodecInfo *media_codec_by_name (const char *name);
MediaCodecInfo *media_codec_by_payload_id (uint payload_id); MediaCodecInfo *media_codec_by_payload_id (uint payload_id);
gchar *media_codec_get_gst_capabilities (MediaCodecInfo *codec); gchar *media_codec_get_gst_capabilities (MediaCodecInfo *codec,
gboolean use_srtp);
GList *media_codecs_get_candidates (void); GList *media_codecs_get_candidates (void);