зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1681043 - P2. Don't reject outright support for a GPU decoder if compositor isn't known. r=alwu,bryce
When calling PDM::SupportsMimeType not enough information is provided for the PDM to categorically state that a codec isn't supported. Only creating the decoder successfully matters and the PDMFactory only uses the value returned by Support as a hint to further query the PDM. Without this change WMFDecoderModule::SupportsMimeType in the GPU process would always return false as it doesn't know yet the KnownCompositor. Differential Revision: https://phabricator.services.mozilla.com/D100305
This commit is contained in:
Родитель
a68d444ad0
Коммит
1781f8be7f
|
@ -315,6 +315,8 @@ class PlatformDecoderModule {
|
|||
virtual nsresult Startup() { return NS_OK; }
|
||||
|
||||
// Indicates if the PlatformDecoderModule supports decoding of aMimeType.
|
||||
// The answer to both SupportsMimeType and Supports doesn't guarantee that
|
||||
// creation of a decoder will actually succeed.
|
||||
virtual bool SupportsMimeType(
|
||||
const nsACString& aMimeType,
|
||||
DecoderDoctorDiagnostics* aDiagnostics) const = 0;
|
||||
|
|
|
@ -68,15 +68,16 @@ WMFDecoderModule::~WMFDecoderModule() {
|
|||
}
|
||||
}
|
||||
|
||||
static bool IsRemoteAcceleratedCompositor(const SupportDecoderParams& aParams) {
|
||||
if (!aParams.mKnowsCompositor) {
|
||||
static bool IsRemoteAcceleratedCompositor(
|
||||
layers::KnowsCompositor* aKnowsCompositor) {
|
||||
if (!aKnowsCompositor) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TextureFactoryIdentifier ident =
|
||||
aParams.mKnowsCompositor->GetTextureFactoryIdentifier();
|
||||
aKnowsCompositor->GetTextureFactoryIdentifier();
|
||||
return ident.mParentBackend != LayersBackend::LAYERS_BASIC &&
|
||||
!aParams.mKnowsCompositor->UsingSoftwareWebRender() &&
|
||||
!aKnowsCompositor->UsingSoftwareWebRender() &&
|
||||
ident.mParentProcessType == GeckoProcessType_GPU;
|
||||
}
|
||||
|
||||
|
@ -172,6 +173,13 @@ nsresult WMFDecoderModule::Startup() {
|
|||
|
||||
already_AddRefed<MediaDataDecoder> WMFDecoderModule::CreateVideoDecoder(
|
||||
const CreateDecoderParams& aParams) {
|
||||
// In GPU process, only support decoding if an accelerated compositor is
|
||||
// known.
|
||||
if (XRE_IsGPUProcess() &&
|
||||
!IsRemoteAcceleratedCompositor(aParams.mKnowsCompositor)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UniquePtr<WMFVideoMFTManager> manager(new WMFVideoMFTManager(
|
||||
aParams.VideoConfig(), aParams.mKnowsCompositor, aParams.mImageContainer,
|
||||
aParams.mRate.mValue, aParams.mOptions, sDXVAEnabled));
|
||||
|
@ -201,6 +209,11 @@ already_AddRefed<MediaDataDecoder> WMFDecoderModule::CreateVideoDecoder(
|
|||
|
||||
already_AddRefed<MediaDataDecoder> WMFDecoderModule::CreateAudioDecoder(
|
||||
const CreateDecoderParams& aParams) {
|
||||
if (XRE_IsGPUProcess()) {
|
||||
// Only allow video in the GPU process.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UniquePtr<WMFAudioMFTManager> manager(
|
||||
new WMFAudioMFTManager(aParams.AudioConfig()));
|
||||
|
||||
|
@ -285,13 +298,14 @@ bool WMFDecoderModule::SupportsMimeType(
|
|||
|
||||
bool WMFDecoderModule::Supports(const SupportDecoderParams& aParams,
|
||||
DecoderDoctorDiagnostics* aDiagnostics) const {
|
||||
// In GPU process, only support decoding if an accelerated compositor is
|
||||
// known.
|
||||
if (XRE_IsGPUProcess() && !IsRemoteAcceleratedCompositor(aParams)) {
|
||||
// In GPU process, only support decoding if video. This only gives a hint of
|
||||
// what the GPU decoder *may* support. The actual check will occur in
|
||||
// CreateVideoDecoder.
|
||||
const auto& trackInfo = aParams.mConfig;
|
||||
if (XRE_IsGPUProcess() && !trackInfo.GetAsVideoInfo()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto& trackInfo = aParams.mConfig;
|
||||
const auto* videoInfo = trackInfo.GetAsVideoInfo();
|
||||
// Temporary - forces use of VPXDecoder when alpha is present.
|
||||
// Bug 1263836 will handle alpha scenario once implemented. It will shift
|
||||
|
|
Загрузка…
Ссылка в новой задаче