Repository navigation
Commit 961981e
MediaTime spaceship operator returns the wrong order for equal negative numerators with different timescales
https://bugs.webkit.org/show_bug.cgi?id=328445
rdar://190698694
Reviewed by Eric Carlson.
When both operands have the same time value but different time scales,
the spaceship operator returned `b.m_timeScale <=> a.m_timeScale`. That is
only correct for positive values, where a larger scale means a smaller
magnitude. For negative values the relationship is reversed, so
MediaTime(-1, 10) (-0.1) compared as less than MediaTime(-1, 5) (-0.2).
Compare the scales in the opposite order when the shared time value is
negative.
Test: Tools/TestWebKitAPI/Tests/WTF/MediaTime.cpp
* Source/WTF/wtf/MediaTime.cpp:
(WTF::operator<=>):
* Tools/TestWebKitAPI/Tests/WTF/MediaTime.cpp:
(TestWebKitAPI::TEST(WTF, MediaTime)):
Canonical link: https://commits.webkit.org/324514@main1 parent 549e7aa commit 961981e
2 files changed
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
380 | | - | |
| 380 | + | |
381 | 381 | | |
382 | 382 | | |
383 | 383 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
171 | 177 | | |
172 | 178 | | |
173 | 179 | | |
| |||
0 commit comments