Skip to content

protocol/chunk: reset chunk encoder state on stream end - #4

Open
urlynn wants to merge 1 commit into
torresjeff:mainfrom
urlynn:fix/protocol-bugs
Open

protocol/chunk: reset chunk encoder state on stream end#4
urlynn wants to merge 1 commit into
torresjeff:mainfrom
urlynn:fix/protocol-bugs

Conversation

@urlynn

@urlynn urlynn commented Aug 6, 2026

Copy link
Copy Markdown

The server's per-connection chunk encoder keeps its per-chunk-stream timestamp/format state across sessions. When a publisher disconnects and reconnects on the same downstream connection, the new session's first timestamp (0) is encoded as a delta against the stale high timestamp -> timestamp regression. Reference implementations bind encoder state to the session (ffmpeg rtmp_close frees prev_pkt, SRS builds a fresh SrsProtocol per connection).

Add ChunkEncoder::reset() (clears per-stream state, keeps chunk size) and call it from handle_stream_ended.

The server's per-connection chunk encoder keeps its per-chunk-stream
timestamp/format state across sessions. When a publisher disconnects and
reconnects on the same downstream connection, the new session's first
timestamp (0) is encoded as a delta against the stale high timestamp ->
timestamp regression. Reference implementations bind encoder state to the
session (ffmpeg rtmp_close frees prev_pkt, SRS builds a fresh SrsProtocol
per connection).

Add ChunkEncoder::reset() (clears per-stream state, keeps chunk size) and
call it from handle_stream_ended.
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

Successfully merging this pull request may close these issues.

1 participant