From dd4df554d5c2d4a61d09e7ec7ab5844d126474a9 Mon Sep 17 00:00:00 2001 From: Alessandro Decina Date: Wed, 25 Nov 2015 14:51:40 +1100 Subject: [PATCH] rtpmanager: rtpsession: don't send empty RTCP packets generate_rtcp can produce empty packets when reduced size RTCP is turned on. Skip them since it doesn't make sense to push them and they cause errors with elements that expect RTCP packets to contain data (like srtpenc). --- gst/rtpmanager/rtpsession.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/gst/rtpmanager/rtpsession.c b/gst/rtpmanager/rtpsession.c index 8865c0d436..b006a3eae6 100644 --- a/gst/rtpmanager/rtpsession.c +++ b/gst/rtpmanager/rtpsession.c @@ -4026,7 +4026,7 @@ done: /* push out the RTCP packets */ while ((output = g_queue_pop_head (&data.output))) { - gboolean do_not_suppress; + gboolean do_not_suppress, empty_buffer; GstBuffer *buffer = output->buffer; RTPSource *source = output->source; @@ -4034,7 +4034,10 @@ done: g_signal_emit (sess, rtp_session_signals[SIGNAL_ON_SENDING_RTCP], 0, buffer, data.is_early, &do_not_suppress); - if (sess->callbacks.send_rtcp && (do_not_suppress || !data.may_suppress)) { + empty_buffer = gst_buffer_get_size (buffer) == 0; + + if (sess->callbacks.send_rtcp && + !empty_buffer && (do_not_suppress || !data.may_suppress)) { guint packet_size; packet_size = gst_buffer_get_size (buffer) + sess->header_len; @@ -4052,9 +4055,11 @@ done: RTP_SESSION_UNLOCK (sess); } else { GST_DEBUG ("freeing packet callback: %p" + " empty_buffer: %d, " " do_not_suppress: %d may_suppress: %d", sess->callbacks.send_rtcp, - do_not_suppress, data.may_suppress); - sess->stats.nacks_dropped += data.nacked_seqnums; + empty_buffer, do_not_suppress, data.may_suppress); + if (!empty_buffer) + sess->stats.nacks_dropped += data.nacked_seqnums; gst_buffer_unref (buffer); } g_object_unref (source);