Fix dcall
This commit is contained in:
parent
62e8cca370
commit
7cb4b3bed0
1 changed files with 21 additions and 7 deletions
28
src/dcall.c
28
src/dcall.c
|
@ -11,6 +11,7 @@ struct dcall_elements {
|
|||
GstElement *tx_tap, *tx_echocancel, *tx_queue, *tx_resample, *tx_opusenc, *tx_pay, *tx_sink;
|
||||
char* remote_host;
|
||||
guint bus_watch_id;
|
||||
guint16 prev_seqnum;
|
||||
};
|
||||
|
||||
int create_rx_chain(struct dcall_elements* de) {
|
||||
|
@ -141,6 +142,7 @@ static gboolean foreach_buffer (GstBuffer *inbuf, GstMeta **meta, gpointer user_
|
|||
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
|
||||
struct dcall_elements *de = user_data;
|
||||
guint16 seqnum;
|
||||
GstBuffer *out = NULL, *rtp_extracted = NULL;
|
||||
GstRTPBuffer rtp_buffer = {0};
|
||||
|
@ -151,7 +153,15 @@ static GstPadProbeReturn jitter_buffer_sink_buffer(GstPad *pad, GstPadProbeInfo
|
|||
|
||||
if (G_UNLIKELY (!gst_rtp_buffer_map (out, GST_MAP_READ, &rtp_buffer))) return GST_PAD_PROBE_OK;
|
||||
seqnum = gst_rtp_buffer_get_seq (&rtp_buffer);
|
||||
g_print("Receiving packet %d\n", seqnum);
|
||||
|
||||
if (de->prev_seqnum == 0) de->prev_seqnum = seqnum;
|
||||
else if (de->prev_seqnum + 1 == seqnum) de->prev_seqnum = seqnum;
|
||||
else {
|
||||
g_print("Current seqnum = %d, previous seqnum = %d, gap\n", seqnum, de->prev_seqnum);
|
||||
de->prev_seqnum = seqnum;
|
||||
}
|
||||
|
||||
//g_print("Receiving packet %d\n", seqnum);
|
||||
|
||||
rtp_extracted = gst_rtp_buffer_get_payload_buffer (&rtp_buffer);
|
||||
|
||||
|
@ -162,12 +172,13 @@ static GstPadProbeReturn jitter_buffer_sink_buffer(GstPad *pad, GstPadProbeInfo
|
|||
}
|
||||
|
||||
void register_pad(struct dcall_elements *de) {
|
||||
GstPad *pad;
|
||||
pad = gst_element_get_static_pad (de->rx_jitterbuffer, "src");
|
||||
GstPad *pad_src, *pad_sink;
|
||||
pad_src = gst_element_get_static_pad (de->rx_jitterbuffer, "src");
|
||||
pad_sink = gst_element_get_static_pad (de->rx_jitterbuffer, "sink");
|
||||
|
||||
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);
|
||||
gst_pad_add_probe (pad_src, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, jitter_buffer_sink_event_down, &de, NULL);
|
||||
//gst_pad_add_probe (pad_src, GST_PAD_PROBE_TYPE_EVENT_UPSTREAM, jitter_buffer_sink_event_up, &de, NULL);
|
||||
gst_pad_add_probe (pad_sink, GST_PAD_PROBE_TYPE_BUFFER, jitter_buffer_sink_buffer, &de, NULL);
|
||||
}
|
||||
|
||||
static gboolean pipeline_bus_handler (GstBus *bus, GstMessage *message, gpointer data) {
|
||||
|
@ -195,13 +206,16 @@ gboolean stop_handler(gpointer user_data) {
|
|||
|
||||
int main(int argc, char *argv[]) {
|
||||
GMainLoop *loop;
|
||||
struct dcall_elements de;
|
||||
struct dcall_elements de = {
|
||||
.prev_seqnum = 0
|
||||
};
|
||||
|
||||
/* Check input arguments */
|
||||
if (argc != 2) {
|
||||
g_printerr ("Usage: %s <Remote host>\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
de.remote_host = argv[1];
|
||||
|
||||
gst_init (&argc, &argv);
|
||||
|
|
Loading…
Reference in a new issue