[WinCairo][MediaFoundation] Release Direct3D swap chain object earlier.
authorpeavo@outlook.com <peavo@outlook.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Dec 2015 20:57:20 +0000 (20:57 +0000)
committerpeavo@outlook.com <peavo@outlook.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Dec 2015 20:57:20 +0000 (20:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=152392

Reviewed by Alex Christensen.

Since we don't use the swap chain object to render the video to a window,
but render frames to Cairo bitmaps, we can let go of the swap chain object
earlier than we currently do.

* platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
(WebCore::clearDesiredSampleTime):
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::createVideoSamples):

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

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

index 5f1ad02..dce6b68 100644 (file)
@@ -1,3 +1,18 @@
+2015-12-17  Per Arne Vollan  <peavo@outlook.com>
+
+        [WinCairo][MediaFoundation] Release Direct3D swap chain object earlier.
+        https://bugs.webkit.org/show_bug.cgi?id=152392
+
+        Reviewed by Alex Christensen.
+
+        Since we don't use the swap chain object to render the video to a window,
+        but render frames to Cairo bitmaps, we can let go of the swap chain object
+        earlier than we currently do. 
+
+        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
+        (WebCore::clearDesiredSampleTime):
+        (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::createVideoSamples):
+
 2015-12-17  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r194201.
 2015-12-17  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r194201.
index daa8385..a038516 100644 (file)
@@ -78,13 +78,6 @@ SOFT_LINK_OPTIONAL(D3d9, Direct3DCreate9Ex, HRESULT, STDAPICALLTYPE, (UINT, IDir
 static const GUID MFSamplePresenterSampleCounter =
 { 0x869f1f7c, 0x3496, 0x48a9, { 0x88, 0xe3, 0x69, 0x85, 0x79, 0xd0, 0x8c, 0xb6 } };
 
 static const GUID MFSamplePresenterSampleCounter =
 { 0x869f1f7c, 0x3496, 0x48a9, { 0x88, 0xe3, 0x69, 0x85, 0x79, 0xd0, 0x8c, 0xb6 } };
 
-// MFSamplePresenterSampleSwapChain
-// Data type: IUNKNOWN
-// 
-// Pointer to a Direct3D swap chain.
-static const GUID MFSamplePresenterSampleSwapChain =
-{ 0x24a2e076, 0x3673, 0x433d, { 0x87, 0x4, 0x55, 0x2b, 0x1f, 0x5c, 0x16, 0x8c } };
-
 static const double tenMegahertz = 10000000;
 
 namespace WebCore {
 static const double tenMegahertz = 10000000;
 
 namespace WebCore {
@@ -1857,9 +1850,6 @@ static HRESULT clearDesiredSampleTime(IMFSample* sample)
 
     UINT32 counter = MFGetAttributeUINT32(sample, MFSamplePresenterSampleCounter, (UINT32)-1);
 
 
     UINT32 counter = MFGetAttributeUINT32(sample, MFSamplePresenterSampleCounter, (UINT32)-1);
 
-    COMPtr<IUnknown> swapChain;
-    sample->GetUnknown(MFSamplePresenterSampleSwapChain, IID_IUnknown, (void**)&swapChain);
-
     COMPtr<IMFDesiredSample> desired;
     HRESULT hr = sample->QueryInterface(__uuidof(IMFDesiredSample), (void**)&desired);
     if (SUCCEEDED(hr)) {
     COMPtr<IMFDesiredSample> desired;
     HRESULT hr = sample->QueryInterface(__uuidof(IMFDesiredSample), (void**)&desired);
     if (SUCCEEDED(hr)) {
@@ -1868,12 +1858,6 @@ static HRESULT clearDesiredSampleTime(IMFSample* sample)
         hr = sample->SetUINT32(MFSamplePresenterSampleCounter, counter);
         if (FAILED(hr))
             return hr;
         hr = sample->SetUINT32(MFSamplePresenterSampleCounter, counter);
         if (FAILED(hr))
             return hr;
-
-        if (swapChain) {
-            hr = sample->SetUnknown(MFSamplePresenterSampleSwapChain, swapChain.get());
-            if (FAILED(hr))
-                return hr;
-        }
     }
 
     return hr;
     }
 
     return hr;
@@ -2607,13 +2591,6 @@ HRESULT MediaPlayerPrivateMediaFoundation::Direct3DPresenter::createVideoSamples
         }
 
         videoSampleQueue.append(videoSample);
         }
 
         videoSampleQueue.append(videoSample);
-
-        // Keep the swap chain alive by setting it as a custom attribute on the sample.
-        hr = videoSample->SetUnknown(MFSamplePresenterSampleSwapChain, swapChain.get());
-        if (FAILED(hr)) {
-            releaseResources();
-            return hr;
-        }
     }
 
     return hr;
     }
 
     return hr;