davidfischer-ch/pytoolbox

pytoolbox.network.smpte2022.base : 618 ( computeJ)

Closed this issue · 3 comments

Dear David,

I think the way you're managing the sequence number rollover is not correct.
One proposal is:
if delta < 0:
delta = RtpPacket.S_MASK + delta + 1

Kind regards,
Nolwenn

Dear Nolwenn,

Can you explain me the use case please?

And also if you can make a pull request including an explanation and a test, it would be great!

Thanks.

David Fischer

Dear Nolwenn,

Can you explain me the use case please?

And also if you can make a pull request including an explanation and a test, it would be great!

Thanks.

David Fischer

The suggested change seems to be correct. The code for delta < 0 seems to be there to handle a wrap-around in the 16-bit sequence number. For negative values, one should add 2**16 to get a positive value. However, RtpPacket.S_MASK == 2**16 - 1, so there is a +1 missing.