A MediaTime timescale must never be zero
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Jan 2019 19:59:21 +0000 (19:59 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Jan 2019 19:59:21 +0000 (19:59 +0000)
commit0a86c8b6adcc41c18ccf00684bfdaaef3c808572
tree5a7fe2501ad0e0c45ffed9d82ae7b011ac79a248
parenta88e00a8ccb55f8ac37547a591bd36174f0e8f28
A MediaTime timescale must never be zero
https://bugs.webkit.org/show_bug.cgi?id=193156
<rdar://problem/32504501>

Reviewed by Jer Noble.

Source/WTF:

* wtf/MediaTime.cpp:
(WTF::greatestCommonDivisor): ASSERT if either parameter or return value is zero.
(WTF::MediaTime::MediaTime): Create +/- infinity if passed zero timescale.
(WTF::MediaTime::createWithFloat): Ditto.
(WTF::MediaTime::createWithDouble): Ditto.
(WTF::MediaTime::setTimeScale): Ditto.

Tools:

* TestWebKitAPI/Tests/WTF/MediaTime.cpp:
(TestWebKitAPI::TEST): Add tests for zero timescale.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239688 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WTF/ChangeLog
Source/WTF/wtf/MediaTime.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WTF/MediaTime.cpp