Bug 1314530 Part2 - Add isRemote flag to MediaDrmProxy::Create function to determine if it is oop case. r=cpearce
authorJames Cheng <jacheng@mozilla.com>
Mon, 07 Nov 2016 14:01:25 +0800
changeset 435611 13f6bd96aa7805497d31ab9d9543232a31637a38
parent 435610 3879ad77bbcfa7bbb89938d8f64151d54a21258e
child 435612 971aaa1646ed6eaa1ea4e0c678cad615e143c6d6
push id35078
push usermbrubeck@mozilla.com
push dateTue, 08 Nov 2016 22:02:54 +0000
reviewerscpearce
bugs1314530
milestone52.0a1
Bug 1314530 Part2 - Add isRemote flag to MediaDrmProxy::Create function to determine if it is oop case. r=cpearce MozReview-Commit-ID: Dqf1C5nDHct
dom/media/eme/mediadrm/MediaDrmProxySupport.cpp
mobile/android/base/java/org/mozilla/gecko/media/MediaDrmProxy.java
widget/android/fennec/FennecJNIWrappers.cpp
widget/android/fennec/FennecJNIWrappers.h
--- a/dom/media/eme/mediadrm/MediaDrmProxySupport.cpp
+++ b/dom/media/eme/mediadrm/MediaDrmProxySupport.cpp
@@ -194,22 +194,21 @@ MediaDrmJavaCallbacksSupport::OnRejectPr
                                          NS_ERROR_DOM_INVALID_STATE_ERR,
                                          reason);
 }
 
 MediaDrmProxySupport::MediaDrmProxySupport(const nsAString& aKeySystem)
   : mKeySystem(aKeySystem), mDestroyed(false)
 {
   mJavaCallbacks = MediaDrmProxy::NativeMediaDrmProxyCallbacks::New();
-  // TODO: Bug 1306196 will check the pref to determine if it is oop case.
-  // Follow the pref flag PDMAndroidRemoteCodecEnabled returned to determine
-  // it is crossing process CDM or not.
+
   mBridgeProxy =
     MediaDrmProxy::Create(mKeySystem,
-                          mJavaCallbacks);
+                          mJavaCallbacks,
+                          MediaPrefs::PDMAndroidRemoteCodecEnabled());
 }
 
 MediaDrmProxySupport::~MediaDrmProxySupport()
 {
   MOZ_ASSERT(mDestroyed, "Shutdown() should be called before !!");
   MediaDrmJavaCallbacksSupport::DisposeNative(mJavaCallbacks);
 }
 
--- a/mobile/android/base/java/org/mozilla/gecko/media/MediaDrmProxy.java
+++ b/mobile/android/base/java/org/mozilla/gecko/media/MediaDrmProxy.java
@@ -243,17 +243,20 @@ public final class MediaDrmProxy {
     } // MediaDrmProxyCallbacks
 
     public boolean isDestroyed() {
         return mDestroyed;
     }
 
     @WrapForJNI(calledFrom = "gecko")
     public static MediaDrmProxy create(String keySystem,
-                                       Callbacks nativeCallbacks) {
+                                       Callbacks nativeCallbacks,
+                                       boolean isRemote) {
+        // TODO: Will implement {Local,Remote}MediaDrmBridge instantiation by
+        // '''isRemote''' flag in Bug 1307818.
         MediaDrmProxy proxy = new MediaDrmProxy(keySystem, nativeCallbacks);
         return proxy;
     }
 
     MediaDrmProxy(String keySystem, Callbacks nativeCallbacks) {
         if (DEBUG) Log.d(LOGTAG, "Constructing MediaDrmProxy");
         // TODO: Bug 1306185 will implement the LocalMediaDrmBridge as an impl
         // of GeckoMediaDrm for in-process decoding mode.
--- a/widget/android/fennec/FennecJNIWrappers.cpp
+++ b/widget/android/fennec/FennecJNIWrappers.cpp
@@ -273,19 +273,19 @@ constexpr char MediaDrmProxy::CloseSessi
 auto MediaDrmProxy::CloseSession(int32_t a0, mozilla::jni::String::Param a1) const -> void
 {
     return mozilla::jni::Method<CloseSession_t>::Call(MediaDrmProxy::mCtx, nullptr, a0, a1);
 }
 
 constexpr char MediaDrmProxy::Create_t::name[];
 constexpr char MediaDrmProxy::Create_t::signature[];
 
-auto MediaDrmProxy::Create(mozilla::jni::String::Param a0, mozilla::jni::Object::Param a1) -> MediaDrmProxy::LocalRef
+auto MediaDrmProxy::Create(mozilla::jni::String::Param a0, mozilla::jni::Object::Param a1, bool a2) -> MediaDrmProxy::LocalRef
 {
-    return mozilla::jni::Method<Create_t>::Call(MediaDrmProxy::Context(), nullptr, a0, a1);
+    return mozilla::jni::Method<Create_t>::Call(MediaDrmProxy::Context(), nullptr, a0, a1, a2);
 }
 
 constexpr char MediaDrmProxy::CreateSession_t::name[];
 constexpr char MediaDrmProxy::CreateSession_t::signature[];
 
 auto MediaDrmProxy::CreateSession(int32_t a0, int32_t a1, mozilla::jni::String::Param a2, mozilla::jni::ByteArray::Param a3) const -> void
 {
     return mozilla::jni::Method<CreateSession_t>::Call(MediaDrmProxy::mCtx, nullptr, a0, a1, a2, a3);
--- a/widget/android/fennec/FennecJNIWrappers.h
+++ b/widget/android/fennec/FennecJNIWrappers.h
@@ -994,30 +994,31 @@ public:
     auto CloseSession(int32_t, mozilla::jni::String::Param) const -> void;
 
     struct Create_t {
         typedef MediaDrmProxy Owner;
         typedef MediaDrmProxy::LocalRef ReturnType;
         typedef MediaDrmProxy::Param SetterType;
         typedef mozilla::jni::Args<
                 mozilla::jni::String::Param,
-                mozilla::jni::Object::Param> Args;
+                mozilla::jni::Object::Param,
+                bool> Args;
         static constexpr char name[] = "create";
         static constexpr char signature[] =
-                "(Ljava/lang/String;Lorg/mozilla/gecko/media/MediaDrmProxy$Callbacks;)Lorg/mozilla/gecko/media/MediaDrmProxy;";
+                "(Ljava/lang/String;Lorg/mozilla/gecko/media/MediaDrmProxy$Callbacks;Z)Lorg/mozilla/gecko/media/MediaDrmProxy;";
         static const bool isStatic = true;
         static const mozilla::jni::ExceptionMode exceptionMode =
                 mozilla::jni::ExceptionMode::ABORT;
         static const mozilla::jni::CallingThread callingThread =
                 mozilla::jni::CallingThread::GECKO;
         static const mozilla::jni::DispatchTarget dispatchTarget =
                 mozilla::jni::DispatchTarget::CURRENT;
     };
 
-    static auto Create(mozilla::jni::String::Param, mozilla::jni::Object::Param) -> MediaDrmProxy::LocalRef;
+    static auto Create(mozilla::jni::String::Param, mozilla::jni::Object::Param, bool) -> MediaDrmProxy::LocalRef;
 
     struct CreateSession_t {
         typedef MediaDrmProxy Owner;
         typedef void ReturnType;
         typedef void SetterType;
         typedef mozilla::jni::Args<
                 int32_t,
                 int32_t,