rtcpbuffer: test for len instead of type
authorJosep Torra <jtorra@oblong.com>
Thu, 21 Mar 2019 16:50:34 +0000 (17:50 +0100)
committerJosep Torra <jtorra@oblong.com>
Thu, 21 Mar 2019 18:27:28 +0000 (19:27 +0100)
The function rtcp_packet_min_length() returns a length for each known type
and -1 for unknown types. This change fixes the test accordingly and silences
the following warning.

gstrtcpbuffer.c:567:12: error: comparison of constant -1 with expression of type 'GstRTCPType' is always false
      [-Werror,-Wtautological-constant-out-of-range-compare]
  if (type == -1)

gst-libs/gst/rtp/gstrtcpbuffer.c

index b21650d..885c8f5 100644 (file)
@@ -505,7 +505,7 @@ gst_rtcp_packet_move_to_next (GstRTCPPacket * packet)
   g_return_val_if_fail (packet->rtcp != NULL, FALSE);
   g_return_val_if_fail (packet->rtcp->map.flags & GST_MAP_READ, FALSE);
 
-  /* if we have a padding or invalid packet, it must be the last, 
+  /* if we have a padding or invalid packet, it must be the last,
    * return FALSE */
   if (packet->type == GST_RTCP_TYPE_INVALID || packet->padding)
     goto end;
@@ -564,7 +564,7 @@ gst_rtcp_buffer_add_packet (GstRTCPBuffer * rtcp, GstRTCPType type,
    * start a compount packet. Next we figure out if we have enough free space in
    * the buffer to continue. */
   len = rtcp_packet_min_length (type);
-  if (type == -1)
+  if (len == -1)
     goto unknown_type;
   if (packet->offset + len >= maxsize)
     goto no_space;