зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1898344 - part5 : implement MediaCapabilitiesDecodingInfo. r=media-playback-reviewers,webidl,smaug,padenot
This patch implement a MediaKeySystemAccess in MediaCapabilitiesDecodingInfo per spec [1], but we haven't implemented the configuration part yet. Currently Chromium doesn't implement the configuration [2] and WebKit [3] only implements the configuration but no key system access. [1] https://www.w3.org/TR/media-capabilities/#media-capabilities-interface [2] https://bit.ly/3RcwuaV [3] https://searchfox.org/wubkat/source/Source/WebCore/Modules/mediacapabilities/MediaCapabilitiesDecodingInfo.idl Differential Revision: https://phabricator.services.mozilla.com/D212324
This commit is contained in:
Родитель
f8b78ad4f4
Коммит
25e584800a
|
@ -200,7 +200,7 @@ void MediaCapabilities::CreateMediaCapabilitiesDecodingInfo(
|
|||
}
|
||||
|
||||
if (!supported) {
|
||||
MediaCapabilitiesInfo info;
|
||||
MediaCapabilitiesDecodingInfo info;
|
||||
info.mSupported = false;
|
||||
info.mSmooth = false;
|
||||
info.mPowerEfficient = false;
|
||||
|
@ -256,6 +256,9 @@ void MediaCapabilities::CreateMediaCapabilitiesDecodingInfo(
|
|||
tracks.AppendElements(std::move(audioTracks));
|
||||
}
|
||||
|
||||
// TODO : implement 'Check Encrypted Decoding Support'
|
||||
// https://www.w3.org/TR/media-capabilities/#is-encrypted-decode-supported
|
||||
|
||||
using CapabilitiesPromise = MozPromise<MediaCapabilitiesInfo, MediaResult,
|
||||
/* IsExclusive = */ true>;
|
||||
nsTArray<RefPtr<CapabilitiesPromise>> promises;
|
||||
|
@ -283,7 +286,7 @@ void MediaCapabilities::CreateMediaCapabilitiesDecodingInfo(
|
|||
return CapabilitiesPromise::CreateAndReject(NS_ERROR_FAILURE,
|
||||
__func__);
|
||||
}
|
||||
MediaCapabilitiesInfo info;
|
||||
MediaCapabilitiesDecodingInfo info;
|
||||
info.mSupported = true;
|
||||
info.mSmooth = true;
|
||||
info.mPowerEfficient = true;
|
||||
|
@ -358,7 +361,7 @@ void MediaCapabilities::CreateMediaCapabilitiesDecodingInfo(
|
|||
p = CapabilitiesPromise::CreateAndReject(
|
||||
std::move(aValue.RejectValue()), __func__);
|
||||
} else if (shouldResistFingerprinting) {
|
||||
MediaCapabilitiesInfo info;
|
||||
MediaCapabilitiesDecodingInfo info;
|
||||
info.mSupported = true;
|
||||
info.mSmooth = true;
|
||||
info.mPowerEfficient = false;
|
||||
|
@ -386,7 +389,7 @@ void MediaCapabilities::CreateMediaCapabilitiesDecodingInfo(
|
|||
bool smooth = score < 0 || score >
|
||||
StaticPrefs::
|
||||
media_mediacapabilities_drop_threshold();
|
||||
MediaCapabilitiesInfo info;
|
||||
MediaCapabilitiesDecodingInfo info;
|
||||
info.mSupported = true;
|
||||
info.mSmooth = smooth;
|
||||
info.mPowerEfficient = powerEfficient;
|
||||
|
@ -404,7 +407,7 @@ void MediaCapabilities::CreateMediaCapabilitiesDecodingInfo(
|
|||
// decoding is hardware accelerated it will be
|
||||
// smooth and power efficient, otherwise we use
|
||||
// the benchmark to estimate
|
||||
MediaCapabilitiesInfo info;
|
||||
MediaCapabilitiesDecodingInfo info;
|
||||
info.mSupported = true;
|
||||
info.mSmooth = true;
|
||||
info.mPowerEfficient = true;
|
||||
|
@ -436,7 +439,7 @@ void MediaCapabilities::CreateMediaCapabilitiesDecodingInfo(
|
|||
smooth = needed > 2;
|
||||
}
|
||||
}
|
||||
MediaCapabilitiesInfo info;
|
||||
MediaCapabilitiesDecodingInfo info;
|
||||
info.mSupported = true;
|
||||
info.mSmooth = smooth;
|
||||
info.mPowerEfficient = powerEfficient;
|
||||
|
@ -494,7 +497,7 @@ void MediaCapabilities::CreateMediaCapabilitiesDecodingInfo(
|
|||
aValue) {
|
||||
holder->Complete();
|
||||
if (aValue.IsReject()) {
|
||||
MediaCapabilitiesInfo info;
|
||||
MediaCapabilitiesDecodingInfo info;
|
||||
info.mSupported = false;
|
||||
info.mSmooth = false;
|
||||
info.mPowerEfficient = false;
|
||||
|
@ -510,7 +513,7 @@ void MediaCapabilities::CreateMediaCapabilitiesDecodingInfo(
|
|||
smooth &= capability.mSmooth;
|
||||
powerEfficient &= capability.mPowerEfficient;
|
||||
}
|
||||
MediaCapabilitiesInfo info;
|
||||
MediaCapabilitiesDecodingInfo info;
|
||||
info.mSupported = true;
|
||||
info.mSmooth = smooth;
|
||||
info.mPowerEfficient = powerEfficient;
|
||||
|
|
|
@ -94,10 +94,17 @@ dictionary MediaCapabilitiesInfo {
|
|||
required boolean powerEfficient;
|
||||
};
|
||||
|
||||
// https://w3c.github.io/media-capabilities/#dictdef-mediacapabilitiesinfo
|
||||
dictionary MediaCapabilitiesDecodingInfo : MediaCapabilitiesInfo {
|
||||
// This doesn't match the spec, see https://github.com/w3c/media-capabilities/issues/219
|
||||
required MediaKeySystemAccess? keySystemAccess;
|
||||
// TODO : implement configuration
|
||||
};
|
||||
|
||||
[Exposed=(Window, Worker)]
|
||||
interface MediaCapabilities {
|
||||
[NewObject]
|
||||
Promise<MediaCapabilitiesInfo> decodingInfo(MediaDecodingConfiguration configuration);
|
||||
Promise<MediaCapabilitiesDecodingInfo> decodingInfo(MediaDecodingConfiguration configuration);
|
||||
[NewObject]
|
||||
Promise<MediaCapabilitiesInfo> encodingInfo(MediaEncodingConfiguration configuration);
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче