bool
WMFDecoderModule::SupportsSharedDecoders(const VideoInfo& aConfig) const
{
    // If DXVA is enabled, but we're not going to use it for this specific config, then
    // we can't use the shared decoder.
    return !sDXVAEnabled || ShouldUseDXVA(aConfig);
}
already_AddRefed<MediaDataDecoder>
WMFDecoderModule::CreateVideoDecoder(const VideoInfo& aConfig,
                                     layers::LayersBackend aLayersBackend,
                                     layers::ImageContainer* aImageContainer,
                                     FlushableMediaTaskQueue* aVideoTaskQueue,
                                     MediaDataDecoderCallback* aCallback)
{
    nsRefPtr<MediaDataDecoder> decoder =
        new WMFMediaDataDecoder(new WMFVideoMFTManager(aConfig,
                                aLayersBackend,
                                aImageContainer,
                                sDXVAEnabled && ShouldUseDXVA(aConfig)),
                                aVideoTaskQueue,
                                aCallback);
    return decoder.forget();
}
already_AddRefed<MediaDataDecoder>
WMFDecoderModule::CreateVideoDecoder(const VideoInfo& aConfig,
                                     layers::LayersBackend aLayersBackend,
                                     layers::ImageContainer* aImageContainer,
                                     FlushableTaskQueue* aVideoTaskQueue,
                                     MediaDataDecoderCallback* aCallback)
{
  nsAutoPtr<WMFVideoMFTManager> manager =
    new WMFVideoMFTManager(aConfig,
                           aLayersBackend,
                           aImageContainer,
                           sDXVAEnabled && ShouldUseDXVA(aConfig));

  nsRefPtr<MFTDecoder> mft = manager->Init();

  if (!mft) {
    return nullptr;
  }

  nsRefPtr<MediaDataDecoder> decoder =
    new WMFMediaDataDecoder(manager.forget(), mft, aVideoTaskQueue, aCallback);

  return decoder.forget();
}