[WinCairo][MediaFoundation] Implement seek.
authorpeavo@outlook.com <peavo@outlook.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Nov 2015 18:22:31 +0000 (18:22 +0000)
committerpeavo@outlook.com <peavo@outlook.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Nov 2015 18:22:31 +0000 (18:22 +0000)
https://bugs.webkit.org/show_bug.cgi?id=151609

Reviewed by Alex Christensen.

The methods maxTimeSeekable() and buffered() needs to be implemented.

* platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
(WebCore::MediaPlayerPrivateMediaFoundation::seekDouble):
(WebCore::MediaPlayerPrivateMediaFoundation::durationDouble):
(WebCore::MediaPlayerPrivateMediaFoundation::readyState):
(WebCore::MediaPlayerPrivateMediaFoundation::maxTimeSeekable):
(WebCore::MediaPlayerPrivateMediaFoundation::buffered):
(WebCore::MediaPlayerPrivateMediaFoundation::didLoadingProgress):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::currentTime):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::isActive):
* platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::maxTimeLoaded):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@192802 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp
Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h

index a04ce0c..64af4f3 100644 (file)
@@ -1,3 +1,24 @@
+2015-11-30  Per Arne Vollan  <peavo@outlook.com>
+
+        [WinCairo][MediaFoundation] Implement seek.
+        https://bugs.webkit.org/show_bug.cgi?id=151609
+
+        Reviewed by Alex Christensen.
+
+        The methods maxTimeSeekable() and buffered() needs to be implemented.
+
+        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
+        (WebCore::MediaPlayerPrivateMediaFoundation::seekDouble):
+        (WebCore::MediaPlayerPrivateMediaFoundation::durationDouble):
+        (WebCore::MediaPlayerPrivateMediaFoundation::readyState):
+        (WebCore::MediaPlayerPrivateMediaFoundation::maxTimeSeekable):
+        (WebCore::MediaPlayerPrivateMediaFoundation::buffered):
+        (WebCore::MediaPlayerPrivateMediaFoundation::didLoadingProgress):
+        (WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::currentTime):
+        (WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::isActive):
+        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
+        (WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::maxTimeLoaded):
+
 2015-11-30  Brady Eidson  <beidson@apple.com>
 
         Modern IDB: openCursor() fix resulting in at least 4 more passing tests.
index 831ee10..8dcca43 100644 (file)
@@ -217,6 +217,8 @@ void MediaPlayerPrivateMediaFoundation::seekDouble(double time)
     HRESULT hr = m_mediaSession->Start(&GUID_NULL, &propVariant);
     ASSERT(SUCCEEDED(hr));
     PropVariantClear(&propVariant);
+
+    m_player->timeChanged();
 }
 
 double MediaPlayerPrivateMediaFoundation::durationDouble() const
@@ -260,10 +262,17 @@ MediaPlayer::ReadyState MediaPlayerPrivateMediaFoundation::readyState() const
     return m_readyState;
 }
 
+float MediaPlayerPrivateMediaFoundation::maxTimeSeekable() const
+{
+    return durationDouble();
+}
+
 std::unique_ptr<PlatformTimeRanges> MediaPlayerPrivateMediaFoundation::buffered() const
 { 
-    notImplemented();
-    return std::make_unique<PlatformTimeRanges>();
+    auto ranges = std::make_unique<PlatformTimeRanges>();
+    if (m_presenter && m_presenter->maxTimeLoaded() > 0)
+        ranges->add(MediaTime::zeroTime(), MediaTime::createWithDouble(m_presenter->maxTimeLoaded()));
+    return ranges;
 }
 
 bool MediaPlayerPrivateMediaFoundation::didLoadingProgress() const
@@ -1279,7 +1288,12 @@ float MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::currentTime()
         return 0.0f;
 
     // clockTime is in 100 nanoseconds, we need to convert to seconds.
-    return clockTime / tenMegahertz;
+    float currentTime = clockTime / tenMegahertz;
+
+    if (currentTime > m_maxTimeLoaded)
+        m_maxTimeLoaded = currentTime;
+
+    return currentTime;
 }
 
 bool MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::isActive() const
index 3bf4dee..2f0018d 100644 (file)
@@ -81,6 +81,8 @@ public:
     virtual MediaPlayer::NetworkState networkState() const;
     virtual MediaPlayer::ReadyState readyState() const;
 
+    virtual float maxTimeSeekable() const override;
+
     virtual std::unique_ptr<PlatformTimeRanges> buffered() const;
 
     virtual bool didLoadingProgress() const;
@@ -392,6 +394,8 @@ private:
 
         float currentTime();
 
+        float maxTimeLoaded() const { return m_maxTimeLoaded; }
+
     private:
         ULONG m_refCount { 0 };
         Lock m_lock;
@@ -419,6 +423,7 @@ private:
         VideoSamplePool m_samplePool;
         unsigned m_tokenCounter { 0 };
         float m_rate { 1.0f };
+        float m_maxTimeLoaded { 0.0f };
 
         bool isActive() const;