Bug 1397307 - P3. Remove unused method. r=gerald
authorJean-Yves Avenard <jyavenard@mozilla.com>
Mon, 11 Sep 2017 17:37:44 +0200
changeset 665551 9d597b2bcf3518432ec8325b07b0a8b85b1666ca
parent 665550 70899b90b6fe4a1be0650318a14ad40bcb604948
child 665552 3fa8d29b3026c85ee6b0e956e2db1a490d0aefc7
push id80115
push userbmo:eoger@fastmail.com
push dateFri, 15 Sep 2017 18:29:01 +0000
reviewersgerald
bugs1397307
milestone57.0a1
Bug 1397307 - P3. Remove unused method. r=gerald Code was incorrect anyway. MozReview-Commit-ID: Bf0O4Mhu1P6
dom/media/platforms/wmf/DXVA2Manager.cpp
dom/media/platforms/wmf/DXVA2Manager.h
--- a/dom/media/platforms/wmf/DXVA2Manager.cpp
+++ b/dom/media/platforms/wmf/DXVA2Manager.cpp
@@ -138,19 +138,16 @@ public:
   // Copies a region (aRegion) of the video frame stored in aVideoSample
   // into an image which is returned by aOutImage.
   HRESULT CopyToImage(IMFSample* aVideoSample,
                       const gfx::IntRect& aRegion,
                       Image** aOutImage) override;
 
   bool SupportsConfig(IMFMediaType* aType, float aFramerate) override;
 
-  bool CreateDXVA2Decoder(const VideoInfo& aVideoInfo,
-                          nsACString& aFailureReason) override;
-
 private:
   bool CanCreateDecoder(const DXVA2_VideoDesc& aDesc,
                         const float aFramerate) const;
 
   already_AddRefed<IDirectXVideoDecoder>
   CreateDecoder(const DXVA2_VideoDesc& aDesc) const;
 
   RefPtr<IDirect3D9Ex> mD3D9;
@@ -539,41 +536,16 @@ DXVA2Manager::CreateD3D9DXVA(layers::Kno
     return d3d9Manager.forget();
   }
 
   // No hardware accelerated video decoding. :(
   return nullptr;
 }
 
 bool
-D3D9DXVA2Manager::CreateDXVA2Decoder(const VideoInfo& aVideoInfo,
-                                     nsACString& aFailureReason)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  DXVA2_VideoDesc desc;
-  desc.SampleWidth = aVideoInfo.mImage.width;
-  desc.SampleHeight = aVideoInfo.mImage.height;
-  desc.Format = (D3DFORMAT)MAKEFOURCC('N','V','1','2');
-
-  // Assume the current duration is representative for the entire video.
-  float framerate = 1000000.0 / aVideoInfo.mDuration.ToMicroseconds();
-  if (IsUnsupportedResolution(desc.SampleWidth, desc.SampleHeight, framerate)) {
-    return false;
-  }
-
-  mDecoder = CreateDecoder(desc);
-  if (!mDecoder) {
-    aFailureReason =
-      nsPrintfCString("Fail to create video decoder in D3D9DXVA2Manager.");
-    return false;
-  }
-  return true;
-}
-
-bool
 D3D9DXVA2Manager::CanCreateDecoder(const DXVA2_VideoDesc& aDesc,
                                    const float aFramerate) const
 {
   MOZ_ASSERT(NS_IsMainThread());
   if (IsUnsupportedResolution(
         aDesc.SampleWidth, aDesc.SampleHeight, aFramerate)) {
     return false;
   }
@@ -653,19 +625,16 @@ public:
                                     ID3D11Texture2D** aOutTexture);
 
   HRESULT ConfigureForSize(uint32_t aWidth, uint32_t aHeight) override;
 
   bool IsD3D11() override { return true; }
 
   bool SupportsConfig(IMFMediaType* aType, float aFramerate) override;
 
-  bool CreateDXVA2Decoder(const VideoInfo& aVideoInfo,
-                          nsACString& aFailureReason) override;
-
 private:
   HRESULT CreateFormatConverter();
 
   HRESULT CreateOutputSample(RefPtr<IMFSample>& aSample,
                              ID3D11Texture2D* aTexture);
 
   bool CanCreateDecoder(const D3D11_VIDEO_DECODER_DESC& aDesc,
                         const float aFramerate) const;
@@ -1179,42 +1148,16 @@ D3D11DXVA2Manager::ConfigureForSize(uint
   NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
 
   mConfiuredForSize = true;
 
   return S_OK;
 }
 
 bool
-D3D11DXVA2Manager::CreateDXVA2Decoder(const VideoInfo& aVideoInfo,
-                                      nsACString& aFailureReason)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  D3D11_VIDEO_DECODER_DESC desc;
-  desc.Guid = mDecoderGUID;
-  desc.OutputFormat = DXGI_FORMAT_NV12;
-  desc.SampleWidth = aVideoInfo.mImage.width;
-  desc.SampleHeight = aVideoInfo.mImage.height;
-
-  // Assume the current duration is representative for the entire video.
-  float framerate = 1000000.0 / aVideoInfo.mDuration.ToMicroseconds();
-  if (IsUnsupportedResolution(desc.SampleWidth, desc.SampleHeight, framerate)) {
-    return false;
-  }
-
-  mDecoder = CreateDecoder(desc);
-  if (!mDecoder) {
-    aFailureReason =
-      nsPrintfCString("Fail to create video decoder in D3D11DXVA2Manager.");
-    return false;
-  }
-  return true;
-}
-
-bool
 D3D11DXVA2Manager::CanCreateDecoder(const D3D11_VIDEO_DECODER_DESC& aDesc,
                                     const float aFramerate) const
 {
   MOZ_ASSERT(NS_IsMainThread());
   if (IsUnsupportedResolution(
         aDesc.SampleWidth, aDesc.SampleHeight, aFramerate)) {
     return false;
   }
--- a/dom/media/platforms/wmf/DXVA2Manager.h
+++ b/dom/media/platforms/wmf/DXVA2Manager.h
@@ -60,22 +60,16 @@ public:
   }
 
   virtual bool IsD3D11() { return false; }
 
   virtual ~DXVA2Manager();
 
   virtual bool SupportsConfig(IMFMediaType* aType, float aFramerate) = 0;
 
-  // When we want to decode with DXVA2 directly instead of using it by MFT, we
-  // need to take responsibility for creating a decoder and handle the related
-  // decoding operations by ourself.
-  virtual bool CreateDXVA2Decoder(const VideoInfo& aVideoInfo,
-                                  nsACString& aFailureReason) = 0;
-
   static bool IsNV12Supported(uint32_t aVendorID,
                               uint32_t aDeviceID,
                               const nsAString& aDriverVersionString);
 
 protected:
   Mutex mLock;
   DXVA2Manager();