Make sure there's only one metadata at at given frame position. #2786
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.
While debugging the new
tracks
branch I cam accros a situation where:0
.deduplicate
operator was considering the second one as a repeat and deleting itmap_metadata
andfree_metadata
(weird name!) API both assumes that there is at most one metadata at a given position: https://github.com/savonet/liquidsoap/blob/main/src/core/operators/map_metadata.ml#L65The real underlying problem is that our filling boundaries currently aren't mutually exclusive. Break, for instance, can be added several time at the same position to specify empty tracks, and metadata are usually added at the same time.
Thus, until we finally tackle the immutable content/streaming API rewrite, it seems to be that the best course of action is to make sure that metadata (not breaks!) are unique when sorted by position.
This PR does that with a quick
sort_uniq
. The other alternative would be a hash or map but this is too involved since we know we will eventually rework the whole thing.