Bug 1581902 - p3: expose H.264 HW availability to AndroidBridge. r=esawin

Also rename existing utility functions to reflect that they are for VP8 only.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
John Lin 2019-10-01 16:55:01 +00:00
Родитель 4015942753
Коммит a5276b6ecb
5 изменённых файлов: 25 добавлений и 18 удалений

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

@ -873,12 +873,12 @@ public class GeckoAppShell {
}
@WrapForJNI(calledFrom = "gecko")
private static boolean getHWEncoderCapability() {
private static boolean hasHWVP8Encoder() {
return HardwareCodecCapabilityUtils.hasHWVP8(true /* aIsEncoder */);
}
@WrapForJNI(calledFrom = "gecko")
private static boolean getHWDecoderCapability() {
private static boolean hasHWVP8Decoder() {
return HardwareCodecCapabilityUtils.hasHWVP8(false /* aIsEncoder */);
}

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

@ -235,22 +235,28 @@ bool AndroidBridge::GetHandlersForMimeType(const nsAString& aMimeType,
return true;
}
bool AndroidBridge::GetHWEncoderCapability() {
ALOG_BRIDGE("AndroidBridge::GetHWEncoderCapability");
bool AndroidBridge::HasHWVP8Encoder() {
ALOG_BRIDGE("AndroidBridge::HasHWVP8Encoder");
bool value = GeckoAppShell::GetHWEncoderCapability();
bool value = GeckoAppShell::HasHWVP8Encoder();
return value;
}
bool AndroidBridge::GetHWDecoderCapability() {
ALOG_BRIDGE("AndroidBridge::GetHWDecoderCapability");
bool AndroidBridge::HasHWVP8Decoder() {
ALOG_BRIDGE("AndroidBridge::HasHWVP8Decoder");
bool value = GeckoAppShell::GetHWDecoderCapability();
bool value = GeckoAppShell::HasHWVP8Decoder();
return value;
}
bool AndroidBridge::HasHWH264() {
ALOG_BRIDGE("AndroidBridge::HasHWH264");
return HardwareCodecCapabilityUtils::HasHWH264();
}
bool AndroidBridge::GetHandlersForURL(const nsAString& aURL,
nsIMutableArray* aHandlersArray,
nsIHandlerApp** aDefaultApp,

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

@ -105,8 +105,9 @@ class AndroidBridge final {
nsIHandlerApp** aDefaultApp = nullptr,
const nsAString& aAction = EmptyString());
bool GetHWEncoderCapability();
bool GetHWDecoderCapability();
bool HasHWVP8Encoder();
bool HasHWVP8Decoder();
bool HasHWH264();
void GetMimeTypeFromExtensions(const nsACString& aFileExt,
nsCString& aMimeType);

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

@ -513,14 +513,14 @@ nsresult GfxInfo::GetFeatureStatusImpl(
if (aFeature == FEATURE_WEBRTC_HW_ACCELERATION_ENCODE) {
if (mozilla::AndroidBridge::Bridge()) {
*aStatus = WebRtcHwEncodeSupported();
*aStatus = WebRtcHwVp8EncodeSupported();
aFailureId = "FEATURE_FAILURE_WEBRTC_ENCODE";
return NS_OK;
}
}
if (aFeature == FEATURE_WEBRTC_HW_ACCELERATION_DECODE) {
if (mozilla::AndroidBridge::Bridge()) {
*aStatus = WebRtcHwDecodeSupported();
*aStatus = WebRtcHwVp8DecodeSupported();
aFailureId = "FEATURE_FAILURE_WEBRTC_DECODE";
return NS_OK;
}
@ -601,7 +601,7 @@ static void SetCachedFeatureVal(int32_t aFeature, uint32_t aOsVer,
Preferences::SetInt(FeatureCacheValuePrefName(aFeature).get(), aStatus);
}
int32_t GfxInfo::WebRtcHwEncodeSupported() {
int32_t GfxInfo::WebRtcHwVp8EncodeSupported() {
MOZ_ASSERT(mozilla::AndroidBridge::Bridge());
// The Android side of this caclulation is very slow, so we cache the result
@ -613,7 +613,7 @@ int32_t GfxInfo::WebRtcHwEncodeSupported() {
return status;
}
status = mozilla::AndroidBridge::Bridge()->GetHWEncoderCapability()
status = mozilla::AndroidBridge::Bridge()->HasHWVP8Encoder()
? nsIGfxInfo::FEATURE_STATUS_OK
: nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
@ -623,7 +623,7 @@ int32_t GfxInfo::WebRtcHwEncodeSupported() {
return status;
}
int32_t GfxInfo::WebRtcHwDecodeSupported() {
int32_t GfxInfo::WebRtcHwVp8DecodeSupported() {
MOZ_ASSERT(mozilla::AndroidBridge::Bridge());
// The Android side of this caclulation is very slow, so we cache the result
@ -635,7 +635,7 @@ int32_t GfxInfo::WebRtcHwDecodeSupported() {
return status;
}
status = mozilla::AndroidBridge::Bridge()->GetHWDecoderCapability()
status = mozilla::AndroidBridge::Bridge()->HasHWVP8Decoder()
? nsIGfxInfo::FEATURE_STATUS_OK
: nsIGfxInfo::FEATURE_BLOCKED_DEVICE;

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

@ -83,8 +83,8 @@ class GfxInfo : public GfxInfoBase {
};
private:
void AddCrashReportAnnotations();
int32_t WebRtcHwEncodeSupported();
int32_t WebRtcHwDecodeSupported();
int32_t WebRtcHwVp8EncodeSupported();
int32_t WebRtcHwVp8DecodeSupported();
bool mInitialized;