rtcpbuffer: improve bye parsing

It is an error to ask for a non-existing BYE SSRC, the caller should
check the SSRC count first.
This commit is contained in:
Wim Taymans 2013-08-26 11:46:11 +02:00
parent 3c66c2a43d
commit b848f38215

View file

@ -1423,17 +1423,12 @@ gst_rtcp_packet_bye_get_nth_ssrc (GstRTCPPacket * packet, guint nth)
guint8 *data; guint8 *data;
guint offset; guint offset;
guint32 ssrc; guint32 ssrc;
guint8 sc;
g_return_val_if_fail (packet != NULL, 0); g_return_val_if_fail (packet != NULL, 0);
g_return_val_if_fail (packet->type == GST_RTCP_TYPE_BYE, 0); g_return_val_if_fail (packet->type == GST_RTCP_TYPE_BYE, 0);
g_return_val_if_fail (packet->rtcp != NULL, 0); g_return_val_if_fail (packet->rtcp != NULL, 0);
g_return_val_if_fail (packet->rtcp->map.flags & GST_MAP_READ, 0); g_return_val_if_fail (packet->rtcp->map.flags & GST_MAP_READ, 0);
g_return_val_if_fail (nth < packet->count, 0);
/* get amount of sources and check that we don't read too much */
sc = packet->count;
if (nth >= sc)
return 0;
/* get offset in 32-bits words into packet, skip the header */ /* get offset in 32-bits words into packet, skip the header */
offset = 1 + nth; offset = 1 + nth;