Changeset 206032 in webkit


Ignore:
Timestamp:
Sep 16, 2016 11:04:54 AM (8 years ago)
Author:
jer.noble@apple.com
Message:

[media-source] fix imported/w3c/web-platform-tests/media-source/mediasource-duration.html
https://bugs.webkit.org/show_bug.cgi?id=161999

Reviewed by Eric Carlson.

LayoutTests/imported/w3c:

Expected results had a stray newline.

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

Source/WTF:

The mediasource-duration.html test tries to set the duration of a MediaSource to a double value
(5.0), then some work happens and the duration is set to a media time (12533/2500, or 5.0132).
The test then tries to set that value as the duration, converted from a media time to a double,
and asserts that no duration change event is fired. But because the floating point value and the
media time value are ever so slightly different, this round-tripping fails.

Fix this bug in MediaTime by, when one side or the other of a comparison is a floating point
MediaTime, convert both sides to doubles and run the comparison against those values. This preserves
the transitive equality of doubles <-> MediaTimes.

  • wtf/MediaTime.cpp:

(WTF::MediaTime::compare):

Tools:

  • TestWebKitAPI/Tests/WTF/MediaTime.cpp:

(TestWebKitAPI::TEST):

LayoutTests:

  • platform/mac/TestExpectations:
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r206028 r206032  
     12016-09-14  Jer Noble  <jer.noble@apple.com>
     2
     3        [media-source] fix imported/w3c/web-platform-tests/media-source/mediasource-duration.html
     4        https://bugs.webkit.org/show_bug.cgi?id=161999
     5
     6        Reviewed by Eric Carlson.
     7
     8        * platform/mac/TestExpectations:
     9
    1102016-09-16  Jer Noble  <jer.noble@apple.com>
    211
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r206026 r206032  
     12016-09-14  Jer Noble  <jer.noble@apple.com>
     2
     3        [media-source] fix imported/w3c/web-platform-tests/media-source/mediasource-duration.html
     4        https://bugs.webkit.org/show_bug.cgi?id=161999
     5
     6        Reviewed by Eric Carlson.
     7
     8        Expected results had a stray newline.
     9
     10        * web-platform-tests/media-source/mediasource-duration-expected.txt:
     11
    1122016-09-16  Chris Dumez  <cdumez@apple.com>
    213
  • trunk/LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-duration-expected.txt

    r205777 r206032  
    55PASS Test setting same duration multiple times does not fire duplicate durationchange
    66PASS Test setting the duration to less than the highest starting presentation timestamp will throw
     7
  • trunk/LayoutTests/platform/mac/TestExpectations

    r206028 r206032  
    10501050[ Yosemite+ ] imported/w3c/web-platform-tests/media-source/mediasource-closed.html [ Pass ]
    10511051[ Yosemite+ ] imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-v-bitrate.html [ Pass ]
     1052[ Yosemite+ ] imported/w3c/web-platform-tests/media-source/mediasource-duration.html [ Pass ]
    10521053[ Yosemite+ ] imported/w3c/web-platform-tests/media-source/mediasource-endofstream-invaliderror.html [ Pass ]
    10531054[ Yosemite+ ] imported/w3c/web-platform-tests/media-source/mediasource-multiple-attach.html [ Pass ]
  • trunk/Source/WTF/ChangeLog

    r206031 r206032  
     12016-09-14  Jer Noble  <jer.noble@apple.com>
     2
     3        [media-source] fix imported/w3c/web-platform-tests/media-source/mediasource-duration.html
     4        https://bugs.webkit.org/show_bug.cgi?id=161999
     5
     6        Reviewed by Eric Carlson.
     7
     8        The mediasource-duration.html test tries to set the duration of a MediaSource to a double value
     9        (5.0), then some work happens and the duration is set to a media time (12533/2500, or 5.0132).
     10        The test then tries to set that value as the duration, converted from a media time to a double,
     11        and asserts that no duration change event is fired.  But because the floating point value and the
     12        media time value are ever so slightly different, this round-tripping fails.
     13
     14        Fix this bug in MediaTime by, when one side or the other of a comparison is a floating point
     15        MediaTime, convert both sides to doubles and run the comparison against those values. This preserves
     16        the transitive equality of doubles <-> MediaTimes.
     17
     18        * wtf/MediaTime.cpp:
     19        (WTF::MediaTime::compare):
     20
    1212016-09-16  Anders Carlsson  <andersca@apple.com>
    222
  • trunk/Source/WTF/wtf/MediaTime.cpp

    r202829 r206032  
    408408    }
    409409
     410    if (hasDoubleValue() || rhs.hasDoubleValue()) {
     411        double a = toDouble();
     412        double b = rhs.toDouble();
     413        if (a > b)
     414            return GreaterThan;
     415        if (a < b)
     416            return LessThan;
     417        return EqualTo;
     418    }
     419
    410420    MediaTime a = *this;
    411421    MediaTime b = rhs;
    412 
    413     if (a.hasDoubleValue())
    414         a.setTimeScale(DefaultTimeScale);
    415 
    416     if (b.hasDoubleValue())
    417         b.setTimeScale(DefaultTimeScale);
    418422
    419423    int64_t rhsWhole = b.m_timeValue / b.m_timeScale;
  • trunk/Tools/ChangeLog

    r206031 r206032  
     12016-09-14  Jer Noble  <jer.noble@apple.com>
     2
     3        [media-source] fix imported/w3c/web-platform-tests/media-source/mediasource-duration.html
     4        https://bugs.webkit.org/show_bug.cgi?id=161999
     5
     6        Reviewed by Eric Carlson.
     7
     8        * TestWebKitAPI/Tests/WTF/MediaTime.cpp:
     9        (TestWebKitAPI::TEST):
     10
    1112016-09-16  Anders Carlsson  <andersca@apple.com>
    212
  • trunk/Tools/TestWebKitAPI/Tests/WTF/MediaTime.cpp

    r194416 r206032  
    186186    EXPECT_EQ(10.0123456789f, MediaTime::createWithFloat(10.0123456789f).toFloat());
    187187    EXPECT_EQ(10.0123456789, MediaTime::createWithDouble(10.0123456789).toDouble());
     188    EXPECT_EQ(MediaTime(1, 3), MediaTime::createWithDouble(MediaTime(1, 3).toDouble()));
    188189
    189190    // Floating Point Math
Note: See TracChangeset for help on using the changeset viewer.