зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1665776 - p5: add VPx support to AndroidEncoderModule. r=alwu
Differential Revision: https://phabricator.services.mozilla.com/D121022
This commit is contained in:
Родитель
e333ebc5a4
Коммит
cbb3b7b6c4
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "AndroidDataEncoder.h"
|
||||
#include "MP4Decoder.h"
|
||||
#include "VPXDecoder.h"
|
||||
|
||||
#include "mozilla/Logging.h"
|
||||
|
||||
|
@ -17,14 +18,34 @@ extern LazyLogModule sPEMLog;
|
|||
("AndroidEncoderModule(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
|
||||
|
||||
bool AndroidEncoderModule::SupportsMimeType(const nsACString& aMimeType) const {
|
||||
return MP4Decoder::IsH264(aMimeType);
|
||||
return (MP4Decoder::IsH264(aMimeType) &&
|
||||
java::HardwareCodecCapabilityUtils::HasHWH264(true /* encoder */)) ||
|
||||
(VPXDecoder::IsVP8(aMimeType) &&
|
||||
java::HardwareCodecCapabilityUtils::HasHWVP8(true /* encoder */)) ||
|
||||
(VPXDecoder::IsVP9(aMimeType) &&
|
||||
java::HardwareCodecCapabilityUtils::HasHWVP9(true /* encoder */));
|
||||
}
|
||||
|
||||
already_AddRefed<MediaDataEncoder> AndroidEncoderModule::CreateVideoEncoder(
|
||||
const CreateEncoderParams& aParams) const {
|
||||
RefPtr<MediaDataEncoder> encoder =
|
||||
new AndroidDataEncoder(aParams.ToH264Config(), aParams.mTaskQueue);
|
||||
return encoder.forget();
|
||||
RefPtr<MediaDataEncoder> encoder;
|
||||
switch (CreateEncoderParams::CodecTypeForMime(aParams.mConfig.mMimeType)) {
|
||||
case MediaDataEncoder::CodecType::H264:
|
||||
return MakeRefPtr<AndroidDataEncoder<MediaDataEncoder::H264Config>>(
|
||||
aParams.ToH264Config(), aParams.mTaskQueue)
|
||||
.forget();
|
||||
case MediaDataEncoder::CodecType::VP8:
|
||||
return MakeRefPtr<AndroidDataEncoder<MediaDataEncoder::VP8Config>>(
|
||||
aParams.ToVP8Config(), aParams.mTaskQueue)
|
||||
.forget();
|
||||
case MediaDataEncoder::CodecType::VP9:
|
||||
return MakeRefPtr<AndroidDataEncoder<MediaDataEncoder::VP9Config>>(
|
||||
aParams.ToVP9Config(), aParams.mTaskQueue)
|
||||
.forget();
|
||||
default:
|
||||
AND_PEM_LOG("Unsupported MIME type:%s", aParams.mConfig.mMimeType.get());
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -225,6 +225,7 @@ public final class HardwareCodecCapabilityUtils {
|
|||
return null;
|
||||
}
|
||||
|
||||
@WrapForJNI
|
||||
public static boolean hasHWVP8(final boolean aIsEncoder) {
|
||||
return getHWCodecCapability(VP8_MIME_TYPE, aIsEncoder);
|
||||
}
|
||||
|
@ -234,6 +235,11 @@ public final class HardwareCodecCapabilityUtils {
|
|||
return getHWCodecCapability(VP9_MIME_TYPE, aIsEncoder);
|
||||
}
|
||||
|
||||
@WrapForJNI
|
||||
public static boolean hasHWH264(final boolean aIsEncoder) {
|
||||
return getHWCodecCapability(H264_MIME_TYPE, aIsEncoder);
|
||||
}
|
||||
|
||||
@WrapForJNI(calledFrom = "gecko")
|
||||
public static boolean hasHWH264() {
|
||||
return getHWCodecCapability(H264_MIME_TYPE, true) &&
|
||||
|
|
Загрузка…
Ссылка в новой задаче