Add support for Android x86_64 and ARM64
This commit is contained in:
parent
671dbaaf77
commit
7604ae6761
|
@ -101,17 +101,21 @@ if [ x$SSL = "xno" ]; then
|
|||
export OPTIONS="${OPTIONS} --without-ssl"
|
||||
fi
|
||||
|
||||
for arch in armv5te armv7-a armv7-a-neon x86
|
||||
for arch in armv5te armv7-a armv7-a-neon arm64 x86 x64
|
||||
do
|
||||
if [ $arch = "x86" ]; then \
|
||||
export HOST=i686-linux-android; \
|
||||
elif [ $arch = "x64" ]; then \
|
||||
export HOST=x86_64-linux-android; \
|
||||
elif [ $arch = "arm64" ]; then \
|
||||
export HOST=aarch64-linux-android; \
|
||||
else \
|
||||
export HOST=arm-linux-androideabi; \
|
||||
fi \
|
||||
|
||||
echo -e building for ARCH="$arch, OPTIONS=$OPTIONS.... \n"
|
||||
|
||||
./configure --host=$HOST --with-android-cpu=$arch --prefix=$HOME/$arch --without-pic --enable-nonfree=$ENABLE_NONFREE --enable-gpl=$ENABLE_GPL --enable-debug=$DEBUG $OPTIONS
|
||||
./configure --host=$HOST --with-android-cpu=$arch --prefix=$HOME/$arch --with-pic --enable-nonfree=$ENABLE_NONFREE --enable-gpl=$ENABLE_GPL --enable-debug=$DEBUG $OPTIONS
|
||||
make clean
|
||||
make uninstall
|
||||
make all
|
||||
|
@ -124,7 +128,9 @@ done
|
|||
|
||||
mkdir -p $HOME/imsdroid/libs/armeabi
|
||||
mkdir -p $HOME/imsdroid/libs/armeabi-v7a
|
||||
mkdir -p $HOME/imsdroid/libs/arm64-v8a
|
||||
mkdir -p $HOME/imsdroid/libs/x86
|
||||
mkdir -p $HOME/imsdroid/libs/x86_64
|
||||
mkdir -p $HOME/imsdroid/libs/mips
|
||||
|
||||
cp --force $HOME/armv5te/lib/libtinyWRAP.so.0.0.0 $HOME/imsdroid/libs/armeabi/libtinyWRAP.so
|
||||
|
@ -134,7 +140,13 @@ cp --force $HOME/armv7-a/lib/libtinyWRAP.so.0.0.0 $HOME/imsdroid/libs/armeabi-v7
|
|||
cp --force $HOME/armv7-a/lib/libplugin_audio_opensles.so.0.0.0 $HOME/imsdroid/libs/armeabi-v7a/libplugin_audio_opensles.so
|
||||
cp --force $HOME/armv7-a-neon/lib/libtinyWRAP.so.0.0.0 $HOME/imsdroid/libs/armeabi-v7a/libtinyWRAP_neon.so
|
||||
|
||||
cp --force $HOME/arm64/lib/libtinyWRAP.so.0.0.0 $HOME/imsdroid/libs/arm64-v8a/libtinyWRAP.so
|
||||
cp --force $HOME/arm64/lib/libplugin_audio_opensles.so.0.0.0 $HOME/imsdroid/libs/arm64-v8a/libplugin_audio_opensles.so
|
||||
|
||||
cp --force $HOME/x86/lib/libtinyWRAP.so.0.0.0 $HOME/imsdroid/libs/x86/libtinyWRAP.so
|
||||
cp --force $HOME/x86/lib/libplugin_audio_opensles.so.0.0.0 $HOME/imsdroid/libs/x86/libplugin_audio_opensles.so
|
||||
|
||||
cp --force $HOME/x64/lib/libtinyWRAP.so.0.0.0 $HOME/imsdroid/libs/x86_64/libtinyWRAP.so
|
||||
cp --force $HOME/x64/lib/libplugin_audio_opensles.so.0.0.0 $HOME/imsdroid/libs/x86_64/libplugin_audio_opensles.so
|
||||
|
||||
|
||||
|
|
42
configure.ac
42
configure.ac
|
@ -22,6 +22,14 @@ case "$host" in
|
|||
target_os=android
|
||||
android_cpu=armv5te
|
||||
;;
|
||||
aarch64-*-linux-android)
|
||||
target_os=android
|
||||
android_cpu=arm64
|
||||
;;
|
||||
x86_64-*-linux-android)
|
||||
target_os=android
|
||||
android_cpu=x64
|
||||
;;
|
||||
i686-*-linux-android)
|
||||
target_os=android
|
||||
android_cpu=x86
|
||||
|
@ -37,7 +45,9 @@ AC_ARG_WITH(android-cpu,
|
|||
armv5te: ARMv5TE
|
||||
armv7-a: ARMv7-a *without* NEON
|
||||
armv7-a-neon: ARMv7-a *with* NEON
|
||||
x86: X86],
|
||||
arm64: aarch64
|
||||
x86: X86
|
||||
x64: X86_64],
|
||||
[ android_cpu=$withval ])
|
||||
|
||||
### ANDROID-TOOLCHAIN (http://www.kandroid.org/ndk/docs/STANDALONE-TOOLCHAIN.html)
|
||||
|
@ -48,14 +58,31 @@ if test "$target_os" = "android"; then
|
|||
export ANDROID_PREFIX=i686-linux-android
|
||||
export ANDROID_TOOLCHAIN=$(pwd)/my-android-toolchain-android-x86
|
||||
$NDK/build/tools/make-standalone-toolchain.sh --platform=android-9 --arch=x86 --install-dir=$ANDROID_TOOLCHAIN
|
||||
export CFLAGS='-DANDROID=1'
|
||||
AC_SUBST(TARGET_ARCH, "x86")
|
||||
;;
|
||||
x64)
|
||||
export SYSROOT=$NDK/platforms/android-21/arch-x86_64
|
||||
export ANDROID_PREFIX=x86_64-linux-android
|
||||
export ANDROID_TOOLCHAIN=$(pwd)/my-android-toolchain-android-x86_64
|
||||
$NDK/build/tools/make-standalone-toolchain.sh --arch=x86_64 --platform=android-21 --install-dir=$ANDROID_TOOLCHAIN
|
||||
export CFLAGS='-DANDROID=1'
|
||||
AC_SUBST(TARGET_ARCH, "x86")
|
||||
;;
|
||||
arm64)
|
||||
export ANDROID_PREFIX=aarch64-linux-android
|
||||
export SYSROOT=$NDK/platforms/android-21/arch-arm64
|
||||
export ANDROID_TOOLCHAIN=$(pwd)/my-android-toolchain-android-arm64
|
||||
$NDK/build/tools/make-standalone-toolchain.sh --arch=arm64 --platform=android-21 --install-dir=$ANDROID_TOOLCHAIN
|
||||
export CFLAGS='-DANDROID=1 -D__ARMEL__'
|
||||
AC_SUBST(TARGET_ARCH, "arm")
|
||||
;;
|
||||
armv7-a)
|
||||
export ANDROID_PREFIX=arm-linux-androideabi
|
||||
export SYSROOT=$NDK/platforms/android-3/arch-arm
|
||||
export ANDROID_TOOLCHAIN=$(pwd)/my-android-toolchain-android-armv7-a
|
||||
$NDK/build/tools/make-standalone-toolchain.sh --platform=android-3 --arch=arm --install-dir=$ANDROID_TOOLCHAIN
|
||||
export CFLAGS='-march=armv7-a -mfloat-abi=softfp'
|
||||
export CFLAGS='-march=armv7-a -mfloat-abi=softfp -DANDROID=1 -D__ARMEL__'
|
||||
export LDFLAGS='-Wl,--fix-cortex-a8'
|
||||
AC_SUBST(TARGET_ARCH, "arm")
|
||||
;;
|
||||
|
@ -64,7 +91,7 @@ if test "$target_os" = "android"; then
|
|||
export SYSROOT=$NDK/platforms/android-3/arch-arm
|
||||
export ANDROID_TOOLCHAIN=$(pwd)/my-android-toolchain-android-armv7-a-neon
|
||||
$NDK/build/tools/make-standalone-toolchain.sh --platform=android-3 --arch=arm --install-dir=$ANDROID_TOOLCHAIN
|
||||
export CFLAGS='-march=armv7-a -mfloat-abi=softfp -mfpu=neon'
|
||||
export CFLAGS='-march=armv7-a -mfloat-abi=softfp -mfpu=neon -DANDROID=1'
|
||||
export LDFLAGS='-Wl,--fix-cortex-a8'
|
||||
AC_SUBST(TARGET_ARCH, "arm")
|
||||
;;
|
||||
|
@ -73,13 +100,14 @@ if test "$target_os" = "android"; then
|
|||
export SYSROOT=$NDK/platforms/android-3/arch-arm
|
||||
export ANDROID_TOOLCHAIN=$(pwd)/my-android-toolchain-armv5te
|
||||
$NDK/build/tools/make-standalone-toolchain.sh --platform=android-3 --arch=arm --install-dir=$ANDROID_TOOLCHAIN
|
||||
export CFLAGS='-DANDROID=1 -D__ARMEL__'
|
||||
AC_SUBST(TARGET_ARCH, "arm")
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(NDK, $NDK)
|
||||
|
||||
export CFLAGS="${CFLAGS} -DANDROID=1"
|
||||
export CFLAGS="${CFLAGS} -fPIC"
|
||||
export CPPFLAGS=$CFLAGS
|
||||
export LDFLAGS="${LDFLAGS} -lc -lm -lgcc"
|
||||
|
||||
|
@ -401,10 +429,10 @@ AC_ARG_WITH(ssl,
|
|||
if test $want_ssl != no; then
|
||||
# check for lib and headers
|
||||
AC_CHECK_HEADERS(openssl/ssl.h,
|
||||
AC_CHECK_LIB(ssl, SSL_library_init, AC_DEFINE_UNQUOTED(HAVE_OPENSSL, 1, HAVE_OPENSSL) [have_ssl=yes] LIBSSL_LIBADD="${LIBSSL_LIBADD} -lssl",
|
||||
AC_CHECK_LIB(ssl, SSL_connect, AC_DEFINE_UNQUOTED(HAVE_OPENSSL, 1, HAVE_OPENSSL) [have_ssl=yes] LIBSSL_LIBADD="${LIBSSL_LIBADD} -lssl",
|
||||
AC_DEFINE_UNQUOTED(HAVE_OPENSSL, 0, HAVE_OPENSSL) [have_ssl=no], [-lcrypto]
|
||||
))
|
||||
AC_CHECK_LIB(crypto, BN_init,
|
||||
AC_CHECK_LIB(crypto, CRYPTO_new_ex_data,
|
||||
LIBSSL_LIBADD="${LIBSSL_LIBADD} -lcrypto"
|
||||
AC_CHECK_LIB(ssl, SSL_CTX_set_tlsext_use_srtp, AC_DEFINE_UNQUOTED(HAVE_OPENSSL_DTLS_SRTP, 1, HAVE_OPENSSL_DTLS_SRTP) [have_dtls_srtp=yes],[],[-lcrypto])
|
||||
AC_CHECK_LIB(ssl, DTLSv1_method, AC_DEFINE_UNQUOTED(HAVE_OPENSSL_DTLS, 1, HAVE_OPENSSL_DTLS) [have_dtls=yes],[],[-lcrypto])
|
||||
|
@ -465,7 +493,7 @@ AM_CONDITIONAL([USE_FFMPEG], [test $have_ffmpeg = yes])
|
|||
########################################################
|
||||
# X264
|
||||
########################################################
|
||||
AM_CONDITIONAL(USE_X264, [test $target_os:$enable_gpl = android:yes]) # X264 is always there for Android and statically linked
|
||||
AM_CONDITIONAL(USE_X264, [test $target_os:$enable_gpl:$have_ffmpeg = android:yes:yes]) # X264 is always there for Android and statically linked
|
||||
AC_SUBST(LIBX264_LIBADD, "-lx264")
|
||||
AC_ARG_WITH(x264, [ --with-x264 IMPORTANT: deprecated to be removed ],[], [])
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ int __plugin_get_def_count()
|
|||
|
||||
tsk_plugin_def_type_t __plugin_get_def_type_at(int index)
|
||||
{
|
||||
switch(index) {
|
||||
switch (index) {
|
||||
case PLUGIN_INDEX_AUDIO_CONSUMER:
|
||||
return tsk_plugin_def_type_consumer;
|
||||
case PLUGIN_INDEX_AUDIO_PRODUCER:
|
||||
|
@ -58,7 +58,7 @@ tsk_plugin_def_type_t __plugin_get_def_type_at(int index)
|
|||
|
||||
tsk_plugin_def_media_type_t __plugin_get_def_media_type_at(int index)
|
||||
{
|
||||
switch(index) {
|
||||
switch (index) {
|
||||
case PLUGIN_INDEX_AUDIO_CONSUMER:
|
||||
case PLUGIN_INDEX_AUDIO_PRODUCER: {
|
||||
return tsk_plugin_def_media_type_audio;
|
||||
|
@ -72,7 +72,7 @@ tsk_plugin_def_media_type_t __plugin_get_def_media_type_at(int index)
|
|||
|
||||
tsk_plugin_def_ptr_const_t __plugin_get_def_at(int index)
|
||||
{
|
||||
switch(index) {
|
||||
switch (index) {
|
||||
case PLUGIN_INDEX_AUDIO_CONSUMER: {
|
||||
return audio_consumer_opensles_plugin_def_t;
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ static audio_opensles_instances_L_t* __audioInstances = tsk_null;
|
|||
static tsk_object_t* audio_opensles_instance_ctor(tsk_object_t * self, va_list * app)
|
||||
{
|
||||
audio_opensles_instance_t* audioInstance = (audio_opensles_instance_t*)self;
|
||||
if(audioInstance) {
|
||||
if (audioInstance) {
|
||||
tsk_safeobj_init(audioInstance);
|
||||
}
|
||||
return self;
|
||||
|
@ -128,15 +128,15 @@ static tsk_object_t* audio_opensles_instance_dtor(tsk_object_t * self)
|
|||
{
|
||||
AUDIO_OPENSLES_DEBUG_INFO("Audio Instance destroyed");
|
||||
audio_opensles_instance_t* audioInstance = (audio_opensles_instance_t*)self;
|
||||
if(audioInstance) {
|
||||
if (audioInstance) {
|
||||
tsk_safeobj_lock(audioInstance);
|
||||
if(audioInstance->device) {
|
||||
if (audioInstance->device) {
|
||||
audioInstance->device->SetCallback(NULL);
|
||||
audioInstance->device->Terminate();
|
||||
delete audioInstance->device;
|
||||
audioInstance->device = tsk_null;
|
||||
}
|
||||
if(audioInstance->callback) {
|
||||
if (audioInstance->callback) {
|
||||
delete audioInstance->callback;
|
||||
audioInstance->callback = tsk_null;
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ static tsk_object_t* audio_opensles_instance_dtor(tsk_object_t * self)
|
|||
}
|
||||
static int audio_opensles_instance_cmp(const tsk_object_t *_ai1, const tsk_object_t *_ai2)
|
||||
{
|
||||
return ((int)_ai1 - (int)_ai2);
|
||||
return (int)((uintptr_t)_ai1 - (uintptr_t)_ai2);
|
||||
}
|
||||
static const tsk_object_def_t audio_opensles_instance_def_s = {
|
||||
sizeof(audio_opensles_instance_t),
|
||||
|
@ -164,7 +164,7 @@ audio_opensles_instance_handle_t* audio_opensles_instance_create(uint64_t sessio
|
|||
audio_opensles_instance_t* audioInstance = tsk_null;
|
||||
|
||||
// create list used to hold instances
|
||||
if(!__audioInstances && !(__audioInstances = tsk_list_create())) {
|
||||
if (!__audioInstances && !(__audioInstances = tsk_list_create())) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("Failed to create new list");
|
||||
return tsk_null;
|
||||
}
|
||||
|
@ -175,37 +175,37 @@ audio_opensles_instance_handle_t* audio_opensles_instance_create(uint64_t sessio
|
|||
// find the instance from the list
|
||||
const tsk_list_item_t* item;
|
||||
tsk_list_foreach(item, __audioInstances) {
|
||||
if(((audio_opensles_instance_t*)item->data)->sessionId == sessionId) {
|
||||
if (((audio_opensles_instance_t*)item->data)->sessionId == sessionId) {
|
||||
audioInstance = (audio_opensles_instance_t*)tsk_object_ref(item->data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!audioInstance) {
|
||||
if (!audioInstance) {
|
||||
audio_opensles_instance_t* _audioInstance;
|
||||
if(!(_audioInstance = (audio_opensles_instance_t*)tsk_object_new(&audio_opensles_instance_def_s))) {
|
||||
if (!(_audioInstance = (audio_opensles_instance_t*)tsk_object_new(&audio_opensles_instance_def_s))) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("Failed to create new audio instance");
|
||||
goto done;
|
||||
}
|
||||
|
||||
if(!(_audioInstance->device = new SLAudioDevice())) {
|
||||
if (!(_audioInstance->device = new SLAudioDevice())) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("Failed to create audio device");
|
||||
TSK_OBJECT_SAFE_FREE(_audioInstance);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if(!(_audioInstance->callback = new SLAudioDeviceCallbackImpl())) {
|
||||
if (!(_audioInstance->callback = new SLAudioDeviceCallbackImpl())) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("Failed to create audio transport");
|
||||
TSK_OBJECT_SAFE_FREE(_audioInstance);
|
||||
goto done;
|
||||
}
|
||||
if((_audioInstance->device->SetCallback(_audioInstance->callback))) {
|
||||
if ((_audioInstance->device->SetCallback(_audioInstance->callback))) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("AudioDeviceModule::RegisterAudioCallback() failed");
|
||||
TSK_OBJECT_SAFE_FREE(_audioInstance);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if((_audioInstance->device->Init())) {
|
||||
if ((_audioInstance->device->Init())) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("AudioDeviceModule::Init() failed");
|
||||
TSK_OBJECT_SAFE_FREE(_audioInstance);
|
||||
goto done;
|
||||
|
@ -227,12 +227,12 @@ int audio_opensles_instance_prepare_consumer(audio_opensles_instance_handle_t* _
|
|||
{
|
||||
audio_opensles_instance_t* self = (audio_opensles_instance_t*)_self;
|
||||
const struct audio_consumer_opensles_s* consumer = (const struct audio_consumer_opensles_s*)*_consumer;
|
||||
if(!self || !self->device || !self->callback || !_consumer || !*_consumer) {
|
||||
if (!self || !self->device || !self->callback || !_consumer || !*_consumer) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("invalid parameter");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(self->isConsumerPrepared) {
|
||||
if (self->isConsumerPrepared) {
|
||||
AUDIO_OPENSLES_DEBUG_WARN("Consumer already prepared");
|
||||
return 0;
|
||||
}
|
||||
|
@ -244,34 +244,34 @@ int audio_opensles_instance_prepare_consumer(audio_opensles_instance_handle_t* _
|
|||
|
||||
self->callback->SetConsumer(consumer);
|
||||
|
||||
if((ret = self->device->SpeakerIsAvailable(&_bool))) {
|
||||
if ((ret = self->device->SpeakerIsAvailable(&_bool))) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("SpeakerIsAvailable() failed with error code=%d", ret);
|
||||
}
|
||||
else {
|
||||
if(!_bool) {
|
||||
if (!_bool) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("SpeakerIsAvailable() returned false");
|
||||
}
|
||||
self->isSpeakerAvailable = _bool;
|
||||
}
|
||||
|
||||
if((ret = self->device->InitSpeaker())) {
|
||||
if ((ret = self->device->InitSpeaker())) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("InitSpeaker() failed with error code=%d", ret);
|
||||
}
|
||||
else if((ret = self->device->SetSpeakerOn(audio_consumer_opensles_is_speakerOn(consumer)))) {
|
||||
else if ((ret = self->device->SetSpeakerOn(audio_consumer_opensles_is_speakerOn(consumer)))) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("SetSpeakerOn() failed with error code=%d", ret);
|
||||
}
|
||||
|
||||
if((ret = self->device->PlayoutIsAvailable(&_bool))) {
|
||||
if ((ret = self->device->PlayoutIsAvailable(&_bool))) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("PlayoutIsAvailable() failed with error code =%d", ret);
|
||||
}
|
||||
else {
|
||||
if(!_bool) {
|
||||
if (!_bool) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("PlayoutIsAvailable() returned false");
|
||||
}
|
||||
self->isPlayoutAvailable = _bool;
|
||||
}
|
||||
|
||||
if((ret = self->device->SetStereoPlayout(((*_consumer)->audio.in.channels == 2)))) {
|
||||
if ((ret = self->device->SetStereoPlayout(((*_consumer)->audio.in.channels == 2)))) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("SetStereoPlayout(%d==2) failed with error code=%d", (*_consumer)->audio.in.channels, ret);
|
||||
}
|
||||
|
||||
|
@ -279,28 +279,28 @@ int audio_opensles_instance_prepare_consumer(audio_opensles_instance_handle_t* _
|
|||
// AUDIO_OPENSLES_DEBUG_ERROR("SetPlayoutBuffer(%d ms) failed with error code=%d", (*_consumer)->audio.ptime, ret);
|
||||
//}
|
||||
// always request 10ms buffers
|
||||
if((ret = self->device->SetPlayoutBuffer(10))) {
|
||||
if ((ret = self->device->SetPlayoutBuffer(10))) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("SetPlayoutBuffer(%d ms) failed with error code=%d", 10, ret);
|
||||
}
|
||||
|
||||
int playoutSampleRate = (*_consumer)->audio.out.rate ? (*_consumer)->audio.out.rate : (*_consumer)->audio.in.rate;
|
||||
if((ret = self->device->SetPlayoutSampleRate(playoutSampleRate))) {
|
||||
if ((ret = self->device->SetPlayoutSampleRate(playoutSampleRate))) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("SetPlayoutSampleRate(%d) failed with error code=%d", playoutSampleRate, ret);
|
||||
}
|
||||
|
||||
if((ret = self->device->InitPlayout())) {
|
||||
if ((ret = self->device->InitPlayout())) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("AudioDeviceModule::InitPlayout() failed with error code = %d", ret);
|
||||
goto done;
|
||||
}
|
||||
|
||||
// init output parameters
|
||||
if((ret = self->device->StereoPlayout(&_bool))) {
|
||||
if ((ret = self->device->StereoPlayout(&_bool))) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("StereoPlayout() failed with error code=%d", ret);
|
||||
}
|
||||
else {
|
||||
(*_consumer)->audio.out.channels = (_bool ? 2 : 1);
|
||||
}
|
||||
if((ret = self->device->PlayoutSampleRate(&playoutSampleRate))) {
|
||||
if ((ret = self->device->PlayoutSampleRate(&playoutSampleRate))) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("PlayoutSampleRate() failed with error code=%d", ret);
|
||||
}
|
||||
else {
|
||||
|
@ -318,12 +318,12 @@ done:
|
|||
int audio_opensles_instance_prepare_producer(audio_opensles_instance_handle_t* _self, tmedia_producer_t** _producer)
|
||||
{
|
||||
audio_opensles_instance_t* self = (audio_opensles_instance_t*)_self;
|
||||
if(!self || !self->device || !self->callback || !_producer || !*_producer) {
|
||||
if (!self || !self->device || !self->callback || !_producer || !*_producer) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("invalid parameter");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(self->isProducerPrepared) {
|
||||
if (self->isProducerPrepared) {
|
||||
AUDIO_OPENSLES_DEBUG_WARN("Producer already prepared");
|
||||
return 0;
|
||||
}
|
||||
|
@ -335,52 +335,52 @@ int audio_opensles_instance_prepare_producer(audio_opensles_instance_handle_t* _
|
|||
|
||||
self->callback->SetProducer((const struct audio_producer_opensles_s*)*_producer);
|
||||
|
||||
if((ret = self->device->RecordingIsAvailable(&_bool))) {
|
||||
if ((ret = self->device->RecordingIsAvailable(&_bool))) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("RecordingIsAvailable() failed with error code =%d", ret);
|
||||
}
|
||||
else {
|
||||
if(!_bool) {
|
||||
if (!_bool) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("RecordingIsAvailable() returned false");
|
||||
}
|
||||
self->isRecordingAvailable = _bool;
|
||||
}
|
||||
|
||||
if((ret = self->device->MicrophoneIsAvailable(&_bool))) {
|
||||
if ((ret = self->device->MicrophoneIsAvailable(&_bool))) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("MicrophoneIsAvailable() failed with error code =%d", ret);
|
||||
}
|
||||
else {
|
||||
if(!_bool) {
|
||||
if (!_bool) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("MicrophoneIsAvailable() returned false");
|
||||
}
|
||||
else {
|
||||
if((ret = self->device->InitMicrophone())) {
|
||||
if ((ret = self->device->InitMicrophone())) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("InitMicrophone() failed with error code =%d", ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if((ret = self->device->SetStereoRecording(((*_producer)->audio.channels == 2)))) {
|
||||
if ((ret = self->device->SetStereoRecording(((*_producer)->audio.channels == 2)))) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("SetStereoRecording(%d==2) failed with error code=%d", (*_producer)->audio.channels, ret);
|
||||
}
|
||||
|
||||
int recordingSampleRate = (*_producer)->audio.rate;
|
||||
if((ret = self->device->SetRecordingSampleRate(recordingSampleRate))) {
|
||||
if ((ret = self->device->SetRecordingSampleRate(recordingSampleRate))) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("SetRecordingSampleRate(%d) failed with error code=%d", recordingSampleRate, ret);
|
||||
}
|
||||
|
||||
if((ret = self->device->InitRecording())) {
|
||||
if ((ret = self->device->InitRecording())) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("AudioDeviceModule::InitRecording() failed with error code = %d", ret);
|
||||
goto done;
|
||||
}
|
||||
|
||||
// init output parameters
|
||||
if((ret = self->device->StereoRecording(&_bool))) {
|
||||
if ((ret = self->device->StereoRecording(&_bool))) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("StereoRecording() failed with error code=%d", ret);
|
||||
}
|
||||
else {
|
||||
(*_producer)->audio.channels = (_bool ? 2 : 1);
|
||||
}
|
||||
if((ret = self->device->RecordingSampleRate(&recordingSampleRate))) {
|
||||
if ((ret = self->device->RecordingSampleRate(&recordingSampleRate))) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("RecordingSampleRate() failed with error code=%d", ret);
|
||||
}
|
||||
else {
|
||||
|
@ -398,25 +398,25 @@ done:
|
|||
int audio_opensles_instance_start_consumer(audio_opensles_instance_handle_t* _self)
|
||||
{
|
||||
audio_opensles_instance_t* self = (audio_opensles_instance_t*)_self;
|
||||
if(!self || !self->device || !self->callback) {
|
||||
if (!self || !self->device || !self->callback) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("invalid parameter");
|
||||
return -1;
|
||||
}
|
||||
|
||||
tsk_safeobj_lock(self);
|
||||
if(!self->isConsumerPrepared) {
|
||||
if (!self->isConsumerPrepared) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("Consumer not prepared");
|
||||
goto done;
|
||||
}
|
||||
|
||||
if(self->isConsumerStarted) {
|
||||
if (self->isConsumerStarted) {
|
||||
AUDIO_OPENSLES_DEBUG_WARN("Consumer already started");
|
||||
goto done;
|
||||
}
|
||||
|
||||
if(self->isPlayoutAvailable) {
|
||||
if (self->isPlayoutAvailable) {
|
||||
int ret;
|
||||
if((ret = self->device->StartPlayout())) {
|
||||
if ((ret = self->device->StartPlayout())) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("StartPlayout() failed with error code = %d", ret);
|
||||
}
|
||||
|
||||
|
@ -432,25 +432,25 @@ done:
|
|||
int audio_opensles_instance_start_producer(audio_opensles_instance_handle_t* _self)
|
||||
{
|
||||
audio_opensles_instance_t* self = (audio_opensles_instance_t*)_self;
|
||||
if(!self || !self->device || !self->callback) {
|
||||
if (!self || !self->device || !self->callback) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("invalid parameter");
|
||||
return -1;
|
||||
}
|
||||
|
||||
tsk_safeobj_lock(self);
|
||||
if(!self->isProducerPrepared) {
|
||||
if (!self->isProducerPrepared) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("Producer not prepared");
|
||||
goto done;
|
||||
}
|
||||
|
||||
if(self->isProducerStarted) {
|
||||
if (self->isProducerStarted) {
|
||||
AUDIO_OPENSLES_DEBUG_WARN("Consumer already started");
|
||||
goto done;
|
||||
}
|
||||
|
||||
if(self->isRecordingAvailable) {
|
||||
if (self->isRecordingAvailable) {
|
||||
int ret;
|
||||
if((ret = self->device->StartRecording())) {
|
||||
if ((ret = self->device->StartRecording())) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("StartRecording() failed with error code = %d", ret);
|
||||
}
|
||||
|
||||
|
@ -466,19 +466,19 @@ done:
|
|||
int audio_opensles_instance_stop_consumer(audio_opensles_instance_handle_t* _self)
|
||||
{
|
||||
audio_opensles_instance_t* self = (audio_opensles_instance_t*)_self;
|
||||
if(!self || !self->device || !self->callback) {
|
||||
if (!self || !self->device || !self->callback) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("invalid parameter");
|
||||
return -1;
|
||||
}
|
||||
|
||||
tsk_safeobj_lock(self);
|
||||
|
||||
if(!self->isConsumerStarted) {
|
||||
if (!self->isConsumerStarted) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
int ret;
|
||||
if((ret = self->device->StopPlayout())) {
|
||||
if ((ret = self->device->StopPlayout())) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("StopPlayout() failed with error code = %d", ret);
|
||||
}
|
||||
else {
|
||||
|
@ -494,19 +494,19 @@ done:
|
|||
int audio_opensles_instance_stop_producer(audio_opensles_instance_handle_t* _self)
|
||||
{
|
||||
audio_opensles_instance_t* self = (audio_opensles_instance_t*)_self;
|
||||
if(!self || !self->device || !self->callback) {
|
||||
if (!self || !self->device || !self->callback) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("invalid parameter");
|
||||
return -1;
|
||||
}
|
||||
|
||||
tsk_safeobj_lock(self);
|
||||
|
||||
if(!self->isProducerStarted) {
|
||||
if (!self->isProducerStarted) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
int ret;
|
||||
if((ret = self->device->StopRecording())) {
|
||||
if ((ret = self->device->StopRecording())) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("StopRecording() failed with error code = %d", ret);
|
||||
}
|
||||
else {
|
||||
|
@ -522,7 +522,7 @@ done:
|
|||
int audio_opensles_instance_set_speakerOn(audio_opensles_instance_handle_t* _self, bool speakerOn)
|
||||
{
|
||||
audio_opensles_instance_t* self = (audio_opensles_instance_t*)_self;
|
||||
if(!self || !self->device ) {
|
||||
if (!self || !self->device) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("Invalid parameter");
|
||||
return -1;
|
||||
}
|
||||
|
@ -532,7 +532,7 @@ int audio_opensles_instance_set_speakerOn(audio_opensles_instance_handle_t* _sel
|
|||
int audio_opensles_instance_set_microphone_volume(audio_opensles_instance_handle_t* _self, int32_t volume)
|
||||
{
|
||||
audio_opensles_instance_t* self = (audio_opensles_instance_t*)_self;
|
||||
if(!self || !self->device ) {
|
||||
if (!self || !self->device) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("Invalid parameter");
|
||||
return -1;
|
||||
}
|
||||
|
@ -541,12 +541,12 @@ int audio_opensles_instance_set_microphone_volume(audio_opensles_instance_handle
|
|||
|
||||
int audio_opensles_instance_destroy(audio_opensles_instance_handle_t** _self)
|
||||
{
|
||||
if(!_self || !*_self) {
|
||||
if (!_self || !*_self) {
|
||||
AUDIO_OPENSLES_DEBUG_ERROR("Invalid parameter");
|
||||
return -1;
|
||||
}
|
||||
tsk_list_lock(__audioInstances);
|
||||
if(tsk_object_get_refcount(*_self)==1) {
|
||||
if (tsk_object_get_refcount(*_self) == 1) {
|
||||
tsk_list_remove_item_by_data(__audioInstances, *_self);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -1,11 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
export NDK=/home/android-ndk-r10e
|
||||
export PREFIX_BASE=/home/openssl-1.1.0h/android
|
||||
export PREFIX_BASE=$(pwd)/android
|
||||
export HOST=arm-linux-androideabi
|
||||
export CPU=ARM
|
||||
|
||||
if [ w$1 = "wx86" ]
|
||||
if [ w$1 = "wx64" ]
|
||||
then
|
||||
echo "************************"
|
||||
echo " X64 "
|
||||
echo "************************"
|
||||
export HOST=x86_64-linux-android
|
||||
export CPU=x86_64
|
||||
export SYSROOT=$NDK/platforms/android-21/arch-x86_64
|
||||
export ANDROID_TOOLCHAIN=$(pwd)/my-android-toolchain-android-x86_64
|
||||
$NDK/build/tools/make-standalone-toolchain.sh --arch=x86_64 --platform=android-21 --install-dir=$ANDROID_TOOLCHAIN
|
||||
export CFLAGS='-fPIC' # For FFmpeg: '-fno-PIC'
|
||||
export LDFLAGS=''
|
||||
export OS=android64
|
||||
elif [ w$1 = "wx86" ]
|
||||
then
|
||||
echo "************************"
|
||||
echo " X86 "
|
||||
|
@ -14,10 +27,23 @@ then
|
|||
export CPU=x86
|
||||
export SYSROOT=$NDK/platforms/android-9/arch-x86
|
||||
export ANDROID_TOOLCHAIN=$(pwd)/my-android-toolchain-android-x86
|
||||
$NDK/build/tools/make-standalone-toolchain.sh --arch=x86 --platform=android-9 --arch=x86 --install-dir=$ANDROID_TOOLCHAIN
|
||||
$NDK/build/tools/make-standalone-toolchain.sh --arch=x86 --platform=android-9 --install-dir=$ANDROID_TOOLCHAIN
|
||||
export CFLAGS='-fPIC' # For FFmpeg: '-fno-PIC'
|
||||
export LDFLAGS=''
|
||||
export OS=android-x86
|
||||
elif [ w$1 = "warm64" ]
|
||||
then
|
||||
echo "************************"
|
||||
echo " ARM64 "
|
||||
echo "************************"
|
||||
export HOST=aarch64-linux-android
|
||||
export CPU=arm64
|
||||
export SYSROOT=$NDK/platforms/android-21/arch-arm64
|
||||
export ANDROID_TOOLCHAIN=$(pwd)/my-android-toolchain-android-arm64
|
||||
$NDK/build/tools/make-standalone-toolchain.sh --arch=arm64 --platform=android-21 --install-dir=$ANDROID_TOOLCHAIN
|
||||
export CFLAGS='-fPIC -D__ARMEL__ -DWEBRTC_DETECT_ARM_NEON -DWEBRTC_ARCH_ARM_NEON' # For FFmpeg: '-fno-PIC'
|
||||
export LDFLAGS=''
|
||||
export OS=android64-aarch64
|
||||
elif [ w$1 = "warmv7a" ]
|
||||
then
|
||||
echo "************************"
|
||||
|
@ -68,6 +94,9 @@ export CXX=$ANDROID_TOOLCHAIN/bin/$HOST-g++
|
|||
export AS=$ANDROID_TOOLCHAIN/bin/$HOST-gcc
|
||||
export RANLIB=$ANDROID_TOOLCHAIN/bin/$HOST-ranlib
|
||||
|
||||
export CFLAGS="${CFLAGS} -DANDROID=1 -fPIC"
|
||||
export CPPFLAGS=$CFLAGS
|
||||
|
||||
./Configure -no-shared --prefix=$PREFIX_BASE/$CPU --openssldir=$PREFIX_BASE/$CPU/openssl $OS -I$ANDROID_TOOLCHAIN/sysroot/ -I$ANDROID_TOOLCHAIN/sysroot/usr/include
|
||||
make clean
|
||||
make
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue