Bug 825112: Enable opensles webrtc backend on gonk r=mwu,jesup,ted
authorRandell Jesup <rjesup@jesup.org>
Wed, 17 Jul 2013 20:00:43 -0400
changeset 141647 79fb01e0e3fa88bef7e666e81d5d3cb785fa7e38
parent 141646 0868beaeab71617b34ec42dcac6dbb8a42ad9de0
child 141648 c6962b015a6a538c037ed847c4a74aad56fcbf6c
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersmwu, jesup, ted
bugs825112
milestone25.0a1
Bug 825112: Enable opensles webrtc backend on gonk r=mwu,jesup,ted
configure.in
content/media/webrtc/Makefile.in
media/webrtc/trunk/webrtc/modules/audio_device/android/audio_device_opensles_android.cc
media/webrtc/trunk/webrtc/modules/audio_device/android/audio_device_opensles_android.h
media/webrtc/trunk/webrtc/modules/audio_device/audio_device.gypi
media/webrtc/trunk/webrtc/modules/audio_device/audio_device_impl.cc
media/webrtc/trunk/webrtc/modules/audio_device/audio_device_opensles.cc
media/webrtc/trunk/webrtc/modules/audio_device/audio_device_opensles.h
--- a/configure.in
+++ b/configure.in
@@ -9129,17 +9129,17 @@ if test -n "$INTEL_ARCHITECTURE"; then
     EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D yuv_disable_asm=1"
   fi
 fi
 
 if test -n "$MOZ_WEBRTC"; then
    AC_MSG_RESULT("generating WebRTC Makefiles...")
 
    if test "${MOZ_WIDGET_TOOLKIT}" = "gonk"; then
-      EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D build_with_gonk=1 -D include_internal_audio_device=0"
+      EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D build_with_gonk=1"
    fi
 
 dnl Any --include files must also appear in -D FORCED_INCLUDE_FILE= entries
 dnl so that regeneration via dependencies works correctly
    WEBRTC_CONFIG="-D build_with_mozilla=1 -D build_with_chromium=0 --include ${srcdir}/media/webrtc/webrtc_config.gypi -D FORCED_INCLUDE_FILE=${srcdir}/media/webrtc/webrtc_config.gypi"
 
    if test -n HAVE_CLOCK_MONOTONIC; then
       WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_clock_monotonic=1"
--- a/content/media/webrtc/Makefile.in
+++ b/content/media/webrtc/Makefile.in
@@ -16,15 +16,16 @@ ifeq ($(OS_ARCH),WINNT)
 OS_CXXFLAGS += -DNOMINMAX
 endif
 
 include $(topsrcdir)/config/rules.mk
 include $(topsrcdir)/ipc/chromium/chromium-config.mk
 
 ifdef MOZ_WEBRTC
 LOCAL_INCLUDES += \
+  -I$(topsrcdir)/media/webrtc/trunk \
   -I$(topsrcdir)/media/webrtc/trunk/webrtc \
   -I$(topsrcdir)/media/webrtc/signaling/src/common \
   -I$(topsrcdir)/media/webrtc/signaling/src/common/browser_logging \
   -I$(topsrcdir)/dom/base \
   -I$(topsrcdir)/dom/camera \
   $(NULL)
 endif
--- a/media/webrtc/trunk/webrtc/modules/audio_device/audio_device.gypi
+++ b/media/webrtc/trunk/webrtc/modules/audio_device/audio_device.gypi
@@ -66,16 +66,22 @@
           ],
         }],
         ['OS=="android"', {
           'include_dirs': [
             '$(topsrcdir)/widget/android',
             'android',
           ],
         }], # OS==android
+        ['moz_widget_toolkit_gonk==1', {
+          'include_dirs': [
+            '$(ANDROID_SOURCE)/frameworks/wilhelm/include',
+            '$(ANDROID_SOURCE)/system/media/wilhelm/include',
+          ],
+        }], # moz_widget_toolkit_gonk==1
         ['include_internal_audio_device==0', {
           'defines': [
             'WEBRTC_DUMMY_AUDIO_BUILD',
           ],
         }],
         ['include_internal_audio_device==1', {
           'sources': [
             'linux/audio_device_utility_linux.cc',
@@ -100,30 +106,39 @@
             'win/audio_device_wave_win.cc',
             'win/audio_device_wave_win.h',
             'win/audio_device_utility_win.cc',
             'win/audio_device_utility_win.h',
             'win/audio_mixer_manager_win.cc',
             'win/audio_mixer_manager_win.h',
             'android/audio_device_utility_android.cc',
             'android/audio_device_utility_android.h',
-            'android/audio_device_opensles_android.cc',
-            'android/audio_device_opensles_android.h',
+# opensles is shared with gonk, so isn't here
             'android/audio_device_jni_android.cc',
             'android/audio_device_jni_android.h',
           ],
           'conditions': [
             ['OS=="android"', {
+              'sources': [
+                'audio_device_opensles.cc',
+                'audio_device_opensles.h',
+              ],
               'link_settings': {
                 'libraries': [
                   '-llog',
                   '-lOpenSLES',
                 ],
               },
             }],
+            ['moz_widget_toolkit_gonk==1', {
+              'sources': [
+                'audio_device_opensles.cc',
+                'audio_device_opensles.h',
+              ],
+            }],
             ['OS=="linux"', {
               'link_settings': {
                 'libraries': [
                   '-ldl',
                 ],
               },
             }],
             ['include_alsa_audio==1', {
--- a/media/webrtc/trunk/webrtc/modules/audio_device/audio_device_impl.cc
+++ b/media/webrtc/trunk/webrtc/modules/audio_device/audio_device_impl.cc
@@ -21,18 +21,23 @@
     #include "audio_device_wave_win.h"
  #if defined(WEBRTC_WINDOWS_CORE_AUDIO_BUILD)
     #include "audio_device_core_win.h"
  #endif
 #elif defined(WEBRTC_ANDROID_OPENSLES)
     #include <stdlib.h>
     #include <dlfcn.h>
     #include "audio_device_utility_android.h"
-    #include "audio_device_opensles_android.h"
+    #include "audio_device_opensles.h"
     #include "audio_device_jni_android.h"
+#elif defined(WEBRTC_GONK)
+    #include <stdlib.h>
+    #include <dlfcn.h>
+    #include "audio_device_utility_linux.h"
+    #include "audio_device_opensles.h"
 #elif defined(WEBRTC_ANDROID)
     #include <stdlib.h>
     #include "audio_device_utility_android.h"
     #include "audio_device_jni_android.h"
 #elif defined(WEBRTC_LINUX)
     #include "audio_device_utility_linux.h"
  #if defined(LINUX_ALSA)
     #include "audio_device_alsa_linux.h"
@@ -255,37 +260,40 @@ int32_t AudioDeviceModuleImpl::CreatePla
         // for Windows.
         //
         ptrAudioDeviceUtility = new AudioDeviceUtilityWindows(Id());
     }
 #endif  // #if defined(_WIN32)
 
     // Create the *Android OpenSLES* implementation of the Audio Device
     //
-#if defined(WEBRTC_ANDROID_OPENSLES)
+#if defined(WEBRTC_ANDROID_OPENSLES) || defined(WEBRTC_GONK)
     // Check if the OpenSLES library is available before going further.
     void* opensles_lib = dlopen("libOpenSLES.so", RTLD_LAZY);
     if (opensles_lib) {
         // That worked, close for now and proceed normally.
         dlclose(opensles_lib);
         if (audioLayer == kPlatformDefaultAudio)
         {
             // Create *Android OpenSLES Audio* implementation
             ptrAudioDevice = new AudioDeviceAndroidOpenSLES(Id());
             WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id,
                          "Android OpenSLES Audio APIs will be utilized");
         }
     }
 
+#if !defined(WEBRTC_GONK)
     if (ptrAudioDevice != NULL)
     {
         // Create the Android implementation of the Device Utility.
         ptrAudioDeviceUtility = new AudioDeviceUtilityAndroid(Id());
     }
 #endif
+
+#endif
 #if defined(WEBRTC_ANDROID_OPENSLES) or defined(WEBRTC_ANDROID)
     // Fall back to this case if on Android 2.2/OpenSLES not available.
     if (ptrAudioDevice == NULL) {
         // Create the *Android Java* implementation of the Audio Device
         if (audioLayer == kPlatformDefaultAudio)
         {
             // Create *Android JNI Audio* implementation
             ptrAudioDevice = new AudioDeviceAndroidJni(Id());
rename from media/webrtc/trunk/webrtc/modules/audio_device/android/audio_device_opensles_android.cc
rename to media/webrtc/trunk/webrtc/modules/audio_device/audio_device_opensles.cc
--- a/media/webrtc/trunk/webrtc/modules/audio_device/android/audio_device_opensles_android.cc
+++ b/media/webrtc/trunk/webrtc/modules/audio_device/audio_device_opensles.cc
@@ -3,17 +3,17 @@
  *
  *  Use of this source code is governed by a BSD-style license
  *  that can be found in the LICENSE file in the root of the source
  *  tree. An additional intellectual property rights grant can be found
  *  in the file PATENTS.  All contributing project authors may
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "modules/audio_device/android/audio_device_opensles_android.h"
+#include "modules/audio_device/audio_device_opensles.h"
 
 #ifdef WEBRTC_ANDROID_DEBUG
 #include <android/log.h>
 #endif
 #include <sys/resource.h>
 #include <sys/syscall.h>
 #include <sys/time.h>
 #include <time.h>
rename from media/webrtc/trunk/webrtc/modules/audio_device/android/audio_device_opensles_android.h
rename to media/webrtc/trunk/webrtc/modules/audio_device/audio_device_opensles.h