diff --git a/CHANGES.md b/CHANGES.md index 6c00562825..d0656c675a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -21,6 +21,7 @@ Fixed: number of channels. - Improved support for unitary minus, fix runtime call of optional methods (#3498) +- Fixed `map.metadata` mutating existing metadata. - Fixed reloading loop in playlists with invalid files (#3479) - Fixed main HLS playlist codecs when using `mpegts` (#3483) - Fixed pop/clicks in crossfade and source with caching (#3318) diff --git a/src/core/operators/map_metadata.ml b/src/core/operators/map_metadata.ml index 7a9c3492a6..d74bbaa10f 100644 --- a/src/core/operators/map_metadata.ml +++ b/src/core/operators/map_metadata.ml @@ -63,8 +63,10 @@ class map_metadata source rewrite_f insert_missing update strip = List.iter (fun (t, m) -> if t >= p then ( + let m = Hashtbl.copy m in self#rewrite m; - if strip && Hashtbl.length m = 0 then Frame.free_metadata buf t)) + if strip && Hashtbl.length m = 0 then Frame.free_metadata buf t + else Frame.set_metadata buf t m)) (Frame.get_all_metadata buf) end