mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 1510424 - fix AAC and FLAC EME support configuration. r=jya
Differential Revision: https://phabricator.services.mozilla.com/D13135 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
60a7065bec
commit
eb4a57903b
@ -34,6 +34,7 @@
|
||||
#include "mozilla/dom/MediaSource.h"
|
||||
#include "DecoderTraits.h"
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
#include "AndroidDecoderModule.h"
|
||||
#include "FennecJNIWrappers.h"
|
||||
#include "GeneratedJNIWrappers.h"
|
||||
#endif
|
||||
@ -309,9 +310,9 @@ static nsTArray<KeySystemConfig> GetSupportedKeySystems() {
|
||||
}
|
||||
#elif !defined(MOZ_WIDGET_ANDROID)
|
||||
widevine.mMP4.SetCanDecrypt(EME_CODEC_AAC);
|
||||
#endif
|
||||
widevine.mMP4.SetCanDecrypt(EME_CODEC_FLAC);
|
||||
widevine.mMP4.SetCanDecrypt(EME_CODEC_OPUS);
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
using namespace mozilla::java;
|
||||
@ -351,7 +352,7 @@ static nsTArray<KeySystemConfig> GetSupportedKeySystems() {
|
||||
for (const auto& data : validationList) {
|
||||
if (MediaDrmProxy::IsCryptoSchemeSupported(kEMEKeySystemWidevine,
|
||||
data.mMimeType)) {
|
||||
if (MediaDrmProxy::CanDecode(data.mCodecType)) {
|
||||
if (AndroidDecoderModule::SupportsMimeType(data.mMimeType)) {
|
||||
data.mSupportType->SetCanDecryptAndDecode(data.mEMECodecType);
|
||||
} else {
|
||||
data.mSupportType->SetCanDecrypt(data.mEMECodecType);
|
||||
|
@ -40,6 +40,7 @@ UNIFIED_SOURCES += [
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
|
||||
DIRS += ['mediadrm']
|
||||
LOCAL_INCLUDES += ['/dom/media/platforms/android']
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
|
@ -21,6 +21,9 @@
|
||||
MOZ_LOG( \
|
||||
sAndroidDecoderModuleLog, mozilla::LogLevel::Debug, \
|
||||
("AndroidDecoderModule(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
|
||||
#define SLOG(arg, ...) \
|
||||
MOZ_LOG(sAndroidDecoderModuleLog, mozilla::LogLevel::Debug, \
|
||||
("%s: " arg, __func__, ##__VA_ARGS__))
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::gl;
|
||||
@ -57,8 +60,7 @@ AndroidDecoderModule::AndroidDecoderModule(CDMProxy* aProxy) {
|
||||
mProxy = static_cast<MediaDrmCDMProxy*>(aProxy);
|
||||
}
|
||||
|
||||
bool AndroidDecoderModule::SupportsMimeType(
|
||||
const nsACString& aMimeType, DecoderDoctorDiagnostics* aDiagnostics) const {
|
||||
bool AndroidDecoderModule::SupportsMimeType(const nsACString& aMimeType) {
|
||||
if (jni::GetAPIVersion() < 16) {
|
||||
return false;
|
||||
}
|
||||
@ -92,14 +94,14 @@ bool AndroidDecoderModule::SupportsMimeType(
|
||||
if (OpusDataDecoder::IsOpus(aMimeType) ||
|
||||
VorbisDataDecoder::IsVorbis(aMimeType) ||
|
||||
aMimeType.EqualsLiteral("audio/flac")) {
|
||||
LOG("Rejecting audio of type %s", aMimeType.Data());
|
||||
SLOG("Rejecting audio of type %s", aMimeType.Data());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prefer the gecko decoder for Theora.
|
||||
// Not all android devices support Theora even when they say they do.
|
||||
if (TheoraDecoder::IsTheora(aMimeType)) {
|
||||
LOG("Rejecting video of type %s", aMimeType.Data());
|
||||
SLOG("Rejecting video of type %s", aMimeType.Data());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -107,6 +109,11 @@ bool AndroidDecoderModule::SupportsMimeType(
|
||||
TranslateMimeType(aMimeType));
|
||||
}
|
||||
|
||||
bool AndroidDecoderModule::SupportsMimeType(
|
||||
const nsACString& aMimeType, DecoderDoctorDiagnostics* aDiagnostics) const {
|
||||
return AndroidDecoderModule::SupportsMimeType(aMimeType);
|
||||
}
|
||||
|
||||
already_AddRefed<MediaDataDecoder> AndroidDecoderModule::CreateVideoDecoder(
|
||||
const CreateDecoderParams& aParams) {
|
||||
// Temporary - forces use of VPXDecoder when alpha is present.
|
||||
|
@ -23,6 +23,8 @@ class AndroidDecoderModule : public PlatformDecoderModule {
|
||||
bool SupportsMimeType(const nsACString& aMimeType,
|
||||
DecoderDoctorDiagnostics* aDiagnostics) const override;
|
||||
|
||||
static bool SupportsMimeType(const nsACString& aMimeType);
|
||||
|
||||
private:
|
||||
virtual ~AndroidDecoderModule() {}
|
||||
RefPtr<MediaDrmCDMProxy> mProxy;
|
||||
|
@ -82,23 +82,6 @@ public final class MediaDrmProxy {
|
||||
return false;
|
||||
}
|
||||
|
||||
@WrapForJNI
|
||||
public static boolean CanDecode(String mimeType) {
|
||||
for (int i = 0; i < MediaCodecList.getCodecCount(); ++i) {
|
||||
MediaCodecInfo info = MediaCodecList.getCodecInfoAt(i);
|
||||
if (info.isEncoder()) {
|
||||
continue;
|
||||
}
|
||||
for (String m : info.getSupportedTypes()) {
|
||||
if (m.equals(mimeType)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (DEBUG) Log.d(LOGTAG, "cannot decode mimetype = " + mimeType);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Interface for callback to native.
|
||||
public interface Callbacks {
|
||||
void onSessionCreated(int createSessionToken,
|
||||
|
Loading…
Reference in New Issue
Block a user