From: Wim Taymans Date: Mon, 12 Nov 2012 16:06:42 +0000 (+0100) Subject: stream-transport: add method to handle RTP/RTCP X-Git-Tag: 1.19.3~495^2~1296 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=75473fc88d3e3a479890956c010eb03feb31ae8d;p=platform%2Fupstream%2Fgstreamer.git stream-transport: add method to handle RTP/RTCP Call new methods instead of poking into the structures directly. --- diff --git a/gst/rtsp-server/rtsp-stream-transport.c b/gst/rtsp-server/rtsp-stream-transport.c index 3db5c39..3d97db6 100644 --- a/gst/rtsp-server/rtsp-stream-transport.c +++ b/gst/rtsp-server/rtsp-stream-transport.c @@ -170,3 +170,49 @@ gst_rtsp_stream_transport_set_transport (GstRTSPStreamTransport * trans, gst_rtsp_transport_free (trans->transport); trans->transport = tr; } + +/** + * gst_rtsp_stream_transport_send_rtp: + * @trans: a #GstRTSPStreamTransport + * @buffer: a #GstBuffer + * + * Send @buffer to the installed RTP callback for @trans. + * + * Returns: %TRUE on success + */ +gboolean +gst_rtsp_stream_transport_send_rtp (GstRTSPStreamTransport * trans, + GstBuffer * buffer) +{ + gboolean res = FALSE; + + if (trans->send_rtp) + res = + trans->send_rtp (buffer, trans->transport->interleaved.min, + trans->user_data); + + return res; +} + +/** + * gst_rtsp_stream_transport_send_rtcp: + * @trans: a #GstRTSPStreamTransport + * @buffer: a #GstBuffer + * + * Send @buffer to the installed RTCP callback for @trans. + * + * Returns: %TRUE on success + */ +gboolean +gst_rtsp_stream_transport_send_rtcp (GstRTSPStreamTransport * trans, + GstBuffer * buffer) +{ + gboolean res = FALSE; + + if (trans->send_rtcp) + res = + trans->send_rtcp (buffer, trans->transport->interleaved.max, + trans->user_data); + + return res; +} diff --git a/gst/rtsp-server/rtsp-stream-transport.h b/gst/rtsp-server/rtsp-stream-transport.h index cbc8255..f478805 100644 --- a/gst/rtsp-server/rtsp-stream-transport.h +++ b/gst/rtsp-server/rtsp-stream-transport.h @@ -105,6 +105,11 @@ void gst_rtsp_stream_transport_set_keepalive (GstRTSPStreamT gpointer user_data, GDestroyNotify notify); +gboolean gst_rtsp_stream_transport_send_rtp (GstRTSPStreamTransport *trans, + GstBuffer *buffer); +gboolean gst_rtsp_stream_transport_send_rtcp (GstRTSPStreamTransport *trans, + GstBuffer *buffer); + G_END_DECLS #endif /* __GST_RTSP_STREAM_TRANSPORT_H__ */ diff --git a/gst/rtsp-server/rtsp-stream.c b/gst/rtsp-server/rtsp-stream.c index be262d1..f9aba19 100644 --- a/gst/rtsp-server/rtsp-stream.c +++ b/gst/rtsp-server/rtsp-stream.c @@ -524,11 +524,9 @@ handle_new_sample (GstAppSink * sink, gpointer user_data) GstRTSPStreamTransport *tr = (GstRTSPStreamTransport *) walk->data; if (GST_ELEMENT_CAST (sink) == stream->appsink[0]) { - if (tr->send_rtp) - tr->send_rtp (buffer, tr->transport->interleaved.min, tr->user_data); + gst_rtsp_stream_transport_send_rtp (tr, buffer); } else { - if (tr->send_rtcp) - tr->send_rtcp (buffer, tr->transport->interleaved.max, tr->user_data); + gst_rtsp_stream_transport_send_rtcp (tr, buffer); } } gst_sample_unref (sample);