Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kim-dong-hyun opened this issue Feb 7, 2024 · 1 comment
Open

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

kim-dong-hyun opened this issue Feb 7, 2024 · 1 comment

Comments

@kim-dong-hyun
Copy link

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
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants