Title: [289762] trunk/Source/WebCore
Revision
289762
Author
[email protected]
Date
2022-02-14 13:51:29 -0800 (Mon, 14 Feb 2022)

Log Message

REGRESSION(r286560): MediaElement's getStartDate returning an incorrect time
https://bugs.webkit.org/show_bug.cgi?id=236360
<rdar://problem/88786989>

Reviewed by Eric Carlson.

r286560 changed IDL `Date` to use `WallTime` instead of a raw `double`, meaning that
`HTMLMediaElement::getStartDate` now did extra processing of the `MediaTime` returned by
`MediaPlayer::getStartDate`.

Unfortunately, `MediaPlayerPrivateAVFoundationObjC::getStartDate` returned a `MediaTime`
represented in milliseconds (due to two `* 1000`), even though `MediaTime` is supposed to be
seconds-based.

As a result, the changes in r286560 inadvertently caused two `* 1000` on the same time value.

Covered by existing test (`LayoutTests/http/tests/media/hls/video-controller-getStartDate.html`).
Note that the test was marked as `[Pass Failure]` before r286560.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::getStartDate const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (289761 => 289762)


--- trunk/Source/WebCore/ChangeLog	2022-02-14 21:12:55 UTC (rev 289761)
+++ trunk/Source/WebCore/ChangeLog	2022-02-14 21:51:29 UTC (rev 289762)
@@ -1,3 +1,27 @@
+2022-02-14  Devin Rousso  <[email protected]>
+
+        REGRESSION(r286560): MediaElement's getStartDate returning an incorrect time
+        https://bugs.webkit.org/show_bug.cgi?id=236360
+        <rdar://problem/88786989>
+
+        Reviewed by Eric Carlson.
+
+        r286560 changed IDL `Date` to use `WallTime` instead of a raw `double`, meaning that
+        `HTMLMediaElement::getStartDate` now did extra processing of the `MediaTime` returned by
+        `MediaPlayer::getStartDate`.
+
+        Unfortunately, `MediaPlayerPrivateAVFoundationObjC::getStartDate` returned a `MediaTime`
+        represented in milliseconds (due to two `* 1000`), even though `MediaTime` is supposed to be
+        seconds-based.
+
+        As a result, the changes in r286560 inadvertently caused two `* 1000` on the same time value.
+
+        Covered by existing test (`LayoutTests/http/tests/media/hls/video-controller-getStartDate.html`).
+        Note that the test was marked as `[Pass Failure]` before r286560.
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::getStartDate const):
+
 2022-02-14  Peng Liu  <[email protected]>
 
         Add a centerControlsBar in InlineMediaControls

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (289761 => 289762)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2022-02-14 21:12:55 UTC (rev 289761)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2022-02-14 21:51:29 UTC (rev 289762)
@@ -670,13 +670,13 @@
 MediaTime MediaPlayerPrivateAVFoundationObjC::getStartDate() const
 {
     // Date changes as the track's playback position changes. Must subtract currentTime (offset in seconds) from date offset to get date beginning
-    double date = [[m_avPlayerItem currentDate] timeIntervalSince1970] * 1000;
+    double date = [[m_avPlayerItem currentDate] timeIntervalSince1970];
 
     // No live streams were made during the epoch (1970). AVFoundation returns 0 if the media file doesn't have a start date
     if (!date)
         return MediaTime::invalidTime();
 
-    double currentTime = PAL::CMTimeGetSeconds([m_avPlayerItem currentTime]) * 1000;
+    double currentTime = PAL::CMTimeGetSeconds([m_avPlayerItem currentTime]);
 
     // Rounding due to second offset error when subtracting.
     return MediaTime::createWithDouble(round(date - currentTime));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to