mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-06 11:35:32 +00:00
sip: media-pipeline: Allow overriding audio elements from environment
This is useful for tests where "pulsesrc" and "pulsesink" GstElements may not be available (for example in CI). Additionally only set the echo cancellation and buffer properties for the pulse GstElements.
This commit is contained in:
parent
b5de8f3b8a
commit
2ee6b23475
1 changed files with 33 additions and 21 deletions
|
@ -364,10 +364,40 @@ initable_init (GInitable *initable,
|
|||
g_autofree char *caps_string = NULL;
|
||||
GstPad *srcpad, *sinkpad;
|
||||
GstStructure *props = NULL;
|
||||
const char *env_var;
|
||||
|
||||
env_var = g_getenv ("CALLS_AUDIOSINK");
|
||||
if (env_var) {
|
||||
self->audiosink = gst_element_factory_make (env_var, "sink");
|
||||
} else {
|
||||
/* could also use autoaudiosink instead of pulsesink */
|
||||
self->audiosink = gst_element_factory_make ("pulsesink", "sink");
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
env_var = g_getenv ("CALLS_AUDIOSRC");
|
||||
if (env_var)
|
||||
self->audiosrc = gst_element_factory_make (env_var, "source");
|
||||
else
|
||||
self->audiosrc = gst_element_factory_make ("pulsesrc", "source");
|
||||
|
||||
/* could also use autoaudiosink instead of pulsesink */
|
||||
self->audiosink = gst_element_factory_make ("pulsesink", "sink");
|
||||
self->audiosrc = gst_element_factory_make ("pulsesrc", "source");
|
||||
if (!self->audiosrc || !self->audiosink) {
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"Could not create audiosink or audiosrc");
|
||||
|
@ -461,24 +491,6 @@ 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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue