The Firefox codebase has mp4 parsing code in several different locations. In particular I want to highlight the following: - mp4parse-rust - this is currently used to parse metadata and surface it via MP4Metadata.cpp. - MoofParser - this handles parsing of movie fragments, but has also grown to parse various metadata. As such, it is responsible for more than just parsing the movie fragment box (moof), as the name may imply. - Index - this handles matching (indexing) various metadata to samples being read. It makes use of the MoofParser. It does not appear to currently have much knowledge of metadata from mp4parse-rust. Between the code from these components, there is a fair amount of duplication for metadata handling. While the above sets of code are utilized by code living in `dom/media/mp4`, our abstractions and data handling can mean that even though mp4parse-rust surfaces some data, we do not forward it to Index and moof parsing code. This then means the MoofParser has to do the same parsing again to be aware of pertinent metadata. For example, we update track information from mp4parse-rust. In doing so we expose crypto information, but it is not plumbed all the way through where it's needed for handling of samples from fragments. So the MoofParser has code to parse the same boxes as mp4parse-rust does. I would be good to reduce duplication such as this. It would help with code clarity, and it won't hurt if we're not spending cycles parsing the same data multiple times. : https://github.com/mozilla/mp4parse-rust : https://searchfox.org/mozilla-central/rev/d6f2d4bb73446534a9231faefae05934fcd05911/dom/media/mp4/MP4Metadata.cpp : https://searchfox.org/mozilla-central/rev/d6f2d4bb73446534a9231faefae05934fcd05911/dom/media/mp4/MoofParser.h : https://searchfox.org/mozilla-central/rev/d6f2d4bb73446534a9231faefae05934fcd05911/dom/media/mp4/Index.cpp : https://searchfox.org/mozilla-central/rev/d6f2d4bb73446534a9231faefae05934fcd05911/dom/media/mp4/MP4Metadata.cpp#250 : https://searchfox.org/mozilla-central/rev/da45a6b1c560ff4629534c966b15500b9fe7af2b/dom/media/mp4/MoofParser.cpp#314 : https://searchfox.org/mozilla-central/rev/d6f2d4bb73446534a9231faefae05934fcd05911/dom/media/mp4/MoofParser.cpp#301
You need to log in before you can comment on or make changes to this bug.