diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2015-03-19 11:54:12 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2015-03-19 11:54:37 +0100 |
commit | 1018aacb355c156b9da27d3af144c6d0acc5d1cd (patch) | |
tree | 8a6c2927cd111fcf64d1e2cd114616850bb8fa27 /gst | |
parent | 57ff27f8c8cd3c306fe32efac338e4f11e1b01e1 (diff) |
rtprtxsend: Add support for buffer lists
Diffstat (limited to 'gst')
-rw-r--r-- | gst/rtpmanager/gstrtprtxsend.c | 50 |
1 files changed, 41 insertions, 9 deletions
diff --git a/gst/rtpmanager/gstrtprtxsend.c b/gst/rtpmanager/gstrtprtxsend.c index 922fad3b2..9d2ce0a96 100644 --- a/gst/rtpmanager/gstrtprtxsend.c +++ b/gst/rtpmanager/gstrtprtxsend.c @@ -86,6 +86,8 @@ static gboolean gst_rtp_rtx_send_sink_event (GstPad * pad, GstObject * parent, GstEvent * event); static GstFlowReturn gst_rtp_rtx_send_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer); +static GstFlowReturn gst_rtp_rtx_send_chain_list (GstPad * pad, + GstObject * parent, GstBufferList * list); static void gst_rtp_rtx_send_src_loop (GstRtpRtxSend * rtx); static gboolean gst_rtp_rtx_send_activate_mode (GstPad * pad, @@ -258,6 +260,8 @@ gst_rtp_rtx_send_init (GstRtpRtxSend * rtx) GST_DEBUG_FUNCPTR (gst_rtp_rtx_send_sink_event)); gst_pad_set_chain_function (rtx->sinkpad, GST_DEBUG_FUNCPTR (gst_rtp_rtx_send_chain)); + gst_pad_set_chain_list_function (rtx->sinkpad, + GST_DEBUG_FUNCPTR (gst_rtp_rtx_send_chain_list)); gst_element_add_pad (GST_ELEMENT (rtx), rtx->sinkpad); rtx->queue = gst_data_queue_new (gst_rtp_rtx_send_queue_check_full, NULL, @@ -640,11 +644,10 @@ gst_rtp_rtx_send_get_ts_diff (SSRCRtxData * data) return (guint32) gst_util_uint64_scale_int (result, 1000, data->clock_rate); } -static GstFlowReturn -gst_rtp_rtx_send_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) +/* Must be called with lock */ +static void +process_buffer (GstRtpRtxSend * rtx, GstBuffer * buffer) { - GstRtpRtxSend *rtx = GST_RTP_RTX_SEND (parent); - GstFlowReturn ret = GST_FLOW_ERROR; GstRTPBuffer rtp = GST_RTP_BUFFER_INIT; BufferQueueItem *item; SSRCRtxData *data; @@ -660,7 +663,9 @@ gst_rtp_rtx_send_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) rtptime = gst_rtp_buffer_get_timestamp (&rtp); gst_rtp_buffer_unmap (&rtp); - GST_OBJECT_LOCK (rtx); + GST_LOG_OBJECT (rtx, + "Processing buffer seqnum: %" G_GUINT16_FORMAT ", ssrc: %" + G_GUINT32_FORMAT, seqnum, ssrc); /* do not store the buffer if it's payload type is unknown */ if (g_hash_table_contains (rtx->rtx_pt_map, GUINT_TO_POINTER (payload_type))) { @@ -683,14 +688,41 @@ gst_rtp_rtx_send_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) g_sequence_remove (g_sequence_get_begin_iter (data->queue)); } } +} +static GstFlowReturn +gst_rtp_rtx_send_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) +{ + GstRtpRtxSend *rtx = GST_RTP_RTX_SEND (parent); + GstFlowReturn ret; + + GST_OBJECT_LOCK (rtx); + process_buffer (rtx, buffer); GST_OBJECT_UNLOCK (rtx); + ret = gst_pad_push (rtx->srcpad, buffer); - GST_LOG_OBJECT (rtx, - "push seqnum: %" G_GUINT16_FORMAT ", ssrc: %" G_GUINT32_FORMAT, seqnum, - ssrc); + return ret; +} - ret = gst_pad_push (rtx->srcpad, buffer); +static gboolean +process_buffer_from_list (GstBuffer ** buffer, guint idx, gpointer user_data) +{ + process_buffer (user_data, *buffer); + return TRUE; +} + +static GstFlowReturn +gst_rtp_rtx_send_chain_list (GstPad * pad, GstObject * parent, + GstBufferList * list) +{ + GstRtpRtxSend *rtx = GST_RTP_RTX_SEND (parent); + GstFlowReturn ret; + + GST_OBJECT_LOCK (rtx); + gst_buffer_list_foreach (list, process_buffer_from_list, rtx); + GST_OBJECT_UNLOCK (rtx); + + ret = gst_pad_push_list (rtx->srcpad, list); return ret; } |