Closed piranna closed 8 months ago
65536 casted to unsigned 2^16 is 0.
No, we don't want to validate given numbers in TS later. User should be clever enough to know what uint16 means.
65536 casted to unsigned 2^16 is 0.
I suspected that was the culprit, thanks to confirm. Then based on the docs and the comment at https://github.com/versatica/mediasoup/blame/e226f2f9dfcb3124d6a472b051353f75b3959290/node/src/test/test-DataConsumer.ts#L114-L115, shouldn't it be ignored instead of casted / truncated / mod 2**16? Or that's what you mean by "No, we don't want to validate given numbers in TS later. User should be clever enough to know what uint16 means."?
It means that if user passes a wrong uint16 number it is internally truncated without checking it.
It means that if user passes a wrong uint16 number it is internally truncated without checking it.
So if it's bigger than 65535, it will be bounded to 65535, isn't it? Or will it be modulo 65536?
Modulo. 35536 becomes 0 as in the test.
Great, thanks to confirm :-)
https://github.com/versatica/mediasoup/blame/e226f2f9dfcb3124d6a472b051353f75b3959290/node/src/test/test-DataConsumer.ts#L157-L167
Where does that
0
came from? I've reviewed the other tests and the source code and can't identify it... DoesDataConsumer
s have a subchannel0
by default? Or is it a bug, maybe from the filtering of65536
subchannel?