davidfischer-ch / pytoolbox

Toolbox for Python scripts.
Other
41 stars 15 forks source link

pytoolbox.network.smpte2022.base : 496 #35

Closed yvvarun closed 5 years ago

yvvarun commented 5 years ago

shouldn't the check in base.py for packet.sequence (line 496) be: if packet.sequence != (fec.snbase + ifec.offset) % (RtpPacket.S_MASK + 1) instead of if packet.sequence != (fec.snbase + ifec.offset) % RtpPacket.S_MASK ?

the latter check fails when the packet sequence number is 65535

davidfischer-ch commented 5 years ago

Please can you elaborate?

Thank you.

yvvarun commented 5 years ago

the condition "if packet.sequence != (fec.snbase + ifec.offset) % RtpPacket.S_MASK" fails when packet.sequence is 65535. But 65535 is a valid sequence number.

TobbeEdgeware commented 5 years ago

The issue is that it is a mask that is applied so one should do a bitwise and "&" and not a modulo operation "%".

The line should read:

 if packet.sequence != (fec.snbase + i*fec.offset) & RtpPacket.S_MASK: 

This was the next problem I found after fixing #36.

TobbeEdgeware commented 5 years ago

The same issue (modulo operator instead of and) appears twice in generator.py on line 220 and 229