summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2018-01-26 16:33:21 +0200
committerSebastian Dröge <sebastian@centricular.com>2018-01-26 16:33:21 +0200
commit05954153e75457799853991cf260942dc0fe1f7a (patch)
tree408c69b1b90d4b80dcaccc07fb0d96d723dc71d2
parent2124522033525c9c54812a3b650a325f3cd59bf6 (diff)
rtspsrc: Implement ONVIF backchannel support via TCPonvif-backchannel
-rw-r--r--gst/rtsp/gstrtspsrc.c45
1 files changed, 42 insertions, 3 deletions
diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c
index e424f4702..646251045 100644
--- a/gst/rtsp/gstrtspsrc.c
+++ b/gst/rtsp/gstrtspsrc.c
@@ -2851,9 +2851,48 @@ gst_rtspsrc_push_backchannel_buffer (GstRTSPSrc * src, guint id,
goto out;
}
- g_signal_emit_by_name (stream->rtpsrc, "push-sample", sample, &res);
- GST_DEBUG_OBJECT (src, "sent backchannel RTP sample %p: %s", sample,
- gst_flow_get_name (res));
+ if (src->interleaved) {
+ GstBuffer *buffer;
+ GstMapInfo map;
+ guint8 *data;
+ guint size;
+ GstRTSPResult ret;
+ GstRTSPMessage message = { 0 };
+ GstRTSPConnInfo *conninfo;
+
+ buffer = gst_sample_get_buffer (sample);
+
+ gst_buffer_map (buffer, &map, GST_MAP_READ);
+ size = map.size;
+ data = map.data;
+
+ gst_rtsp_message_init_data (&message, stream->channel[0]);
+
+ /* lend the body data to the message */
+ gst_rtsp_message_take_body (&message, data, size);
+
+ if (stream->conninfo.connection)
+ conninfo = &stream->conninfo;
+ else
+ conninfo = &src->conninfo;
+
+ GST_DEBUG_OBJECT (src, "sending %u bytes backchannel RTP", size);
+ ret = gst_rtspsrc_connection_send (src, conninfo, &message, NULL);
+ GST_DEBUG_OBJECT (src, "sent backchannel RTP, %d", ret);
+
+ /* and steal it away again because we will free it when unreffing the
+ * buffer */
+ gst_rtsp_message_steal_body (&message, &data, &size);
+ gst_rtsp_message_unset (&message);
+
+ gst_buffer_unmap (buffer, &map);
+
+ res = GST_FLOW_OK;
+ } else {
+ g_signal_emit_by_name (stream->rtpsrc, "push-sample", sample, &res);
+ GST_DEBUG_OBJECT (src, "sent backchannel RTP sample %p: %s", sample,
+ gst_flow_get_name (res));
+ }
out:
gst_sample_unref (sample);