Bug 1496529 - P7. Pass full range of CreateDecoderParam::Option to RemoteVideoDecoder r=bryce

Depends on D7882

Differential Revision: https://phabricator.services.mozilla.com/D7895

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jean-Yves Avenard 2018-10-09 16:59:24 +00:00
Родитель 38ff84370c
Коммит 2349b2eb93
11 изменённых файлов: 77 добавлений и 56 удалений

Просмотреть файл

@ -9,6 +9,8 @@ include LayersSurfaces;
include "mozilla/dom/MediaIPCUtils.h";
using VideoInfo from "MediaInfo.h";
using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
using mozilla::CreateDecoderParams::Option from "PlatformDecoderModule.h";
using mozilla::CreateDecoderParams::OptionSet from "PlatformDecoderModule.h";
namespace mozilla {
namespace dom {
@ -23,7 +25,7 @@ parent:
// more sync IPC call.
// Considering that this information is only used for telemetry usage in bug 1393392 and should be removed once
// we have collected enough data, we add these two return values here for convenience.
sync PVideoDecoder(VideoInfo info, float framerate, bool disallowHWDecoder, TextureFactoryIdentifier identifier)
sync PVideoDecoder(VideoInfo info, float framerate, OptionSet options, TextureFactoryIdentifier identifier)
returns (bool success,
nsCString aBlacklistedD3D11Driver,
nsCString aBlacklistedD3D9Driver,

Просмотреть файл

@ -192,8 +192,7 @@ RemoteDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams)
result = object->mActor->InitIPDL(
aParams.VideoConfig(),
aParams.mRate.mValue,
aParams.mOptions.contains(
CreateDecoderParams::Option::HardwareDecoderNotAllowed),
aParams.mOptions,
aParams.mKnowsCompositor->GetTextureFactoryIdentifier());
}),
NS_DISPATCH_NORMAL);

Просмотреть файл

@ -177,7 +177,7 @@ VideoDecoderChild::ActorDestroy(ActorDestroyReason aWhy)
MediaResult
VideoDecoderChild::InitIPDL(const VideoInfo& aVideoInfo,
float aFramerate,
bool aDisallowHWDecoder,
const CreateDecoderParams::OptionSet& aOptions,
const layers::TextureFactoryIdentifier& aIdentifier)
{
RefPtr<VideoDecoderManagerChild> manager =
@ -207,7 +207,7 @@ VideoDecoderChild::InitIPDL(const VideoInfo& aVideoInfo,
if (manager->SendPVideoDecoderConstructor(this,
aVideoInfo,
aFramerate,
aDisallowHWDecoder,
aOptions,
aIdentifier,
&success,
&mBlacklistedD3D11Driver,

Просмотреть файл

@ -51,7 +51,7 @@ public:
MOZ_IS_CLASS_INIT
MediaResult InitIPDL(const VideoInfo& aVideoInfo,
float aFramerate,
bool aDisallowHWDecoder,
const CreateDecoderParams::OptionSet& aOptions,
const layers::TextureFactoryIdentifier& aIdentifier);
void DestroyIPDL();

Просмотреть файл

@ -116,14 +116,15 @@ VideoDecoderManagerChild::GetManagerAbstractThread()
}
PVideoDecoderChild*
VideoDecoderManagerChild::AllocPVideoDecoderChild(const VideoInfo& aVideoInfo,
const float& aFramerate,
const bool& aDisallowHWDecoder,
const layers::TextureFactoryIdentifier& aIdentifier,
bool* aSuccess,
nsCString* /* not used */,
nsCString* /* not used */,
nsCString* /* not used */)
VideoDecoderManagerChild::AllocPVideoDecoderChild(
const VideoInfo& aVideoInfo,
const float& aFramerate,
const CreateDecoderParams::OptionSet& aOptions,
const layers::TextureFactoryIdentifier& aIdentifier,
bool* aSuccess,
nsCString* /* not used */,
nsCString* /* not used */,
nsCString* /* not used */)
{
return new VideoDecoderChild();
}

Просмотреть файл

@ -70,14 +70,15 @@ protected:
void HandleFatalError(const char* aMsg) const override;
PVideoDecoderChild* AllocPVideoDecoderChild(const VideoInfo& aVideoInfo,
const float& aFramerate,
const bool& aDisallowHWDecoder,
const layers::TextureFactoryIdentifier& aIdentifier,
bool* aSuccess,
nsCString* aBlacklistedD3D11Driver,
nsCString* aBlacklistedD3D9Driver,
nsCString* aErrorDescription) override;
PVideoDecoderChild* AllocPVideoDecoderChild(
const VideoInfo& aVideoInfo,
const float& aFramerate,
const CreateDecoderParams::OptionSet& aOptions,
const layers::TextureFactoryIdentifier& aIdentifier,
bool* aSuccess,
nsCString* aBlacklistedD3D11Driver,
nsCString* aBlacklistedD3D9Driver,
nsCString* aErrorDescription) override;
bool DeallocPVideoDecoderChild(PVideoDecoderChild* actor) override;
private:

Просмотреть файл

@ -201,22 +201,29 @@ VideoDecoderManagerParent::ActorDestroy(mozilla::ipc::IProtocol::ActorDestroyRea
}
PVideoDecoderParent*
VideoDecoderManagerParent::AllocPVideoDecoderParent(const VideoInfo& aVideoInfo,
const float& aFramerate,
const bool& aDisallowHWDecoder,
const layers::TextureFactoryIdentifier& aIdentifier,
bool* aSuccess,
nsCString* aBlacklistedD3D11Driver,
nsCString* aBlacklistedD3D9Driver,
nsCString* aErrorDescription)
VideoDecoderManagerParent::AllocPVideoDecoderParent(
const VideoInfo& aVideoInfo,
const float& aFramerate,
const CreateDecoderParams::OptionSet& aOptions,
const layers::TextureFactoryIdentifier& aIdentifier,
bool* aSuccess,
nsCString* aBlacklistedD3D11Driver,
nsCString* aBlacklistedD3D9Driver,
nsCString* aErrorDescription)
{
RefPtr<TaskQueue> decodeTaskQueue = new TaskQueue(
GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER),
"VideoDecoderParent::mDecodeTaskQueue");
RefPtr<TaskQueue> decodeTaskQueue =
new TaskQueue(GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER),
"VideoDecoderParent::mDecodeTaskQueue");
auto* parent = new VideoDecoderParent(
this, aVideoInfo, aFramerate, aDisallowHWDecoder, aIdentifier,
sManagerTaskQueue, decodeTaskQueue, aSuccess, aErrorDescription);
auto* parent = new VideoDecoderParent(this,
aVideoInfo,
aFramerate,
aOptions,
aIdentifier,
sManagerTaskQueue,
decodeTaskQueue,
aSuccess,
aErrorDescription);
#ifdef XP_WIN
*aBlacklistedD3D11Driver = GetFoundD3D11BlacklistedDLL();

Просмотреть файл

@ -31,14 +31,15 @@ public:
bool OnManagerThread();
protected:
PVideoDecoderParent* AllocPVideoDecoderParent(const VideoInfo& aVideoInfo,
const float& aFramerate,
const bool& aDisallowHWDecoder,
const layers::TextureFactoryIdentifier& aIdentifier,
bool* aSuccess,
nsCString* aBlacklistedD3D11Driver,
nsCString* aBlacklistedD3D9Driver,
nsCString* aErrorDescription) override;
PVideoDecoderParent* AllocPVideoDecoderParent(
const VideoInfo& aVideoInfo,
const float& aFramerate,
const CreateDecoderParams::OptionSet& aOptions,
const layers::TextureFactoryIdentifier& aIdentifier,
bool* aSuccess,
nsCString* aBlacklistedD3D11Driver,
nsCString* aBlacklistedD3D9Driver,
nsCString* aErrorDescription) override;
bool DeallocPVideoDecoderParent(PVideoDecoderParent* actor) override;
mozilla::ipc::IPCResult RecvReadback(const SurfaceDescriptorGPUVideo& aSD, SurfaceDescriptor* aResult) override;

Просмотреть файл

@ -42,15 +42,16 @@ private:
virtual ~KnowsCompositorVideo() = default;
};
VideoDecoderParent::VideoDecoderParent(VideoDecoderManagerParent* aParent,
const VideoInfo& aVideoInfo,
float aFramerate,
bool aDisallowHWDecoder,
const layers::TextureFactoryIdentifier& aIdentifier,
TaskQueue* aManagerTaskQueue,
TaskQueue* aDecodeTaskQueue,
bool* aSuccess,
nsCString* aErrorDescription)
VideoDecoderParent::VideoDecoderParent(
VideoDecoderManagerParent* aParent,
const VideoInfo& aVideoInfo,
float aFramerate,
const CreateDecoderParams::OptionSet& aOptions,
const layers::TextureFactoryIdentifier& aIdentifier,
TaskQueue* aManagerTaskQueue,
TaskQueue* aDecodeTaskQueue,
bool* aSuccess,
nsCString* aErrorDescription)
: mParent(aParent)
, mManagerTaskQueue(aManagerTaskQueue)
, mDecodeTaskQueue(aDecodeTaskQueue)
@ -82,8 +83,7 @@ VideoDecoderParent::VideoDecoderParent(VideoDecoderManagerParent* aParent,
params.mKnowsCompositor = mKnowsCompositor;
params.mImageContainer = new layers::ImageContainer();
params.mRate = CreateDecoderParams::VideoFrameRate(aFramerate);
params.mOptions = OptionSet(
aDisallowHWDecoder ? Option::HardwareDecoderNotAllowed : Option::Default);
params.mOptions = aOptions;
MediaResult error(NS_OK);
params.mError = &error;

Просмотреть файл

@ -29,7 +29,7 @@ public:
VideoDecoderParent(VideoDecoderManagerParent* aParent,
const VideoInfo& aVideoInfo,
float aFramerate,
bool aDisallowHWDecoder,
const CreateDecoderParams::OptionSet& aOptions,
const layers::TextureFactoryIdentifier& aIdentifier,
TaskQueue* aManagerTaskQueue,
TaskQueue* aDecodeTaskQueue,

Просмотреть файл

@ -13,6 +13,7 @@
#include "MediaInfo.h"
#include "MediaResult.h"
#include "mozilla/EnumSet.h"
#include "mozilla/EnumTypeTraits.h"
#include "mozilla/MozPromise.h"
#include "mozilla/RefPtr.h"
#include "mozilla/TaskQueue.h"
@ -159,6 +160,15 @@ private:
}
};
// Used for IPDL serialization.
// The 'value' have to be the biggest enum from CreateDecoderParams::Option.
template <>
struct MaxEnumValue<::mozilla::CreateDecoderParams::Option>
{
static constexpr unsigned int value = static_cast<unsigned int>(CreateDecoderParams::Option::HardwareDecoderNotAllowed);
};
// The PlatformDecoderModule interface is used by the MediaFormatReader to
// abstract access to decoders provided by various
// platforms.