Try a new way to detect dropped messages

This commit is contained in:
Quentin 2020-01-28 17:27:33 +01:00
parent 2f6fe41778
commit 2c8b1d9f46

View file

@ -34,6 +34,7 @@ int create_rx_chain(struct dcall_elements* de) {
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_jitterbuffer), "post-drop-messages", 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);
@ -87,7 +88,7 @@ static GstPadProbeReturn jitter_buffer_sink_event(GstPad *pad, GstPadProbeInfo *
struct dcall_elements *de = user_data;
GstEvent *event = NULL;
g_print("Entering rtpjitterbuffer sink pad handler...\n");
g_print("Entering rtpjitterbuffer sink pad handler for events...\n");
event = gst_pad_probe_info_get_event (info);
if (event == NULL) return GST_PAD_PROBE_OK;
@ -117,17 +118,32 @@ static GstPadProbeReturn jitter_buffer_sink_event(GstPad *pad, GstPadProbeInfo *
return GST_PAD_PROBE_OK;
}
static GstPadProbeReturn jitter_buffer_sink_buffer(GstPad *pad, GstPadProbeInfo *info, gpointer user_data) {
//g_print("Entering rtpjitterbuffer sink pad handler for buffers...\n");
GstBuffer *buffer = NULL;
buffer = gst_pad_probe_info_get_buffer (info);
if (buffer == NULL) return GST_PAD_PROBE_OK;
if (gst_buffer_get_size (buffer) != 172) g_print("buffer size is %ld\n", gst_buffer_get_size (buffer));
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_)
//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_BUFFER, jitter_buffer_sink_buffer, &de, NULL);
}
static gboolean pipeline_bus_handler (GstBus *bus, GstMessage *message, gpointer data) {
g_print ("Got %s message\n", GST_MESSAGE_TYPE_NAME (message));
const GstStructure *struc = NULL;
struc = gst_message_get_structure(message);
g_print("structure is: %s \n", gst_structure_to_string (struc));
return TRUE;
}
@ -168,7 +184,7 @@ int main(int argc, char *argv[]) {
if (create_tx_chain (&de) != 0) return -1;
register_pad(&de);
register_bus(&de);
//register_bus(&de);
gst_element_set_state (de.pipeline, GST_STATE_PLAYING);
@ -193,7 +209,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_source_remove (de.bus_watch_id);
g_main_loop_unref (loop);
return 0;