illuspas / Node-Media-Server

A Node.js implementation of RTMP/HTTP-FLV/WS-FLV/HLS/DASH/MP4 Media Server
https://www.npmjs.com/package/node-media-server
MIT License
5.89k stars 1.51k forks source link

Acked sequence number wrong(?) after wrap around #629

Open eerimoq opened 4 months ago

eerimoq commented 4 months ago

Hi!

My RTMP client uses the acknowledged sequence number in the Acknowledgement control message to keep track of how much data that is in flight. It works well when streaming to Twitch and Youtube, but when streaming to this server it does not. The acked sequence number wraps at i32-max or u32-max in those services, and the next acked sequence number is the rest (modulus). In this server it wraps at 0xf0000000, and the next acked sequence number is always 0. So seems impossibly to kow exactly how much data is acked.

https://github.com/illuspas/Node-Media-Server/blob/master/src/node_rtmp_session.js#L498-L506

I can't find anything about this in the RTMP specification unfortunately.

Looks like GStreamer expects it to wrap at u32-max. https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/main/subprojects/gst-plugins-bad/gst/rtmp2/rtmp/rtmpconnection.c?ref_type=heads#L973

eerimoq commented 3 months ago

Any comments on this?