From 29cf2a85b486e75dfba18bd9b996b752091f5323 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Wed, 29 Jan 2020 09:42:13 +0100 Subject: [PATCH] Log events again... --- CMakeLists.txt | 1 - src/dcall.c | 32 ++++++++++++++++++++++++++------ 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4fa495e..62b9612 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,6 @@ add_executable(torecho ${CSOURCES} src/tor_echo.c) add_executable(capdiff ${CSOURCES} src/capdiff.c) add_executable(capreplay ${CSOURCES} src/capreplay.c) add_executable(donar_unit_test ${CSOURCES} src/test.c) - add_executable(dcall src/dcall.c) find_package(PkgConfig REQUIRED) diff --git a/src/dcall.c b/src/dcall.c index 84a9cde..9767262 100644 --- a/src/dcall.c +++ b/src/dcall.c @@ -119,9 +119,28 @@ static GstPadProbeReturn jitter_buffer_sink_event(GstPad *pad, GstPadProbeInfo * return GST_PAD_PROBE_OK; } +static GstPadProbeReturn jitter_buffer_sink_event_up(GstPad *pad, GstPadProbeInfo *info, gpointer user_data) { + g_print("upstream event: begin\n"); + jitter_buffer_sink_event (pad, info, user_data); + g_print("upstream event: end\n"); + return GST_PAD_PROBE_OK; +} + +static GstPadProbeReturn jitter_buffer_sink_event_down(GstPad *pad, GstPadProbeInfo *info, gpointer user_data) { + g_print("downstream event: begin\n"); + jitter_buffer_sink_event (pad, info, user_data); + g_print("downstream event: end\n"); + return GST_PAD_PROBE_OK; +} + +static gboolean foreach_buffer (GstBuffer *inbuf, GstMeta **meta, gpointer user_data) { + //@FIXME Dead code, please remove me + return TRUE; +} + static GstPadProbeReturn jitter_buffer_sink_buffer(GstPad *pad, GstPadProbeInfo *info, gpointer user_data) { //g_print("Entering rtpjitterbuffer sink pad handler for buffers...\n"); - + //@FIXME Dead code, please remove me guint16 seqnum; GstBuffer *out = NULL, *rtp_extracted = NULL; GstRTPBuffer rtp_buffer = {0}; @@ -134,20 +153,21 @@ static GstPadProbeReturn jitter_buffer_sink_buffer(GstPad *pad, GstPadProbeInfo seqnum = gst_rtp_buffer_get_seq (&rtp_buffer); g_print("Receiving packet %d\n", seqnum); - gst_rtp_buffer_unmap (&rtp_buffer); - rtp_extracted = gst_rtp_buffer_get_payload_buffer (&rtp_buffer); + gst_buffer_foreach_meta (rtp_extracted, foreach_buffer, NULL); + gst_rtp_buffer_unmap (&rtp_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"); + pad = gst_element_get_static_pad (de->rx_jitterbuffer, "src"); - //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); + gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, jitter_buffer_sink_event_down, &de, NULL); + gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_EVENT_UPSTREAM, jitter_buffer_sink_event_up, &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) {