Remove the dead null checks on the track info in MP4Metadata::GetTrackInfo
Categories
(Core :: Audio/Video, task)
Tracking
()
People
(Reporter: Sylvestre, Unassigned, Mentored)
References
(Blocks 1 open bug)
Details
(Keywords: good-first-bug, Whiteboard: [lang=c++])
Filing as a good first bug to learn workflows.
In MP4Metadata::GetTrackInfo, e comes from std::make_unique (infallible) in every branch that reaches these checks, and it is already dereferenced (e->mTimeScale = ...). Drop the two e && tests (if (e && !e->mDuration.IsPositive()) and if (e && e->IsValid())). Per the dom/media guidelines, a MOZ_ASSERT(e) is fine if you want to keep a check.
Current code:
// No duration in track, use fragment_duration.
if (e && !e->mDuration.IsPositive()) {
Mp4parseFragmentInfo fragmentInfo;
Link to the code:
https://searchfox.org/firefox-main/source/dom/media/mp4/MP4Metadata.cpp
To verify the fix:
./mach build
./mach gtest 'MP4Demuxer*'
This was reported by Coverity Scan (CID 1679272). The analyzer will stop reporting it once the change lands.
Tutorial to contribute:
https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
https://firefox-source-docs.mozilla.org/contributing/stack_quickref.html
Please don't ask for the bug to be assigned. It will be automatically assigned to the first patch.
Description
•