summaryrefslogtreecommitdiff
path: root/ext/srtp
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2013-04-04 17:59:01 -0400
committerOlivier CrĂȘte <olivier.crete@collabora.com>2013-11-19 18:34:08 -0500
commit8c76d7c77e2f4fc8172d19f4fbda78fca3def1aa (patch)
tree0b83c0b96b33fd3303587882b189f8f893ddc659 /ext/srtp
parent898966a44c0da6d2430470f093341dd902138d52 (diff)
downloadgstreamer-plugins-bad-8c76d7c77e2f4fc8172d19f4fbda78fca3def1aa.tar.gz
srtp: Implement SRTCP demultiplexing
Separate multiplexed RTP and RTCP if they arrive on the rtp_sink pad.
Diffstat (limited to 'ext/srtp')
-rw-r--r--ext/srtp/gstsrtpdec.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/ext/srtp/gstsrtpdec.c b/ext/srtp/gstsrtpdec.c
index 80ed582a0..5885452b0 100644
--- a/ext/srtp/gstsrtpdec.c
+++ b/ext/srtp/gstsrtpdec.c
@@ -511,26 +511,34 @@ init_session_stream (GstSrtpDec * filter, guint32 ssrc,
*/
static GstSrtpDecSsrcStream *
validate_buffer (GstSrtpDec * filter, GstBuffer * buf, guint32 * ssrc,
- gboolean is_rtcp)
+ gboolean * is_rtcp)
{
GstSrtpDecSsrcStream *stream = NULL;
- if (!is_rtcp) {
+ if (!(*is_rtcp)) {
GstRTPBuffer rtpbuf = GST_RTP_BUFFER_INIT;
- if (!gst_rtp_buffer_map (buf, GST_MAP_READ, &rtpbuf)) {
- GST_WARNING_OBJECT (filter, "Invalid SRTP packet");
- return NULL;
- }
+ if (gst_rtp_buffer_map (buf, GST_MAP_READ, &rtpbuf)) {
+ if (gst_rtp_buffer_get_payload_type (&rtpbuf) < 64
+ || gst_rtp_buffer_get_payload_type (&rtpbuf) > 80) {
+ *ssrc = gst_rtp_buffer_get_ssrc (&rtpbuf);
- *ssrc = gst_rtp_buffer_get_ssrc (&rtpbuf);
+ gst_rtp_buffer_unmap (&rtpbuf);
+ goto have_ssrc;
+ }
+ gst_rtp_buffer_unmap (&rtpbuf);
+ }
+ }
- gst_rtp_buffer_unmap (&rtpbuf);
- } else if (!rtcp_buffer_get_ssrc (buf, ssrc)) {
+ if (rtcp_buffer_get_ssrc (buf, ssrc)) {
+ *is_rtcp = TRUE;
+ } else {
GST_WARNING_OBJECT (filter, "No SSRC found in buffer");
return NULL;
}
+have_ssrc:
+
stream = find_stream_by_ssrc (filter, *ssrc);
if (stream)
@@ -851,7 +859,7 @@ gst_srtp_dec_chain (GstPad * pad, GstObject * parent, GstBuffer * buf,
/* Check if this stream exists, if not create a new stream */
- if (!(stream = validate_buffer (filter, buf, &ssrc, is_rtcp))) {
+ if (!(stream = validate_buffer (filter, buf, &ssrc, &is_rtcp))) {
GST_OBJECT_UNLOCK (filter);
GST_WARNING_OBJECT (filter, "Invalid buffer, dropping");
goto drop_buffer;
@@ -931,10 +939,12 @@ unprotect:
push_out:
/* Push buffer to source pad */
- otherpad = (GstPad *) gst_pad_get_element_private (pad);
+ if (is_rtcp)
+ otherpad = filter->rtcp_srcpad;
+ else
+ otherpad = filter->rtp_srcpad;
ret = gst_pad_push (otherpad, buf);
-
return ret;
drop_buffer: