The [CompareIntervals::LessThan](https://searchfox.org/mozilla-central/rev/da48f565f70a57ac28862090828fbaa7fd8556f6/dom/media/Intervals.h#738) is not symmetric due to the `mFuzz`, leading to interesting side effects: ``` bool LessThan(const ElemType& aT1, const ElemType& aT2) const { return aT1.mStart - aT1.mFuzz < aT2.mStart + aT2.mFuzz; } ``` means ``` if (aT.mFuzz > 0) aT < aT // instead of aT == aT if (aT.mFuzz < 0) aT > aT // instead of aT == aT aT1.mStart := 1 aT1.mFuzz := 2 aT2.mStart := 2 aT2.mFuzz := 2 aT1 < aT2 && aT2 < aT1 // not symmetric ``` which makes `std::sort` angry. I assume this comparator did already cause weird effects with `NS_QuickSort` that were apparently less obvious. I assume the comparator should either just work on `mStart` or always subtract `mFuzz` both from `aT1` and `aT2` to get always the same value to compare with. I'd assume, just checking `mStart` should be fine here?
Bug 1869675 Comment 3 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
The [CompareIntervals::LessThan](https://searchfox.org/mozilla-central/rev/da48f565f70a57ac28862090828fbaa7fd8556f6/dom/media/Intervals.h#738) is not symmetric due to the `mFuzz`, leading to interesting side effects: ``` bool LessThan(const ElemType& aT1, const ElemType& aT2) const { return aT1.mStart - aT1.mFuzz < aT2.mStart + aT2.mFuzz; } ``` means ``` if (aT.mFuzz > 0) aT < aT // instead of aT == aT if (aT.mFuzz < 0) aT > aT // instead of aT == aT aT1.mStart := 1 aT1.mFuzz := 2 aT2.mStart := 2 aT2.mFuzz := 2 aT1 < aT2 && aT2 < aT1 // not symmetric ``` which makes `std::sort` angry. I assume this comparator did already cause weird effects with `NS_QuickSort` that were apparently less obvious. I think the comparator should either just work on `mStart` or always subtract `mFuzz` both from `aT1` and `aT2` to get always the same value to compare with. I'd assume, just checking `mStart` should be fine here?