From 22e9b1e4ccb65362f1cb9bb5c2a2b81bcab6b1be Mon Sep 17 00:00:00 2001 From: James Willcox Date: Tue, 11 Apr 2017 10:16:48 -0500 Subject: [PATCH] Bug 1322650 - Don't use AndroidBridge to get API version in media stack r=jolin AndroidBridge is not available in child processes. MozReview-Commit-ID: KlBs8F1Bu1O --- dom/media/MediaDecoder.cpp | 3 +-- dom/media/MediaPrefs.h | 5 ++--- dom/media/platforms/android/AndroidDecoderModule.cpp | 6 ++---- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index 588d07a58db5..83f32a0f6e40 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -1640,8 +1640,7 @@ MediaDecoder::IsWebMEnabled() bool MediaDecoder::IsAndroidMediaPluginEnabled() { - return AndroidBridge::Bridge() - && AndroidBridge::Bridge()->GetAPIVersion() < 16 + return jni::GetAPIVersion() < 16 && Preferences::GetBool("media.plugins.enabled"); } #endif diff --git a/dom/media/MediaPrefs.h b/dom/media/MediaPrefs.h index d86082e331be..196746710904 100644 --- a/dom/media/MediaPrefs.h +++ b/dom/media/MediaPrefs.h @@ -7,7 +7,7 @@ #define MEDIA_PREFS_H #ifdef MOZ_WIDGET_ANDROID -#include "AndroidBridge.h" +#include "GeneratedJNIWrappers.h" #endif #include "mozilla/Atomics.h" @@ -199,8 +199,7 @@ private: static int32_t MediaDecoderLimitDefault() { #ifdef MOZ_WIDGET_ANDROID - if (AndroidBridge::Bridge() && - AndroidBridge::Bridge()->GetAPIVersion() < 18) { + if (jni::GetAPIVersion() < 18) { // Older Android versions have broken support for multiple simultaneous // decoders, see bug 1278574. return 1; diff --git a/dom/media/platforms/android/AndroidDecoderModule.cpp b/dom/media/platforms/android/AndroidDecoderModule.cpp index 673a94b16c7b..3ea51005704b 100644 --- a/dom/media/platforms/android/AndroidDecoderModule.cpp +++ b/dom/media/platforms/android/AndroidDecoderModule.cpp @@ -2,8 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "AndroidDecoderModule.h" -#include "AndroidBridge.h" +#include "GeneratedJNIWrappers.h" #include "MediaInfo.h" #include "MediaPrefs.h" #include "OpusDecoder.h" @@ -128,8 +127,7 @@ AndroidDecoderModule::SupportsMimeType( const nsACString& aMimeType, DecoderDoctorDiagnostics* aDiagnostics) const { - if (!AndroidBridge::Bridge() || - AndroidBridge::Bridge()->GetAPIVersion() < 16) { + if (jni::GetAPIVersion() < 16) { return false; }