Update codec parameters from first keyframe #1924
Open
+168
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Dynamically extracts and updates codec parameters (SPS/PPS for H.264, VPS/SPS/PPS for H.265) from the first keyframe when they are missing or incomplete in the initial stream setup.
Problem
Some RTSP cameras don't send parameter sets in the DESCRIBE response, resulting in missing or incorrect codec FmtpLine. This causes issues with MSE playback (incorrect aspect ratios) and other consumers that rely on accurate codec information.
Solution
codec.FmtpLinedynamically in format handlers (RepairAVCC, RTPDepay)Note: The FmtpLine update happens during processing of the first keyframe, so it does not affect the first consumer but benefits all subsequent consumers. This makes it ideal for use with preload - the preloader processes the first keyframe and updates the codec parameters, then all following consumers receive the correct FmtpLine.
Fixes #1634