[webkit-changes] [WebKit/WebKit] 7f511c: Add MediaTime::toMicroseconds() and MediaTime::cre...
Jean-Yves Avenard
noreply at github.com
Wed Oct 23 07:28:20 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 7f511c9ff686df2fd92e6f9be4228df68ad5541f
https://github.com/WebKit/WebKit/commit/7f511c9ff686df2fd92e6f9be4228df68ad5541f
Author: Jean-Yves Avenard <jya at apple.com>
Date: 2024-10-23 (Wed, 23 Oct 2024)
Changed paths:
M Source/WTF/wtf/MediaTime.cpp
M Source/WTF/wtf/MediaTime.h
M Tools/TestWebKitAPI/Tests/WTF/MediaTime.cpp
Log Message:
-----------
Add MediaTime::toMicroseconds() and MediaTime::createWithSeconds()
https://bugs.webkit.org/show_bug.cgi?id=281734
rdar://138171274
Reviewed by Youenn Fablet.
Fly-by: bypass calculation of GCD and LCM for the most common used case: operations of MediaTime where the time scales are equal.
toMicroseconds is made to reduce the chance of overflow when calculating value * 1000000 / scale.
API tests added.
* Source/WTF/wtf/MediaTime.cpp:
(WTF::greatestCommonDivisor):
(WTF::leastCommonMultiple):
(WTF::MediaTime::toMicroseconds const):
(WTF::MediaTime::operator+ const):
(WTF::MediaTime::operator- const):
* Source/WTF/wtf/MediaTime.h:
* Tools/TestWebKitAPI/Tests/WTF/MediaTime.cpp:
(TestWebKitAPI::TEST(WTF, MediaTime)):
(TestWebKitAPI::TEST(WTF, MediaTimeInExpected)):
Canonical link: https://commits.webkit.org/285597@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list