[gstreamer-bugs] [Bug 533075] New: gst_rtp_buffer_compare_seqnum doesn't do what it says

GStreamer (bugzilla.gnome.org) bugzilla-daemon at bugzilla.gnome.org
Wed May 14 01:51:16 PDT 2008


If you have any questions why you received this email, please see the text at
the end of this email. Replies to this email are NOT read, please see the text
at the end of this email. You can add comments to this bug at:
  http://bugzilla.gnome.org/show_bug.cgi?id=533075

  GStreamer | gst-plugins-base | Ver: HEAD CVS
           Summary: gst_rtp_buffer_compare_seqnum doesn't do what it says
           Product: GStreamer
           Version: HEAD CVS
          Platform: Other
        OS/Version: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: gst-plugins-base
        AssignedTo: gstreamer-bugs at lists.sourceforge.net
        ReportedBy: b-gnome at largestprime.net
         QAContact: gstreamer-bugs at lists.sourceforge.net
     GNOME version: Unspecified
   GNOME milestone: Unspecified


A recent comment change for gst_rtp_buffer_compare_seqnum says that it will
return the difference in sequence numbers. In its current implementation, it
does not. e.g. gst_rtp_buffer_compare_seqnum(0xFFFF, 0) returns 65535, not -1
as desired.

A much easier approach is to cast the difference into a signed gint16, then
into an gint (the function's return type), then the compiler and OS takes care
of the wraparound and sign extension for you. e.g.

gint
gst_rtp_buffer_compare_seqnum (guint16 seqnum1, guint16 seqnum2)
{
  return (gint16)(seqnum2-seqnum1);
}

This survives this simple test below (apologies for not making it an
attachment), where as the original function (revision 1.22 of gstrtpbuffer.c)
does not.

void test()
{
  int i, diff;
  uint16 a, b;
  for (diff = -100; diff < 100; diff++) {
    a = 0;
    for (i = 0; i < 0x20000; i++) {
      b = a + diff;
      assert(gst_rtp_buffer_compare_seqnum(a, b) == diff);
      a++;
    }
  }
}


-- 
See http://bugzilla.gnome.org/page.cgi?id=email.html for more info about why you received
this email, why you can't respond via email, how to stop receiving
emails (or reduce the number you receive), and how to contact someone
if you are having problems with the system.

You can add comments to this bug at http://bugzilla.gnome.org/show_bug.cgi?id=533075.




More information about the Gstreamer-bugs mailing list