From 3f6b4f213ad7d8049909c5129d4fd98c488d27e8 Mon Sep 17 00:00:00 2001 From: Randell Jesup Date: Wed, 17 Jul 2013 20:00:43 -0400 Subject: [PATCH] Bug 825112: Enable opensles webrtc backend on gonk r=mwu,jesup,ted --HG-- rename : media/webrtc/trunk/webrtc/modules/audio_device/android/audio_device_opensles_android.cc => media/webrtc/trunk/webrtc/modules/audio_device/audio_device_opensles.cc rename : media/webrtc/trunk/webrtc/modules/audio_device/android/audio_device_opensles_android.h => media/webrtc/trunk/webrtc/modules/audio_device/audio_device_opensles.h --- configure.in | 2 +- content/media/webrtc/Makefile.in | 1 + .../modules/audio_device/audio_device.gypi | 19 +++++++++++++++++-- .../modules/audio_device/audio_device_impl.cc | 12 ++++++++++-- ...es_android.cc => audio_device_opensles.cc} | 2 +- ...sles_android.h => audio_device_opensles.h} | 0 6 files changed, 30 insertions(+), 6 deletions(-) rename media/webrtc/trunk/webrtc/modules/audio_device/{android/audio_device_opensles_android.cc => audio_device_opensles.cc} (99%) rename media/webrtc/trunk/webrtc/modules/audio_device/{android/audio_device_opensles_android.h => audio_device_opensles.h} (100%) diff --git a/configure.in b/configure.in index b91b7472657..6ff95d1930b 100644 --- a/configure.in +++ b/configure.in @@ -9134,7 +9134,7 @@ 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 diff --git a/content/media/webrtc/Makefile.in b/content/media/webrtc/Makefile.in index 726ff7c703e..440c1455727 100644 --- a/content/media/webrtc/Makefile.in +++ b/content/media/webrtc/Makefile.in @@ -21,6 +21,7 @@ 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 \ diff --git a/media/webrtc/trunk/webrtc/modules/audio_device/audio_device.gypi b/media/webrtc/trunk/webrtc/modules/audio_device/audio_device.gypi index 5da51613551..ce9dad681dc 100644 --- a/media/webrtc/trunk/webrtc/modules/audio_device/audio_device.gypi +++ b/media/webrtc/trunk/webrtc/modules/audio_device/audio_device.gypi @@ -71,6 +71,12 @@ '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', @@ -105,13 +111,16 @@ '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', @@ -119,6 +128,12 @@ ], }, }], + ['moz_widget_toolkit_gonk==1', { + 'sources': [ + 'audio_device_opensles.cc', + 'audio_device_opensles.h', + ], + }], ['OS=="linux"', { 'link_settings': { 'libraries': [ diff --git a/media/webrtc/trunk/webrtc/modules/audio_device/audio_device_impl.cc b/media/webrtc/trunk/webrtc/modules/audio_device/audio_device_impl.cc index 0013e3d2f29..aae55fe0c17 100644 --- a/media/webrtc/trunk/webrtc/modules/audio_device/audio_device_impl.cc +++ b/media/webrtc/trunk/webrtc/modules/audio_device/audio_device_impl.cc @@ -26,8 +26,13 @@ #include #include #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 + #include + #include "audio_device_utility_linux.h" + #include "audio_device_opensles.h" #elif defined(WEBRTC_ANDROID) #include #include "audio_device_utility_android.h" @@ -260,7 +265,7 @@ int32_t AudioDeviceModuleImpl::CreatePlatformSpecificObjects() // 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) { @@ -275,12 +280,15 @@ int32_t AudioDeviceModuleImpl::CreatePlatformSpecificObjects() } } +#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) { diff --git 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 similarity index 99% 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 index 21e31b1315c..d5cc035093e 100644 --- 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 @@ -8,7 +8,7 @@ * 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 diff --git a/media/webrtc/trunk/webrtc/modules/audio_device/android/audio_device_opensles_android.h b/media/webrtc/trunk/webrtc/modules/audio_device/audio_device_opensles.h similarity index 100% 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