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 572887 db97a82c47d3f3e671926b8401323125fd26eaac
parent 572886 c8b3fe7b2713a057eb2a1f91351558381d7f0984
child 627147 225a254eb22f29fdbf0ba17eb36b1bef62b0953c
push id57212
push userbmo:snorp@snorp.net
push dateThu, 04 May 2017 21:08:01 +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;
   }