Wait until we've seen all streams to start decoding. #3616
Merged
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.
We are seeing situation, for instance when decoding a live rtmp stream, where there is a significant section of audio data that comes before the first video frame, leading to initial de-synchronizations.
This PR adds an interleaving decoding buffer which keeps at most +/- 5s of data from decoded streams until all streams have been seen and then pushes all buffered data that is +- 30ms away from the position of the last seen streams. These values can be changed via configuration options.
This mechanism should make sure that our initial decoding is always synced on all streams. There is a slight potential for dropping an initial A frame when using encoded data packets but +/-5 seconds should ensure that this only happens in extreme cases.