Bug 1029983 - H.264 codec is working on B2G ignoring preference 'media.peerconnection.video.h264_enabled'. r=ehugg, a=2.0+
authorChangbin Park <pchangbin@gmail.com>
Tue, 01 Jul 2014 16:09:20 -0700
changeset 208874 34ef96fed1e12717d0ce0af6d1fdaa4e36ad2d5d
parent 208873 9babdeaf1bdb660892573b749d710e3a6f803abf
child 208875 dd4a95d01ad80daa091ffb76fa1629de30e95f17
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehugg, 2
bugs1029983
milestone32.0a2
Bug 1029983 - H.264 codec is working on B2G ignoring preference 'media.peerconnection.video.h264_enabled'. r=ehugg, a=2.0+
media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
--- a/media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
+++ b/media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
@@ -29,16 +29,17 @@
 #include "mozilla/SyncRunnable.h"
 #include "mozilla/Services.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 #ifdef MOZILLA_INTERNAL_API
 #include "nsIPrincipal.h"
 #include "nsIDocument.h"
+#include "mozilla/Preferences.h"
 #endif
 
 #include <stdlib.h>
 #include <stdio.h>
 #include <ssl.h>
 #include <sslproto.h>
 #include <algorithm>
 
@@ -252,26 +253,32 @@ int VcmSIPCCBinding::getVideoCodecsHw()
 {
   // Check to see if what HW codecs are available (not in use) at this moment.
   // Note that streaming video decode can reserve a decoder
 
   // XXX See bug 1018791 Implement W3 codec reservation policy
   // Note that currently, OMXCodecReservation needs to be held by an sp<> because it puts
   // 'this' into an sp<EventListener> to talk to the resource reservation code
 #ifdef MOZ_WEBRTC_OMX
-  android::sp<android::OMXCodecReservation> encode = new android::OMXCodecReservation(true);
-  android::sp<android::OMXCodecReservation> decode = new android::OMXCodecReservation(false);
-
-  // Currently we just check if they're available right now, which will fail if we're
-  // trying to call ourself, for example.  It will work for most real-world cases, like
-  // if we try to add a person to a 2-way call to make a 3-way mesh call
-  if (encode->ReserveOMXCodec() && decode->ReserveOMXCodec()) {
-    CSFLogDebug( logTag, "%s: H264 hardware codec available", __FUNCTION__);
-    return VCM_CODEC_RESOURCE_H264;
-  }
+#ifdef MOZILLA_INTERNAL_API
+  if (Preferences::GetBool("media.peerconnection.video.h264_enabled")) {
+#endif
+    android::sp<android::OMXCodecReservation> encode = new android::OMXCodecReservation(true);
+    android::sp<android::OMXCodecReservation> decode = new android::OMXCodecReservation(false);
+
+    // Currently we just check if they're available right now, which will fail if we're
+    // trying to call ourself, for example.  It will work for most real-world cases, like
+    // if we try to add a person to a 2-way call to make a 3-way mesh call
+    if (encode->ReserveOMXCodec() && decode->ReserveOMXCodec()) {
+      CSFLogDebug( logTag, "%s: H264 hardware codec available", __FUNCTION__);
+      return VCM_CODEC_RESOURCE_H264;
+    }
+#if defined( MOZILLA_INTERNAL_API)
+   }
+#endif
 #endif
 
   return 0;
 }
 
 void VcmSIPCCBinding::setMainThread(nsIThread *thread)
 {
   gMainThread = thread;