rgaufman / live555

A mirror of the live555 source code.
GNU Lesser General Public License v3.0
745 stars 366 forks source link

Boolean seqNumLT(u_int16_t s1, u_int16_t s2) bug? #49

Open kim-dong-hyun opened 7 months ago

kim-dong-hyun commented 7 months ago

The seqNumLT function source is as follows:

Boolean seqNumLT(u_int16_t s1, u_int16_t s2) { // a 'less-than' on 16-bit sequence numbers int diff = s2 - s1; if (diff > 0) { return (diff < 0x8000); } else if (diff < 0) { return (diff < -0x8000); } else { // diff == 0 return False; } }

The line return (diff < -0x8000); is intended to determine if s1 has rolled over when s1 is greater than s2. When the diff value is smaller, it does not necessarily imply a 'less-than' condition but rather a rollover situation. Therefore, it seems correct to modify this line to return (diff >= -0x8000); to accurately reflect the condition being checked.

muminglan commented 1 month ago

Hi bro! I think you're wrong,, you not get what's the function of seqNumLT, it just judges if s1 is less than s2, if s2 is next expected Seq in RTP packet, the value is 2, but s1 is a real RTP packet maybe the value is 0xffff - 0x0003(maybe previous packet reached),the diff between s2 and s1 is less than -0x8000, so we need to ignore it!!! (your best friend from CHINA Hope it is useful for you)