Bug 1322650 - Don't use AndroidBridge to get API version in media stack r=jolin draft
authorJames Willcox <snorp@snorp.net>
Tue, 11 Apr 2017 10:16:48 -0500
changeset 563029 7d7638e6f714d43a57b4387bcbfee09de2592f47
parent 563028 48e93dcccf002fbf504505a8927d2065b0e9c201
child 624378 4c627ac8214ed26432944751d40be017b377966c
push id54192
push userbmo:snorp@snorp.net
push dateFri, 14 Apr 2017 21:55:35 +0000
reviewersjolin
bugs1322650
milestone55.0a1
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/MediaPrefs.h
dom/media/platforms/android/AndroidDecoderModule.cpp
--- a/dom/media/MediaPrefs.h
+++ b/dom/media/MediaPrefs.h
@@ -2,17 +2,17 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * 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/. */
 
 #ifndef MEDIA_PREFS_H
 #define MEDIA_PREFS_H
 
 #ifdef MOZ_WIDGET_ANDROID
-#include "AndroidBridge.h"
+#include "GeneratedJNIWrappers.h"
 #endif
 
 #include "mozilla/Atomics.h"
 
 // First time MediaPrefs::GetSingleton() needs to be called on the main thread,
 // before any of the methods accessing the values are used, but after
 // the Preferences system has been initialized.
 
@@ -194,18 +194,17 @@ public:
 private:
   template<class T> friend class StaticAutoPtr;
   static StaticAutoPtr<MediaPrefs> sInstance;
 
   // Default value functions
   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;
     }
 #endif
     // Otherwise, set no decoder limit.
     return -1;
   }
--- a/dom/media/platforms/android/AndroidDecoderModule.cpp
+++ b/dom/media/platforms/android/AndroidDecoderModule.cpp
@@ -1,14 +1,13 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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"
 #include "RemoteDataDecoder.h"
 #include "VPXDecoder.h"
 #include "VorbisDecoder.h"
 
 #include "nsIGfxInfo.h"
@@ -123,18 +122,17 @@ AndroidDecoderModule::AndroidDecoderModu
   mProxy = static_cast<MediaDrmCDMProxy*>(aProxy);
 }
 
 bool
 AndroidDecoderModule::SupportsMimeType(
   const nsACString& aMimeType,
   DecoderDoctorDiagnostics* aDiagnostics) const
 {
-  if (!AndroidBridge::Bridge() ||
-      AndroidBridge::Bridge()->GetAPIVersion() < 16) {
+  if (jni::GetAPIVersion() < 16) {
     return false;
   }
 
   if (aMimeType.EqualsLiteral("video/mp4") ||
       aMimeType.EqualsLiteral("video/avc")) {
     return true;
   }