[WinCairo][MediaFoundation] Setting playback rate does not work.
authorpeavo@outlook.com <peavo@outlook.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Dec 2015 17:45:16 +0000 (17:45 +0000)
committerpeavo@outlook.com <peavo@outlook.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Dec 2015 17:45:16 +0000 (17:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=152172

Reviewed by Brent Fulgham.

Implement method to set playback rate.

* platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
(WebCore::MediaPlayerPrivateMediaFoundation::seekDouble):
(WebCore::MediaPlayerPrivateMediaFoundation::setRateDouble):
(WebCore::MediaPlayerPrivateMediaFoundation::durationDouble):
* platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:

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

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

index 14b2de4..8c89c20 100644 (file)
@@ -1,3 +1,18 @@
+2015-12-11  Per Arne Vollan  <peavo@outlook.com>
+
+        [WinCairo][MediaFoundation] Setting playback rate does not work.
+        https://bugs.webkit.org/show_bug.cgi?id=152172
+
+        Reviewed by Brent Fulgham.
+
+        Implement method to set playback rate.
+
+        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
+        (WebCore::MediaPlayerPrivateMediaFoundation::seekDouble):
+        (WebCore::MediaPlayerPrivateMediaFoundation::setRateDouble):
+        (WebCore::MediaPlayerPrivateMediaFoundation::durationDouble):
+        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
+
 2015-12-11  Darin Adler  <darin@apple.com>
 
         Reduce the number of events that can be created by Document.createEvent
index f4d41af..62fb22c 100644 (file)
@@ -216,6 +216,20 @@ void MediaPlayerPrivateMediaFoundation::seekDouble(double time)
     m_player->timeChanged();
 }
 
+void MediaPlayerPrivateMediaFoundation::setRateDouble(double rate)
+{
+    COMPtr<IMFRateControl> rateControl;
+
+    HRESULT hr = MFGetServicePtr()(m_mediaSession.get(), MF_RATE_CONTROL_SERVICE, IID_IMFRateControl, (void**)&rateControl);
+
+    if (!SUCCEEDED(hr))
+        return;
+
+    BOOL reduceSamplesInStream = rate > 2.0;
+
+    rateControl->SetRate(reduceSamplesInStream, rate);
+}
+
 double MediaPlayerPrivateMediaFoundation::durationDouble() const
 {
     if (!m_mediaSource)
index 563f90c..c170989 100644 (file)
@@ -72,6 +72,9 @@ public:
 
     virtual bool seeking() const;
     virtual void seekDouble(double) override;
+
+    virtual void setRateDouble(double) override;
+
     virtual double durationDouble() const override;
 
     virtual float currentTime() const override;