Use pulseadio with echo cancel
This commit is contained in:
parent
b514ce64ab
commit
dcf24faf90
1 changed files with 14 additions and 4 deletions
18
src/dcall.c
18
src/dcall.c
|
@ -21,7 +21,7 @@ int create_rx_chain(struct dcall_elements* de) {
|
|||
de->rx_opusdec = gst_element_factory_make("opusdec", "rx-opusdec");
|
||||
de->rx_resample = gst_element_factory_make("audioresample", "rx-audioresample");
|
||||
de->rx_echocancel = gst_element_factory_make("webrtcechoprobe", "rx-echocancel");
|
||||
de->rx_sink = gst_element_factory_make("autoaudiosink", "rx-sink");
|
||||
de->rx_sink = gst_element_factory_make("pulsesink", "rx-sink");
|
||||
|
||||
if (!de->rx_tap || !de->rx_jitterbuffer || !de->rx_depay || !de->rx_opusdec || !de->rx_resample || !de->rx_echocancel || !de->rx_sink) {
|
||||
g_printerr ("One element of the rx chain could not be created. Exiting.\n");
|
||||
|
@ -41,6 +41,11 @@ int create_rx_chain(struct dcall_elements* de) {
|
|||
g_object_set(G_OBJECT (de->rx_opusdec), "plc", TRUE, NULL);
|
||||
g_object_set(G_OBJECT (de->rx_opusdec), "use-inband-fec", FALSE, NULL);
|
||||
|
||||
GstStructure *props;
|
||||
props = gst_structure_from_string ("props,filter.want=echo-cancel", NULL);
|
||||
g_object_set (de->rx_sink, "stream-properties", props, NULL);
|
||||
gst_structure_free (props);
|
||||
|
||||
gst_bin_add_many (GST_BIN (de->pipeline), de->rx_tap, de->rx_jitterbuffer, de->rx_depay, de->rx_opusdec, de->rx_resample, de->rx_echocancel, de->rx_sink, NULL);
|
||||
gst_element_link_many (de->rx_tap, de->rx_jitterbuffer, de->rx_depay, de->rx_opusdec, de->rx_resample, de->rx_echocancel, de->rx_sink, NULL);
|
||||
|
||||
|
@ -48,10 +53,10 @@ int create_rx_chain(struct dcall_elements* de) {
|
|||
}
|
||||
|
||||
int create_tx_chain(struct dcall_elements* de) {
|
||||
de->tx_tap = gst_element_factory_make("autoaudiosrc", "tx-tap");
|
||||
de->tx_tap = gst_element_factory_make("pulsesrc", "tx-tap");
|
||||
de->tx_resample = gst_element_factory_make("audioresample", "tx-resample");
|
||||
de->tx_echocancel = gst_element_factory_make("webrtcdsp", "tx-echocancel");
|
||||
de->tx_queue = gst_element_factory_make("queue", "tx-queue");
|
||||
de->tx_resample = gst_element_factory_make("audioresample", "tx-resample");
|
||||
de->tx_opusenc = gst_element_factory_make("opusenc", "tx-opusenc");
|
||||
de->tx_pay = gst_element_factory_make("rtpopuspay", "tx-rtpopuspay");
|
||||
de->tx_sink = gst_element_factory_make("udpsink", "tx-sink");
|
||||
|
@ -80,8 +85,13 @@ int create_tx_chain(struct dcall_elements* de) {
|
|||
g_object_set(G_OBJECT(de->tx_echocancel), "probe", "rx-echocancel", NULL);
|
||||
g_object_set(G_OBJECT(de->tx_echocancel), "voice-detection", FALSE, NULL);
|
||||
|
||||
GstStructure *props;
|
||||
props = gst_structure_from_string ("props,filter.want=echo-cancel", NULL);
|
||||
g_object_set (de->tx_tap, "stream-properties", props, NULL);
|
||||
gst_structure_free (props);
|
||||
|
||||
gst_bin_add_many(GST_BIN(de->pipeline), de->tx_tap, de->tx_echocancel, de->tx_queue, de->tx_resample, de->tx_opusenc, de->tx_pay, de->tx_sink, NULL);
|
||||
gst_element_link_many(de->tx_tap, de->tx_echocancel, de->tx_queue, de->tx_resample, de->tx_opusenc, de->tx_pay, de->tx_sink, NULL);
|
||||
gst_element_link_many(de->tx_resample, de->tx_tap, de->tx_echocancel, de->tx_queue, de->tx_opusenc, de->tx_pay, de->tx_sink, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue