From 19e7f8f1198490645e5607a0da8ae7e5d7b73710 Mon Sep 17 00:00:00 2001 From: Evangelos Ribeiro Tzaras Date: Mon, 15 Mar 2021 16:36:05 +0100 Subject: [PATCH] sip-media: enable echo cancellation by setting "filter.want" to "echo-cancel" for the pulsesink and pulsesrc GStElement's. --- plugins/sip/calls-sip-media-pipeline.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/plugins/sip/calls-sip-media-pipeline.c b/plugins/sip/calls-sip-media-pipeline.c index 0b11d12..1edba91 100644 --- a/plugins/sip/calls-sip-media-pipeline.c +++ b/plugins/sip/calls-sip-media-pipeline.c @@ -326,6 +326,7 @@ initable_init (GInitable *initable, GstCaps *caps; g_autofree char *caps_string = NULL; GstPad *srcpad, *sinkpad; + GstStructure *props = NULL; /* could also use autoaudiosink instead of pulsesink */ self->audiosink = gst_element_factory_make ("pulsesink", "sink"); @@ -423,6 +424,24 @@ initable_init (GInitable *initable, return FALSE; } + /* enable echo cancellation and set buffer size to 40ms */ + props = gst_structure_new ("props", + "media.role", G_TYPE_STRING, "phone", + "filter.want", G_TYPE_STRING, "echo-cancel", + NULL); + + g_object_set (self->audiosink, + "buffer-time", (gint64) 40000, + "stream-properties", props, + NULL); + + g_object_set (self->audiosrc, + "buffer-time", (gint64) 40000, + "stream-properties", props, + NULL); + + gst_structure_free (props); + gst_bin_add (GST_BIN (self->send_pipeline), self->send_rtpbin); gst_bin_add (GST_BIN (self->recv_pipeline), self->recv_rtpbin);