MediaSource duration attribute should not be equal to Infinity when set to a value...
authornael.ouedraogo@crf.canon.fr <nael.ouedraogo@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Jun 2017 08:44:29 +0000 (08:44 +0000)
committernael.ouedraogo@crf.canon.fr <nael.ouedraogo@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Jun 2017 08:44:29 +0000 (08:44 +0000)
commit12838539e31e088169225722160811b6020dbc74
treeeb4488dde855e181a493ba60d0b5b6d197e561e0
parent821a087c1657e1771b9bb3f9939e32bd03c364ae
MediaSource duration attribute should not be equal to Infinity when set to a value greater than 2^64
https://bugs.webkit.org/show_bug.cgi?id=171668

Reviewed by Jer Noble.

MediaSource duration attribute is a double represented in MediaSource by a MediaTime instance created with
MediaTime::CreateWithDouble(). This method implements an overflow control mechanism which sets MediaTime to
Infinity when the double value passed as argument is greater than 2^64.

This patch removes the overflow control mechanism when time value is represented as a double. This patch also
modifies the behavior of mathematical operations between a double MediaTime and rational MediaTime: the rational
MediaTime is converted to a double before applying the operation. Double MediaTime precision is the same as for
double. Overflow mechanisms still apply to the conversion of a double MediaTime to rational with setTimescale()
method. No behavior change for rational MediaTime.

LayoutTests/imported/w3c:

Update test expectations.

* web-platform-tests/media-source/mediasource-duration-boundaryconditions-expected.txt:

Source/WTF:

* wtf/MediaTime.cpp:
(WTF::MediaTime::createWithFloat):
(WTF::MediaTime::createWithDouble):
(WTF::MediaTime::operator+):
(WTF::MediaTime::operator-):

Tools:

* TestWebKitAPI/Tests/WTF/MediaTime.cpp: Add tests to check operation results between double and rational MediaTime.
(TestWebKitAPI::TEST):

LayoutTests:

Update test expectations.

* media/media-source/media-source-timeoffset-expected.txt:
* platform/gtk/imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions-expected.txt:
* platform/mac-elcapitan/imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218247 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions-expected.txt
LayoutTests/media/media-source/media-source-timeoffset-expected.txt
LayoutTests/platform/gtk/imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions-expected.txt
LayoutTests/platform/mac-elcapitan/imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions-expected.txt
Source/WTF/ChangeLog
Source/WTF/wtf/MediaTime.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WTF/MediaTime.cpp