Title: [223104] branches/safari-604-branch/Source/WebCore

Diff

Modified: branches/safari-604-branch/Source/WebCore/ChangeLog (223103 => 223104)


--- branches/safari-604-branch/Source/WebCore/ChangeLog	2017-10-10 00:08:27 UTC (rev 223103)
+++ branches/safari-604-branch/Source/WebCore/ChangeLog	2017-10-10 00:08:32 UTC (rev 223104)
@@ -1,5 +1,55 @@
 2017-10-09  Jason Marcell  <[email protected]>
 
+        Cherry-pick r221046. rdar://problem/34891067
+
+    2017-08-22  Jer Noble  <[email protected]>
+
+            Refactor videoPerformanceQuality() MediaPlayer methods into single call.
+            https://bugs.webkit.org/show_bug.cgi?id=175830
+
+            Reviewed by Eric Carlson.
+
+            Allow MediaPlayerPrivate subclasses to return all the metrics required for VideoPerformanceQuality in
+            a single call. For clients which incur significant overhead to request this data, this reduces the cost
+            of requesting data by the number of calls removed.
+
+            * html/HTMLMediaElement.cpp:
+            (WebCore::HTMLMediaElement::getVideoPlaybackQuality):
+            * platform/graphics/MediaPlayer.cpp:
+            (WebCore::MediaPlayer::videoPlaybackQualityMetrics):
+            (WebCore::MediaPlayer::totalVideoFrames): Deleted.
+            (WebCore::MediaPlayer::droppedVideoFrames): Deleted.
+            (WebCore::MediaPlayer::corruptedVideoFrames): Deleted.
+            (WebCore::MediaPlayer::totalFrameDelay): Deleted.
+            * platform/graphics/MediaPlayer.h:
+            (WebCore::PlatformVideoPlaybackQualityMetrics::PlatformVideoPlaybackQualityMetrics):
+            * platform/graphics/MediaPlayerPrivate.h:
+            (WebCore::MediaPlayerPrivateInterface::videoPlaybackQualityMetrics):
+            (WebCore::MediaPlayerPrivateInterface::totalVideoFrames): Deleted.
+            (WebCore::MediaPlayerPrivateInterface::droppedVideoFrames): Deleted.
+            (WebCore::MediaPlayerPrivateInterface::corruptedVideoFrames): Deleted.
+            (WebCore::MediaPlayerPrivateInterface::totalFrameDelay): Deleted.
+            * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
+            * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+            (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::videoPlaybackQualityMetrics):
+            (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::totalVideoFrames): Deleted.
+            (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::droppedVideoFrames): Deleted.
+            (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::corruptedVideoFrames): Deleted.
+            (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::totalFrameDelay): Deleted.
+            * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
+            * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp:
+            (WebCore::MockMediaPlayerMediaSource::videoPlaybackQualityMetrics):
+            (WebCore::MockMediaPlayerMediaSource::totalVideoFrames): Deleted.
+            (WebCore::MockMediaPlayerMediaSource::droppedVideoFrames): Deleted.
+            (WebCore::MockMediaPlayerMediaSource::corruptedVideoFrames): Deleted.
+            (WebCore::MockMediaPlayerMediaSource::totalFrameDelay): Deleted.
+            * platform/mock/mediasource/MockMediaPlayerMediaSource.h:
+            * platform/mock/mediasource/MockMediaSourcePrivate.cpp:
+            (WebCore::MockMediaSourcePrivate::videoPlaybackQualityMetrics):
+            * platform/mock/mediasource/MockMediaSourcePrivate.h:
+
+2017-10-09  Jason Marcell  <[email protected]>
+
         Cherry-pick r222402. rdar://problem/34770839
 
     2017-09-22  Tim Horton  <[email protected]>

Modified: branches/safari-604-branch/Source/WebCore/html/HTMLMediaElement.cpp (223103 => 223104)


--- branches/safari-604-branch/Source/WebCore/html/HTMLMediaElement.cpp	2017-10-10 00:08:27 UTC (rev 223103)
+++ branches/safari-604-branch/Source/WebCore/html/HTMLMediaElement.cpp	2017-10-10 00:08:32 UTC (rev 223104)
@@ -6743,14 +6743,15 @@
     DOMWindow* domWindow = document().domWindow();
     double timestamp = domWindow ? 1000 * domWindow->nowTimestamp() : 0;
 
-    if (!m_player)
+    auto metrics = m_player ? m_player->videoPlaybackQualityMetrics() : std::nullopt;
+    if (!metrics)
         return VideoPlaybackQuality::create(timestamp, 0, 0, 0, 0);
 
     return VideoPlaybackQuality::create(timestamp,
-        m_droppedVideoFrames + m_player->totalVideoFrames(),
-        m_droppedVideoFrames + m_player->droppedVideoFrames(),
-        m_player->corruptedVideoFrames(),
-        m_player->totalFrameDelay().toDouble());
+        metrics.value().totalVideoFrames + m_droppedVideoFrames,
+        metrics.value().droppedVideoFrames + m_droppedVideoFrames,
+        metrics.value().corruptedVideoFrames,
+        metrics.value().totalFrameDelay);
 }
 #endif
 

Modified: branches/safari-604-branch/Source/WebCore/platform/graphics/MediaPlayer.cpp (223103 => 223104)


--- branches/safari-604-branch/Source/WebCore/platform/graphics/MediaPlayer.cpp	2017-10-10 00:08:27 UTC (rev 223103)
+++ branches/safari-604-branch/Source/WebCore/platform/graphics/MediaPlayer.cpp	2017-10-10 00:08:32 UTC (rev 223104)
@@ -1391,37 +1391,13 @@
 }
 
 #if ENABLE(MEDIA_SOURCE)
-unsigned long MediaPlayer::totalVideoFrames()
+std::optional<PlatformVideoPlaybackQualityMetrics> MediaPlayer::videoPlaybackQualityMetrics()
 {
     if (!m_private)
-        return 0;
+        return std::nullopt;
 
-    return m_private->totalVideoFrames();
+    return m_private->videoPlaybackQualityMetrics();
 }
-
-unsigned long MediaPlayer::droppedVideoFrames()
-{
-    if (!m_private)
-        return 0;
-
-    return m_private->droppedVideoFrames();
-}
-
-unsigned long MediaPlayer::corruptedVideoFrames()
-{
-    if (!m_private)
-        return 0;
-
-    return m_private->corruptedVideoFrames();
-}
-
-MediaTime MediaPlayer::totalFrameDelay()
-{
-    if (!m_private)
-        return MediaTime::zeroTime();
-
-    return m_private->totalFrameDelay();
-}
 #endif
 
 bool MediaPlayer::shouldWaitForResponseToAuthenticationChallenge(const AuthenticationChallenge& challenge)

Modified: branches/safari-604-branch/Source/WebCore/platform/graphics/MediaPlayer.h (223103 => 223104)


--- branches/safari-604-branch/Source/WebCore/platform/graphics/MediaPlayer.h	2017-10-10 00:08:27 UTC (rev 223103)
+++ branches/safari-604-branch/Source/WebCore/platform/graphics/MediaPlayer.h	2017-10-10 00:08:32 UTC (rev 223104)
@@ -118,6 +118,21 @@
     Vector<ContentType> contentTypesRequiringHardwareSupport;
 };
 
+struct PlatformVideoPlaybackQualityMetrics {
+    PlatformVideoPlaybackQualityMetrics(unsigned long totalVideoFrames, unsigned long droppedVideoFrames, unsigned long corruptedVideoFrames, double totalFrameDelay)
+        : totalVideoFrames(totalVideoFrames)
+        , droppedVideoFrames(droppedVideoFrames)
+        , corruptedVideoFrames(corruptedVideoFrames)
+        , totalFrameDelay(totalFrameDelay)
+    {
+    }
+
+    unsigned long totalVideoFrames;
+    unsigned long droppedVideoFrames;
+    unsigned long corruptedVideoFrames;
+    double totalFrameDelay;
+};
+
 extern const PlatformMedia NoPlatformMedia;
 
 class CDMSessionClient;
@@ -574,10 +589,7 @@
     unsigned long long fileSize() const;
 
 #if ENABLE(MEDIA_SOURCE)
-    unsigned long totalVideoFrames();
-    unsigned long droppedVideoFrames();
-    unsigned long corruptedVideoFrames();
-    MediaTime totalFrameDelay();
+    std::optional<PlatformVideoPlaybackQualityMetrics> videoPlaybackQualityMetrics();
 #endif
 
     bool shouldWaitForResponseToAuthenticationChallenge(const AuthenticationChallenge&);

Modified: branches/safari-604-branch/Source/WebCore/platform/graphics/MediaPlayerPrivate.h (223103 => 223104)


--- branches/safari-604-branch/Source/WebCore/platform/graphics/MediaPlayerPrivate.h	2017-10-10 00:08:27 UTC (rev 223103)
+++ branches/safari-604-branch/Source/WebCore/platform/graphics/MediaPlayerPrivate.h	2017-10-10 00:08:32 UTC (rev 223104)
@@ -264,10 +264,7 @@
     virtual bool ended() const { return false; }
 
 #if ENABLE(MEDIA_SOURCE)
-    virtual unsigned long totalVideoFrames() { return 0; }
-    virtual unsigned long droppedVideoFrames() { return 0; }
-    virtual unsigned long corruptedVideoFrames() { return 0; }
-    virtual MediaTime totalFrameDelay() { return MediaTime::zeroTime(); }
+    virtual std::optional<PlatformVideoPlaybackQualityMetrics> videoPlaybackQualityMetrics() { return std::nullopt; }
 #endif
 
 #if ENABLE(AVF_CAPTIONS)

Modified: branches/safari-604-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h (223103 => 223104)


--- branches/safari-604-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h	2017-10-10 00:08:27 UTC (rev 223103)
+++ branches/safari-604-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h	2017-10-10 00:08:32 UTC (rev 223104)
@@ -208,10 +208,7 @@
 
     size_t extraMemoryCost() const override;
 
-    unsigned long totalVideoFrames() override;
-    unsigned long droppedVideoFrames() override;
-    unsigned long corruptedVideoFrames() override;
-    MediaTime totalFrameDelay() override;
+    std::optional<PlatformVideoPlaybackQualityMetrics> videoPlaybackQualityMetrics() override;
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
     bool isCurrentPlaybackTargetWireless() const override;

Modified: branches/safari-604-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm (223103 => 223104)


--- branches/safari-604-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2017-10-10 00:08:27 UTC (rev 223103)
+++ branches/safari-604-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2017-10-10 00:08:32 UTC (rev 223104)
@@ -679,26 +679,21 @@
     return 0;
 }
 
-unsigned long MediaPlayerPrivateMediaSourceAVFObjC::totalVideoFrames()
+std::optional<PlatformVideoPlaybackQualityMetrics> MediaPlayerPrivateMediaSourceAVFObjC::videoPlaybackQualityMetrics()
 {
-    return [[m_sampleBufferDisplayLayer videoPerformanceMetrics] totalNumberOfVideoFrames];
-}
 
-unsigned long MediaPlayerPrivateMediaSourceAVFObjC::droppedVideoFrames()
-{
-    return [[m_sampleBufferDisplayLayer videoPerformanceMetrics] numberOfDroppedVideoFrames];
-}
+    auto metrics = [m_sampleBufferDisplayLayer videoPerformanceMetrics];
+    if (!metrics)
+        return std::nullopt;
 
-unsigned long MediaPlayerPrivateMediaSourceAVFObjC::corruptedVideoFrames()
-{
-    return [[m_sampleBufferDisplayLayer videoPerformanceMetrics] numberOfCorruptedVideoFrames];
+    return PlatformVideoPlaybackQualityMetrics(
+        [metrics totalNumberOfVideoFrames],
+        [metrics numberOfDroppedVideoFrames],
+        [metrics numberOfCorruptedVideoFrames],
+        [metrics totalFrameDelay]
+    );
 }
 
-MediaTime MediaPlayerPrivateMediaSourceAVFObjC::totalFrameDelay()
-{
-    return MediaTime::createWithDouble([[m_sampleBufferDisplayLayer videoPerformanceMetrics] totalFrameDelay]);
-}
-
 #pragma mark -
 #pragma mark Utility Methods
 

Modified: branches/safari-604-branch/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h (223103 => 223104)


--- branches/safari-604-branch/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h	2017-10-10 00:08:27 UTC (rev 223103)
+++ branches/safari-604-branch/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h	2017-10-10 00:08:32 UTC (rev 223104)
@@ -101,10 +101,7 @@
     void asyncStateChangeDone() override;
 
     // FIXME: Implement.
-    unsigned long totalVideoFrames() override { return 0; }
-    unsigned long droppedVideoFrames() override { return 0; }
-    unsigned long corruptedVideoFrames() override { return 0; }
-    MediaTime totalFrameDelay() override { return MediaTime::zeroTime(); }
+    std::optional<PlatformVideoPlaybackQualityMetrics> videoPlaybackQualityMetrics() override { return std::nullopt; }
     bool isTimeBuffered(const MediaTime&) const;
 
     bool isMediaSource() const override { return true; }

Modified: branches/safari-604-branch/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp (223103 => 223104)


--- branches/safari-604-branch/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp	2017-10-10 00:08:27 UTC (rev 223103)
+++ branches/safari-604-branch/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp	2017-10-10 00:08:32 UTC (rev 223104)
@@ -274,26 +274,11 @@
         });
 }
 
-unsigned long MockMediaPlayerMediaSource::totalVideoFrames()
+std::optional<PlatformVideoPlaybackQualityMetrics> MockMediaPlayerMediaSource::videoPlaybackQualityMetrics()
 {
-    return m_mediaSourcePrivate ? m_mediaSourcePrivate->totalVideoFrames() : 0;
+    return m_mediaSourcePrivate ? m_mediaSourcePrivate->videoPlaybackQualityMetrics() : std::nullopt;
 }
 
-unsigned long MockMediaPlayerMediaSource::droppedVideoFrames()
-{
-    return m_mediaSourcePrivate ? m_mediaSourcePrivate->droppedVideoFrames() : 0;
 }
 
-unsigned long MockMediaPlayerMediaSource::corruptedVideoFrames()
-{
-    return m_mediaSourcePrivate ? m_mediaSourcePrivate->corruptedVideoFrames() : 0;
-}
-
-MediaTime MockMediaPlayerMediaSource::totalFrameDelay()
-{
-    return m_mediaSourcePrivate ? m_mediaSourcePrivate->totalFrameDelay() : MediaTime::zeroTime();
-}
-
-}
-
 #endif

Modified: branches/safari-604-branch/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.h (223103 => 223104)


--- branches/safari-604-branch/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.h	2017-10-10 00:08:27 UTC (rev 223103)
+++ branches/safari-604-branch/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.h	2017-10-10 00:08:32 UTC (rev 223104)
@@ -81,10 +81,7 @@
     MediaTime currentMediaTime() const override;
     MediaTime durationMediaTime() const override;
     void seekWithTolerance(const MediaTime&, const MediaTime&, const MediaTime&) override;
-    unsigned long totalVideoFrames() override;
-    unsigned long droppedVideoFrames() override;
-    unsigned long corruptedVideoFrames() override;
-    MediaTime totalFrameDelay() override;
+    std::optional<PlatformVideoPlaybackQualityMetrics> videoPlaybackQualityMetrics() override;
 
     MediaPlayer* m_player;
     RefPtr<MockMediaSourcePrivate> m_mediaSourcePrivate;

Modified: branches/safari-604-branch/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp (223103 => 223104)


--- branches/safari-604-branch/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp	2017-10-10 00:08:27 UTC (rev 223103)
+++ branches/safari-604-branch/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp	2017-10-10 00:08:32 UTC (rev 223104)
@@ -183,6 +183,16 @@
     return seekTime;
 }
 
+std::optional<PlatformVideoPlaybackQualityMetrics> MockMediaSourcePrivate::videoPlaybackQualityMetrics()
+{
+    return PlatformVideoPlaybackQualityMetrics(
+        m_totalVideoFrames,
+        m_droppedVideoFrames,
+        m_corruptedVideoFrames,
+        m_totalFrameDelay.toDouble()
+    );
+}
+
 };
 
 #endif

Modified: branches/safari-604-branch/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.h (223103 => 223104)


--- branches/safari-604-branch/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.h	2017-10-10 00:08:27 UTC (rev 223103)
+++ branches/safari-604-branch/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.h	2017-10-10 00:08:32 UTC (rev 223104)
@@ -55,10 +55,7 @@
     void seekToTime(const MediaTime&);
     MediaTime seekToTime(const MediaTime&, const MediaTime& negativeThreshold, const MediaTime& positiveThreshold);
 
-    unsigned long totalVideoFrames() const { return m_totalVideoFrames; }
-    unsigned long droppedVideoFrames() const  { return m_droppedVideoFrames; }
-    unsigned long corruptedVideoFrames() const { return m_corruptedVideoFrames; }
-    MediaTime totalFrameDelay() const { return m_totalFrameDelay; }
+    std::optional<PlatformVideoPlaybackQualityMetrics> videoPlaybackQualityMetrics();
 
     void incrementTotalVideoFrames() { ++m_totalVideoFrames; }
     void incrementDroppedFrames() { ++m_droppedVideoFrames; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to