Skip to content

Conversation

@dmorn
Copy link
Contributor

@dmorn dmorn commented Oct 21, 2025

The RTMP server was crashing when receiving streams from certain hardware encoders with the following error:

[warning] Unexpected header type when combining body chunks: 1
[error] GenServer #PID<0.1014.0> terminating
** (KeyError) key :timestamp not found in: nil
    (membrane_rtmp_plugin 0.29.1) lib/membrane_rtmp_plugin/rtmp/header.ex:114: Membrane.RTMP.Header.deserialize/2
    (membrane_rtmp_plugin 0.29.1) lib/membrane_rtmp_plugin/rtmp/message_parser.ex:180: Membrane.RTMP.MessageParser.read_frame/3

The crash was caused by incomplete support for RTMP chunk interleaving. Further, only chunk-stream-id singe byte serialization/deserialization was implemented.

This PR adds support for 1/2/3 byte type stream chunk identifiers and handles the situation where chunks from different streams are interleaved together. Fully backward compatible.

@dmorn dmorn requested a review from varsill as a code owner October 21, 2025 17:01
@dmorn dmorn changed the title Implement spec-compliant chunk-stream-id serialization/deserialization WIP: Implement spec-compliant chunk-stream-id serialization/deserialization Oct 24, 2025
@dmorn dmorn marked this pull request as draft October 24, 2025 15:22
@dmorn dmorn changed the title WIP: Implement spec-compliant chunk-stream-id serialization/deserialization Implement spec-compliant chunk-stream-id serialization/deserialization Oct 24, 2025
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.

2 participants