Update dcall
This commit is contained in:
parent
eb684c824a
commit
2f6fe41778
1 changed files with 27 additions and 4 deletions
31
src/dcall.c
31
src/dcall.c
|
@ -9,6 +9,7 @@ struct dcall_elements {
|
|||
GstElement *rx_tap, *rx_jitterbuffer, *rx_depay, *rx_opusdec, *rx_resample, *rx_echocancel, *rx_sink;
|
||||
GstElement *tx_tap, *tx_echocancel, *tx_queue, *tx_resample, *tx_opusenc, *tx_pay, *tx_sink;
|
||||
char* remote_host;
|
||||
guint bus_watch_id;
|
||||
};
|
||||
|
||||
int create_rx_chain(struct dcall_elements* de) {
|
||||
|
@ -32,6 +33,7 @@ int create_rx_chain(struct dcall_elements* de) {
|
|||
g_object_set(G_OBJECT (de->rx_jitterbuffer), "do-lost", TRUE, NULL);
|
||||
g_object_set(G_OBJECT (de->rx_jitterbuffer), "do-retransmission", FALSE, NULL);
|
||||
g_object_set(G_OBJECT (de->rx_jitterbuffer), "latency", 50, NULL);
|
||||
g_object_set(G_OBJECT (de->rx_jitterbuffer), "drop-on-latency", TRUE, NULL);
|
||||
|
||||
g_object_set(G_OBJECT (de->rx_opusdec), "plc", TRUE, NULL);
|
||||
g_object_set(G_OBJECT (de->rx_opusdec), "use-inband-fec", FALSE, NULL);
|
||||
|
@ -115,6 +117,27 @@ static GstPadProbeReturn jitter_buffer_sink_event(GstPad *pad, GstPadProbeInfo *
|
|||
return GST_PAD_PROBE_OK;
|
||||
}
|
||||
|
||||
void register_pad(struct dcall_elements *de) {
|
||||
GstPad *pad;
|
||||
pad = gst_element_get_static_pad (de->rx_jitterbuffer, "sink");
|
||||
|
||||
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, jitter_buffer_sink_event, &de, NULL);
|
||||
//gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_)
|
||||
}
|
||||
|
||||
static gboolean pipeline_bus_handler (GstBus *bus, GstMessage *message, gpointer data) {
|
||||
g_print ("Got %s message\n", GST_MESSAGE_TYPE_NAME (message));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void register_bus(struct dcall_elements *de) {
|
||||
GstBus *bus;
|
||||
bus = gst_pipeline_get_bus (GST_PIPELINE (de->pipeline));
|
||||
de->bus_watch_id = gst_bus_add_watch (bus, pipeline_bus_handler, de);
|
||||
gst_object_unref(bus);
|
||||
}
|
||||
|
||||
gboolean stop_handler(gpointer user_data) {
|
||||
GMainLoop *loop = user_data;
|
||||
g_main_loop_quit(loop);
|
||||
|
@ -144,11 +167,10 @@ int main(int argc, char *argv[]) {
|
|||
if (create_rx_chain (&de) != 0) return -1;
|
||||
if (create_tx_chain (&de) != 0) return -1;
|
||||
|
||||
gst_element_set_state (de.pipeline, GST_STATE_PLAYING);
|
||||
register_pad(&de);
|
||||
register_bus(&de);
|
||||
|
||||
GstPad *pad;
|
||||
pad = gst_element_get_static_pad (de.rx_jitterbuffer, "sink");
|
||||
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, jitter_buffer_sink_event, &de, NULL);
|
||||
gst_element_set_state (de.pipeline, GST_STATE_PLAYING);
|
||||
|
||||
g_unix_signal_add (SIGTERM, stop_handler, loop);
|
||||
g_unix_signal_add (SIGINT, stop_handler, loop);
|
||||
|
@ -171,6 +193,7 @@ int main(int argc, char *argv[]) {
|
|||
gst_element_set_state (de.pipeline, GST_STATE_NULL);
|
||||
|
||||
gst_object_unref (GST_OBJECT (de.pipeline));
|
||||
g_source_remove (de.bus_watch_id);
|
||||
g_main_loop_unref (loop);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue