* #27232: jni: added pjproject checkout as regular git content
We will remove it once the next release of pjsip (with Android support)
comes out and is merged into SFLphone.
diff --git a/jni/pjproject-android/.svn/pristine/64/643b435ac1abd71a76a465c317ef74adda25d498.svn-base b/jni/pjproject-android/.svn/pristine/64/643b435ac1abd71a76a465c317ef74adda25d498.svn-base
new file mode 100644
index 0000000..c48ea8e
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/64/643b435ac1abd71a76a465c317ef74adda25d498.svn-base
@@ -0,0 +1,485 @@
+/*
+ * This file contains several sample settings especially for Windows
+ * Mobile and Symbian targets. You can include this file in your
+ * <pj/config_site.h> file.
+ *
+ * The Windows Mobile and Symbian settings will be activated
+ * automatically if you include this file.
+ *
+ * In addition, you may specify one of these macros (before including
+ * this file) to activate additional settings:
+ *
+ * #define PJ_CONFIG_NOKIA_APS_DIRECT
+ * Use this macro to activate the APS-Direct feature. Please see
+ * http://trac.pjsip.org/repos/wiki/Nokia_APS_VAS_Direct for more
+ * info.
+ *
+ * #define PJ_CONFIG_WIN32_WMME_DIRECT
+ * Configuration to activate "APS-Direct" media mode on Windows or
+ * Windows Mobile, useful for testing purposes only.
+ */
+
+
+/*
+ * Typical configuration for WinCE target.
+ */
+#if defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE!=0
+
+ /*
+ * PJLIB settings.
+ */
+
+ /* Disable floating point support */
+ #define PJ_HAS_FLOATING_POINT 0
+
+ /*
+ * PJMEDIA settings
+ */
+
+ /* Select codecs to disable */
+ #define PJMEDIA_HAS_L16_CODEC 0
+ #define PJMEDIA_HAS_ILBC_CODEC 0
+
+ /* We probably need more buffers on WM, so increase the limit */
+ #define PJMEDIA_SOUND_BUFFER_COUNT 32
+
+ /* Fine tune Speex's default settings for best performance/quality */
+ #define PJMEDIA_CODEC_SPEEX_DEFAULT_QUALITY 5
+
+ /* For CPU reason, disable speex AEC and use the echo suppressor. */
+ #define PJMEDIA_HAS_SPEEX_AEC 0
+
+ /* Previously, resampling is disabled due to performance reason and
+ * this condition prevented some 'light' wideband codecs (e.g: G722.1)
+ * to work along with narrowband codecs. Lately, some tests showed
+ * that 16kHz <-> 8kHz resampling using libresample small filter was
+ * affordable on ARM9 260 MHz, so here we decided to enable resampling.
+ * Note that it is important to make sure that libresample is created
+ * using small filter. For example PJSUA_DEFAULT_CODEC_QUALITY must
+ * be set to 3 or 4 so pjsua-lib will apply small filter resampling.
+ */
+ //#define PJMEDIA_RESAMPLE_IMP PJMEDIA_RESAMPLE_NONE
+ #define PJMEDIA_RESAMPLE_IMP PJMEDIA_RESAMPLE_LIBRESAMPLE
+
+ /* Use the lighter WSOLA implementation */
+ #define PJMEDIA_WSOLA_IMP PJMEDIA_WSOLA_IMP_WSOLA_LITE
+
+ /*
+ * PJSIP settings.
+ */
+
+ /* Set maximum number of dialog/transaction/calls to minimum to reduce
+ * memory usage
+ */
+ #define PJSIP_MAX_TSX_COUNT 31
+ #define PJSIP_MAX_DIALOG_COUNT 31
+ #define PJSUA_MAX_CALLS 4
+
+ /*
+ * PJSUA settings
+ */
+
+ /* Default codec quality, previously was set to 5, however it is now
+ * set to 4 to make sure pjsua instantiates resampler with small filter.
+ */
+ #define PJSUA_DEFAULT_CODEC_QUALITY 4
+
+ /* Set maximum number of objects to minimum to reduce memory usage */
+ #define PJSUA_MAX_ACC 4
+ #define PJSUA_MAX_PLAYERS 4
+ #define PJSUA_MAX_RECORDERS 4
+ #define PJSUA_MAX_CONF_PORTS (PJSUA_MAX_CALLS+2*PJSUA_MAX_PLAYERS)
+ #define PJSUA_MAX_BUDDIES 32
+
+#endif /* PJ_WIN32_WINCE */
+
+
+/*
+ * Typical configuration for Symbian OS target
+ */
+#if defined(PJ_SYMBIAN) && PJ_SYMBIAN!=0
+
+ /*
+ * PJLIB settings.
+ */
+
+ /* Disable floating point support */
+ #define PJ_HAS_FLOATING_POINT 0
+
+ /* Misc PJLIB setting */
+ #define PJ_MAXPATH 80
+
+ /* This is important for Symbian. Symbian lacks vsnprintf(), so
+ * if the log buffer is not long enough it's possible that
+ * large incoming packet will corrupt memory when the log tries
+ * to log the packet.
+ */
+ #define PJ_LOG_MAX_SIZE (PJSIP_MAX_PKT_LEN+500)
+
+ /* Since we don't have threads, log buffer can use static buffer
+ * rather than stack
+ */
+ #define PJ_LOG_USE_STACK_BUFFER 0
+
+ /* Disable check stack since it increases footprint */
+ #define PJ_OS_HAS_CHECK_STACK 0
+
+
+ /*
+ * PJMEDIA settings
+ */
+
+ /* Disable non-Symbian audio devices */
+ #define PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO 0
+ #define PJMEDIA_AUDIO_DEV_HAS_WMME 0
+
+ /* Select codecs to disable */
+ #define PJMEDIA_HAS_L16_CODEC 0
+ #define PJMEDIA_HAS_ILBC_CODEC 0
+ #define PJMEDIA_HAS_G722_CODEC 0
+
+ /* Fine tune Speex's default settings for best performance/quality */
+ #define PJMEDIA_CODEC_SPEEX_DEFAULT_QUALITY 5
+
+ /* For CPU reason, disable speex AEC and use the echo suppressor. */
+ #define PJMEDIA_HAS_SPEEX_AEC 0
+
+ /* Previously, resampling is disabled due to performance reason and
+ * this condition prevented some 'light' wideband codecs (e.g: G722.1)
+ * to work along with narrowband codecs. Lately, some tests showed
+ * that 16kHz <-> 8kHz resampling using libresample small filter was
+ * affordable on ARM9 222 MHz, so here we decided to enable resampling.
+ * Note that it is important to make sure that libresample is created
+ * using small filter. For example PJSUA_DEFAULT_CODEC_QUALITY must
+ * be set to 3 or 4 so pjsua-lib will apply small filter resampling.
+ */
+ //#define PJMEDIA_RESAMPLE_IMP PJMEDIA_RESAMPLE_NONE
+ #define PJMEDIA_RESAMPLE_IMP PJMEDIA_RESAMPLE_LIBRESAMPLE
+
+ /* Use the lighter WSOLA implementation */
+ #define PJMEDIA_WSOLA_IMP PJMEDIA_WSOLA_IMP_WSOLA_LITE
+
+ /* We probably need more buffers especially if MDA audio backend
+ * is used, so increase the limit
+ */
+ #define PJMEDIA_SOUND_BUFFER_COUNT 32
+
+ /*
+ * PJSIP settings.
+ */
+
+ /* Disable safe module access, since we don't use multithreading */
+ #define PJSIP_SAFE_MODULE 0
+
+ /* Use large enough packet size */
+ #define PJSIP_MAX_PKT_LEN 2000
+
+ /* Symbian has problem with too many large blocks */
+ #define PJSIP_POOL_LEN_ENDPT 1000
+ #define PJSIP_POOL_INC_ENDPT 1000
+ #define PJSIP_POOL_RDATA_LEN 2000
+ #define PJSIP_POOL_RDATA_INC 2000
+ #define PJSIP_POOL_LEN_TDATA 2000
+ #define PJSIP_POOL_INC_TDATA 512
+ #define PJSIP_POOL_LEN_UA 2000
+ #define PJSIP_POOL_INC_UA 1000
+ #define PJSIP_POOL_TSX_LAYER_LEN 256
+ #define PJSIP_POOL_TSX_LAYER_INC 256
+ #define PJSIP_POOL_TSX_LEN 512
+ #define PJSIP_POOL_TSX_INC 128
+
+ /*
+ * PJSUA settings.
+ */
+
+ /* Default codec quality, previously was set to 5, however it is now
+ * set to 4 to make sure pjsua instantiates resampler with small filter.
+ */
+ #define PJSUA_DEFAULT_CODEC_QUALITY 4
+
+ /* Set maximum number of dialog/transaction/calls to minimum */
+ #define PJSIP_MAX_TSX_COUNT 31
+ #define PJSIP_MAX_DIALOG_COUNT 31
+ #define PJSUA_MAX_CALLS 4
+
+ /* Other pjsua settings */
+ #define PJSUA_MAX_ACC 4
+ #define PJSUA_MAX_PLAYERS 4
+ #define PJSUA_MAX_RECORDERS 4
+ #define PJSUA_MAX_CONF_PORTS (PJSUA_MAX_CALLS+2*PJSUA_MAX_PLAYERS)
+ #define PJSUA_MAX_BUDDIES 32
+#endif
+
+
+/*
+ * Additional configuration to activate APS-Direct feature for
+ * Nokia S60 target
+ *
+ * Please see http://trac.pjsip.org/repos/wiki/Nokia_APS_VAS_Direct
+ */
+#ifdef PJ_CONFIG_NOKIA_APS_DIRECT
+
+ /* MUST use switchboard rather than the conference bridge */
+ #define PJMEDIA_CONF_USE_SWITCH_BOARD 1
+
+ /* Enable APS sound device backend and disable MDA & VAS */
+ #define PJMEDIA_AUDIO_DEV_HAS_SYMB_MDA 0
+ #define PJMEDIA_AUDIO_DEV_HAS_SYMB_APS 1
+ #define PJMEDIA_AUDIO_DEV_HAS_SYMB_VAS 0
+
+ /* Enable passthrough codec framework */
+ #define PJMEDIA_HAS_PASSTHROUGH_CODECS 1
+
+ /* And selectively enable which codecs are supported by the handset */
+ #define PJMEDIA_HAS_PASSTHROUGH_CODEC_PCMU 1
+ #define PJMEDIA_HAS_PASSTHROUGH_CODEC_PCMA 1
+ #define PJMEDIA_HAS_PASSTHROUGH_CODEC_AMR 1
+ #define PJMEDIA_HAS_PASSTHROUGH_CODEC_G729 1
+ #define PJMEDIA_HAS_PASSTHROUGH_CODEC_ILBC 1
+
+#endif
+
+
+/*
+ * Additional configuration to activate VAS-Direct feature for
+ * Nokia S60 target
+ *
+ * Please see http://trac.pjsip.org/repos/wiki/Nokia_APS_VAS_Direct
+ */
+#ifdef PJ_CONFIG_NOKIA_VAS_DIRECT
+
+ /* MUST use switchboard rather than the conference bridge */
+ #define PJMEDIA_CONF_USE_SWITCH_BOARD 1
+
+ /* Enable VAS sound device backend and disable MDA & APS */
+ #define PJMEDIA_AUDIO_DEV_HAS_SYMB_MDA 0
+ #define PJMEDIA_AUDIO_DEV_HAS_SYMB_APS 0
+ #define PJMEDIA_AUDIO_DEV_HAS_SYMB_VAS 1
+
+ /* Enable passthrough codec framework */
+ #define PJMEDIA_HAS_PASSTHROUGH_CODECS 1
+
+ /* And selectively enable which codecs are supported by the handset */
+ #define PJMEDIA_HAS_PASSTHROUGH_CODEC_PCMU 1
+ #define PJMEDIA_HAS_PASSTHROUGH_CODEC_PCMA 1
+ #define PJMEDIA_HAS_PASSTHROUGH_CODEC_AMR 1
+ #define PJMEDIA_HAS_PASSTHROUGH_CODEC_G729 1
+ #define PJMEDIA_HAS_PASSTHROUGH_CODEC_ILBC 1
+
+#endif
+
+
+/*
+ * Configuration to activate "APS-Direct" media mode on Windows,
+ * useful for testing purposes only.
+ */
+#ifdef PJ_CONFIG_WIN32_WMME_DIRECT
+
+ /* MUST use switchboard rather than the conference bridge */
+ #define PJMEDIA_CONF_USE_SWITCH_BOARD 1
+
+ /* Only WMME supports the "direct" feature */
+ #define PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO 0
+ #define PJMEDIA_AUDIO_DEV_HAS_WMME 1
+
+ /* Enable passthrough codec framework */
+ #define PJMEDIA_HAS_PASSTHROUGH_CODECS 1
+
+ /* Only PCMA and PCMU are supported by WMME-direct */
+ #define PJMEDIA_HAS_PASSTHROUGH_CODEC_PCMU 1
+ #define PJMEDIA_HAS_PASSTHROUGH_CODEC_PCMA 1
+ #define PJMEDIA_HAS_PASSTHROUGH_CODEC_AMR 0
+ #define PJMEDIA_HAS_PASSTHROUGH_CODEC_G729 0
+ #define PJMEDIA_HAS_PASSTHROUGH_CODEC_ILBC 0
+
+#endif
+
+/*
+ * iPhone sample settings.
+ */
+#if PJ_CONFIG_IPHONE
+ /*
+ * PJLIB settings.
+ */
+
+ /* Both armv6 and armv7 has FP hardware support.
+ * See https://trac.pjsip.org/repos/ticket/1589 for more info
+ */
+ #define PJ_HAS_FLOATING_POINT 1
+
+ /*
+ * PJMEDIA settings
+ */
+
+ /* We have our own native CoreAudio backend */
+ #define PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO 0
+ #define PJMEDIA_AUDIO_DEV_HAS_WMME 0
+ #define PJMEDIA_AUDIO_DEV_HAS_COREAUDIO 1
+
+ /* The CoreAudio backend has built-in echo canceller! */
+ #define PJMEDIA_HAS_SPEEX_AEC 0
+
+ /* Disable some codecs */
+ #define PJMEDIA_HAS_L16_CODEC 0
+ #define PJMEDIA_HAS_G722_CODEC 0
+
+ /* Use the built-in CoreAudio's iLBC codec (yay!) */
+ #define PJMEDIA_HAS_ILBC_CODEC 1
+ #define PJMEDIA_ILBC_CODEC_USE_COREAUDIO 1
+
+ /* Fine tune Speex's default settings for best performance/quality */
+ #define PJMEDIA_CODEC_SPEEX_DEFAULT_QUALITY 5
+
+ /*
+ * PJSIP settings.
+ */
+
+ /* Increase allowable packet size, just in case */
+ //#define PJSIP_MAX_PKT_LEN 2000
+
+ /*
+ * PJSUA settings.
+ */
+
+ /* Default codec quality, previously was set to 5, however it is now
+ * set to 4 to make sure pjsua instantiates resampler with small filter.
+ */
+ #define PJSUA_DEFAULT_CODEC_QUALITY 4
+
+ /* Set maximum number of dialog/transaction/calls to minimum */
+ #define PJSIP_MAX_TSX_COUNT 31
+ #define PJSIP_MAX_DIALOG_COUNT 31
+ #define PJSUA_MAX_CALLS 4
+
+ /* Other pjsua settings */
+ #define PJSUA_MAX_ACC 4
+ #define PJSUA_MAX_PLAYERS 4
+ #define PJSUA_MAX_RECORDERS 4
+ #define PJSUA_MAX_CONF_PORTS (PJSUA_MAX_CALLS+2*PJSUA_MAX_PLAYERS)
+ #define PJSUA_MAX_BUDDIES 32
+
+#endif
+
+/*
+ * Android sample settings.
+ */
+#if PJ_CONFIG_ANDROID
+
+ #define PJ_ANDROID 1
+
+ /*
+ * PJLIB settings.
+ */
+
+ /* Disable floating point support */
+ #undef PJ_HAS_FLOATING_POINT
+ #define PJ_HAS_FLOATING_POINT 0
+
+ /*
+ * PJMEDIA settings
+ */
+
+ /* We have our own OpenSL ES backend */
+ #define PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO 0
+ #define PJMEDIA_AUDIO_DEV_HAS_WMME 0
+ #define PJMEDIA_AUDIO_DEV_HAS_OPENSL 1
+ #define PJMEDIA_AUDIO_DEV_HAS_ANDROID_JNI 0
+
+ /* Disable some codecs */
+ #define PJMEDIA_HAS_L16_CODEC 0
+ #define PJMEDIA_HAS_G722_CODEC 0
+
+ /* Fine tune Speex's default settings for best performance/quality */
+ #define PJMEDIA_CODEC_SPEEX_DEFAULT_QUALITY 5
+
+ /*
+ * PJSIP settings.
+ */
+
+ /* Increase allowable packet size, just in case */
+ //#define PJSIP_MAX_PKT_LEN 2000
+
+ /*
+ * PJSUA settings.
+ */
+
+ /* Default codec quality, previously was set to 5, however it is now
+ * set to 4 to make sure pjsua instantiates resampler with small filter.
+ */
+ #define PJSUA_DEFAULT_CODEC_QUALITY 4
+
+ /* Set maximum number of dialog/transaction/calls to minimum */
+ #define PJSIP_MAX_TSX_COUNT 31
+ #define PJSIP_MAX_DIALOG_COUNT 31
+ #define PJSUA_MAX_CALLS 4
+
+ /* Other pjsua settings */
+ #define PJSUA_MAX_ACC 4
+ #define PJSUA_MAX_PLAYERS 4
+ #define PJSUA_MAX_RECORDERS 4
+ #define PJSUA_MAX_CONF_PORTS (PJSUA_MAX_CALLS+2*PJSUA_MAX_PLAYERS)
+ #define PJSUA_MAX_BUDDIES 32
+#endif
+
+
+/*
+ * BB10
+ */
+#if defined(PJ_CONFIG_BB10) && PJ_CONFIG_BB10
+ /* Quality 3 - 4 to use resampling small filter */
+ #define PJSUA_DEFAULT_CODEC_QUALITY 4
+ #define PJMEDIA_HAS_LEGACY_SOUND_API 0
+ #undef PJMEDIA_HAS_SPEEX_AEC
+ #define PJMEDIA_HAS_SPEEX_AEC 0
+ #undef PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO
+ #define PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO 0
+#endif
+
+
+/*
+ * Minimum size
+ */
+#ifdef PJ_CONFIG_MINIMAL_SIZE
+
+# undef PJ_OS_HAS_CHECK_STACK
+# define PJ_OS_HAS_CHECK_STACK 0
+# define PJ_LOG_MAX_LEVEL 0
+# define PJ_ENABLE_EXTRA_CHECK 0
+# define PJ_HAS_ERROR_STRING 0
+# undef PJ_IOQUEUE_MAX_HANDLES
+/* Putting max handles to lower than 32 will make pj_fd_set_t size smaller
+ * than native fdset_t and will trigger assertion on sock_select.c.
+ */
+# define PJ_IOQUEUE_MAX_HANDLES 32
+# define PJ_CRC32_HAS_TABLES 0
+# define PJSIP_MAX_TSX_COUNT 15
+# define PJSIP_MAX_DIALOG_COUNT 15
+# define PJSIP_UDP_SO_SNDBUF_SIZE 4000
+# define PJSIP_UDP_SO_RCVBUF_SIZE 4000
+# define PJMEDIA_HAS_ALAW_ULAW_TABLE 0
+
+#elif defined(PJ_CONFIG_MAXIMUM_SPEED)
+# define PJ_SCANNER_USE_BITWISE 0
+# undef PJ_OS_HAS_CHECK_STACK
+# define PJ_OS_HAS_CHECK_STACK 0
+# define PJ_LOG_MAX_LEVEL 3
+# define PJ_ENABLE_EXTRA_CHECK 0
+# define PJ_IOQUEUE_MAX_HANDLES 5000
+# define PJSIP_MAX_TSX_COUNT ((640*1024)-1)
+# define PJSIP_MAX_DIALOG_COUNT ((640*1024)-1)
+# define PJSIP_UDP_SO_SNDBUF_SIZE (24*1024*1024)
+# define PJSIP_UDP_SO_RCVBUF_SIZE (24*1024*1024)
+# define PJ_DEBUG 0
+# define PJSIP_SAFE_MODULE 0
+# define PJ_HAS_STRICMP_ALNUM 0
+# define PJ_HASH_USE_OWN_TOLOWER 1
+# define PJSIP_UNESCAPE_IN_PLACE 1
+
+# if defined(PJ_WIN32) || defined(PJ_WIN64)
+# define PJSIP_MAX_NET_EVENTS 10
+# endif
+
+# define PJSUA_MAX_CALLS 512
+
+#endif
+
diff --git a/jni/pjproject-android/.svn/pristine/64/6446ff40c43703cbc0b19090ca439fad9548c15b.svn-base b/jni/pjproject-android/.svn/pristine/64/6446ff40c43703cbc0b19090ca439fad9548c15b.svn-base
new file mode 100644
index 0000000..53bcd28
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/64/6446ff40c43703cbc0b19090ca439fad9548c15b.svn-base
@@ -0,0 +1,170 @@
+/* Copyright (C) Jean-Marc Valin */
+/**
+ @file speex_echo.h
+ @brief Echo cancellation
+*/
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef SPEEX_ECHO_H
+#define SPEEX_ECHO_H
+/** @defgroup SpeexEchoState SpeexEchoState: Acoustic echo canceller
+ * This is the acoustic echo canceller module.
+ * @{
+ */
+#include "speex/speex_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Obtain frame size used by the AEC */
+#define SPEEX_ECHO_GET_FRAME_SIZE 3
+
+/** Set sampling rate */
+#define SPEEX_ECHO_SET_SAMPLING_RATE 24
+/** Get sampling rate */
+#define SPEEX_ECHO_GET_SAMPLING_RATE 25
+
+/* Can't set window sizes */
+/** Get size of impulse response (int32) */
+#define SPEEX_ECHO_GET_IMPULSE_RESPONSE_SIZE 27
+
+/* Can't set window content */
+/** Get impulse response (int32[]) */
+#define SPEEX_ECHO_GET_IMPULSE_RESPONSE 29
+
+/** Internal echo canceller state. Should never be accessed directly. */
+struct SpeexEchoState_;
+
+/** @class SpeexEchoState
+ * This holds the state of the echo canceller. You need one per channel.
+*/
+
+/** Internal echo canceller state. Should never be accessed directly. */
+typedef struct SpeexEchoState_ SpeexEchoState;
+
+/** Creates a new echo canceller state
+ * @param frame_size Number of samples to process at one time (should correspond to 10-20 ms)
+ * @param filter_length Number of samples of echo to cancel (should generally correspond to 100-500 ms)
+ * @return Newly-created echo canceller state
+ */
+SpeexEchoState *speex_echo_state_init(int frame_size, int filter_length);
+
+/** Creates a new multi-channel echo canceller state
+ * @param frame_size Number of samples to process at one time (should correspond to 10-20 ms)
+ * @param filter_length Number of samples of echo to cancel (should generally correspond to 100-500 ms)
+ * @param nb_mic Number of microphone channels
+ * @param nb_speakers Number of speaker channels
+ * @return Newly-created echo canceller state
+ */
+SpeexEchoState *speex_echo_state_init_mc(int frame_size, int filter_length, int nb_mic, int nb_speakers);
+
+/** Destroys an echo canceller state
+ * @param st Echo canceller state
+*/
+void speex_echo_state_destroy(SpeexEchoState *st);
+
+/** Performs echo cancellation a frame, based on the audio sent to the speaker (no delay is added
+ * to playback in this form)
+ *
+ * @param st Echo canceller state
+ * @param rec Signal from the microphone (near end + far end echo)
+ * @param play Signal played to the speaker (received from far end)
+ * @param out Returns near-end signal with echo removed
+ */
+void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *rec, const spx_int16_t *play, spx_int16_t *out);
+
+/** Performs echo cancellation a frame (deprecated) */
+void speex_echo_cancel(SpeexEchoState *st, const spx_int16_t *rec, const spx_int16_t *play, spx_int16_t *out, spx_int32_t *Yout);
+
+/** Perform echo cancellation using internal playback buffer, which is delayed by two frames
+ * to account for the delay introduced by most soundcards (but it could be off!)
+ * @param st Echo canceller state
+ * @param rec Signal from the microphone (near end + far end echo)
+ * @param out Returns near-end signal with echo removed
+*/
+void speex_echo_capture(SpeexEchoState *st, const spx_int16_t *rec, spx_int16_t *out);
+
+/** Let the echo canceller know that a frame was just queued to the soundcard
+ * @param st Echo canceller state
+ * @param play Signal played to the speaker (received from far end)
+*/
+void speex_echo_playback(SpeexEchoState *st, const spx_int16_t *play);
+
+/** Reset the echo canceller to its original state
+ * @param st Echo canceller state
+ */
+void speex_echo_state_reset(SpeexEchoState *st);
+
+/** Used like the ioctl function to control the echo canceller parameters
+ *
+ * @param st Echo canceller state
+ * @param request ioctl-type request (one of the SPEEX_ECHO_* macros)
+ * @param ptr Data exchanged to-from function
+ * @return 0 if no error, -1 if request in unknown
+ */
+int speex_echo_ctl(SpeexEchoState *st, int request, void *ptr);
+
+
+
+struct SpeexDecorrState_;
+
+typedef struct SpeexDecorrState_ SpeexDecorrState;
+
+
+/** Create a state for the channel decorrelation algorithm
+ This is useful for multi-channel echo cancellation only
+ * @param rate Sampling rate
+ * @param channels Number of channels (it's a bit pointless if you don't have at least 2)
+ * @param frame_size Size of the frame to process at ones (counting samples *per* channel)
+*/
+SpeexDecorrState *speex_decorrelate_new(int rate, int channels, int frame_size);
+
+/** Remove correlation between the channels by modifying the phase and possibly
+ adding noise in a way that is not (or little) perceptible.
+ * @param st Decorrelator state
+ * @param in Input audio in interleaved format
+ * @param out Result of the decorrelation (out *may* alias in)
+ * @param strength How much alteration of the audio to apply from 0 to 100.
+*/
+void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_int16_t *out, int strength);
+
+/** Destroy a Decorrelation state
+ * @param st State to destroy
+*/
+void speex_decorrelate_destroy(SpeexDecorrState *st);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+/** @}*/
+#endif
diff --git a/jni/pjproject-android/.svn/pristine/64/645d03b4c789347cc24a5db27a0a932b0e2d7971.svn-base b/jni/pjproject-android/.svn/pristine/64/645d03b4c789347cc24a5db27a0a932b0e2d7971.svn-base
new file mode 100644
index 0000000..14ec287
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/64/645d03b4c789347cc24a5db27a0a932b0e2d7971.svn-base
@@ -0,0 +1,515 @@
+/* $Id$ */
+/*
+ * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
+ * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#ifndef __PJPP_PROACTOR_HPP__
+#define __PJPP_PROACTOR_HPP__
+
+#include <pj/ioqueue.h>
+#include <pj++/pool.hpp>
+#include <pj++/sock.hpp>
+#include <pj++/timer.hpp>
+#include <pj/errno.h>
+
+class Pj_Proactor;
+class Pj_Event_Handler;
+
+
+//////////////////////////////////////////////////////////////////////////////
+// Asynchronous operation key.
+//
+// Applications may inheric this class to put their application
+// specific data.
+//
+class Pj_Async_Op : public pj_ioqueue_op_key_t
+{
+public:
+ //
+ // Construct with null handler.
+ // App must call set_handler() before use.
+ //
+ Pj_Async_Op()
+ : handler_(NULL)
+ {
+ pj_ioqueue_op_key_init(this, sizeof(*this));
+ }
+
+ //
+ // Constructor.
+ //
+ explicit Pj_Async_Op(Pj_Event_Handler *handler)
+ : handler_(handler)
+ {
+ pj_ioqueue_op_key_init(this, sizeof(*this));
+ }
+
+ //
+ // Set handler.
+ //
+ void set_handler(Pj_Event_Handler *handler)
+ {
+ handler_ = handler;
+ }
+
+ //
+ // Check whether operation is still pending for this key.
+ //
+ bool is_pending();
+
+ //
+ // Cancel the operation.
+ //
+ bool cancel(pj_ssize_t bytes_status=-PJ_ECANCELLED);
+
+protected:
+ Pj_Event_Handler *handler_;
+};
+
+
+//////////////////////////////////////////////////////////////////////////////
+// Event handler.
+//
+// Applications should inherit this class to receive various event
+// notifications.
+//
+// Applications should implement get_socket_handle().
+//
+class Pj_Event_Handler : public Pj_Object
+{
+ friend class Pj_Proactor;
+public:
+ //
+ // Default constructor.
+ //
+ Pj_Event_Handler()
+ : key_(NULL)
+ {
+ pj_memset(&timer_, 0, sizeof(timer_));
+ timer_.user_data = this;
+ timer_.cb = &timer_callback;
+ }
+
+ //
+ // Destroy.
+ //
+ virtual ~Pj_Event_Handler()
+ {
+ unregister();
+ }
+
+ //
+ // Unregister this handler from the ioqueue.
+ //
+ void unregister()
+ {
+ if (key_) {
+ pj_ioqueue_unregister(key_);
+ key_ = NULL;
+ }
+ }
+
+ //
+ // Get socket handle associated with this.
+ //
+ virtual pj_sock_t get_socket_handle()
+ {
+ return PJ_INVALID_SOCKET;
+ }
+
+ //
+ // Start async receive.
+ //
+ pj_status_t recv( Pj_Async_Op *op_key,
+ void *buf, pj_ssize_t *len,
+ unsigned flags)
+ {
+ return pj_ioqueue_recv( key_, op_key,
+ buf, len, flags);
+ }
+
+ //
+ // Start async recvfrom()
+ //
+ pj_status_t recvfrom( Pj_Async_Op *op_key,
+ void *buf, pj_ssize_t *len, unsigned flags,
+ Pj_Inet_Addr *addr)
+ {
+ addr->addrlen_ = sizeof(Pj_Inet_Addr);
+ return pj_ioqueue_recvfrom( key_, op_key, buf, len, flags,
+ addr, &addr->addrlen_ );
+ }
+
+ //
+ // Start async send()
+ //
+ pj_status_t send( Pj_Async_Op *op_key,
+ const void *data, pj_ssize_t *len,
+ unsigned flags)
+ {
+ return pj_ioqueue_send( key_, op_key, data, len, flags);
+ }
+
+ //
+ // Start async sendto()
+ //
+ pj_status_t sendto( Pj_Async_Op *op_key,
+ const void *data, pj_ssize_t *len, unsigned flags,
+ const Pj_Inet_Addr &addr)
+ {
+ return pj_ioqueue_sendto(key_, op_key, data, len, flags,
+ &addr, sizeof(addr));
+ }
+
+#if PJ_HAS_TCP
+ //
+ // Start async connect()
+ //
+ pj_status_t connect(const Pj_Inet_Addr &addr)
+ {
+ return pj_ioqueue_connect(key_, &addr, sizeof(addr));
+ }
+
+ //
+ // Start async accept().
+ //
+ pj_status_t accept( Pj_Async_Op *op_key,
+ Pj_Socket *sock,
+ Pj_Inet_Addr *local = NULL,
+ Pj_Inet_Addr *remote = NULL)
+ {
+ int *addrlen = local ? &local->addrlen_ : NULL;
+ return pj_ioqueue_accept( key_, op_key, &sock->sock_,
+ local, remote, addrlen );
+ }
+
+#endif
+
+protected:
+ //////////////////
+ // Overridables
+ //////////////////
+
+ //
+ // Timeout callback.
+ //
+ virtual void on_timeout(int)
+ {
+ }
+
+ //
+ // On read complete callback.
+ //
+ virtual void on_read_complete( Pj_Async_Op*, pj_ssize_t)
+ {
+ }
+
+ //
+ // On write complete callback.
+ //
+ virtual void on_write_complete( Pj_Async_Op *, pj_ssize_t)
+ {
+ }
+
+#if PJ_HAS_TCP
+ //
+ // On connect complete callback.
+ //
+ virtual void on_connect_complete(pj_status_t)
+ {
+ }
+
+ //
+ // On new connection callback.
+ //
+ virtual void on_accept_complete( Pj_Async_Op*, pj_sock_t, pj_status_t)
+ {
+ }
+
+#endif
+
+
+private:
+ pj_ioqueue_key_t *key_;
+ pj_timer_entry timer_;
+
+ friend class Pj_Proactor;
+ friend class Pj_Async_Op;
+
+ //
+ // Static timer callback.
+ //
+ static void timer_callback( pj_timer_heap_t*,
+ struct pj_timer_entry *entry)
+ {
+ Pj_Event_Handler *handler =
+ (Pj_Event_Handler*) entry->user_data;
+
+ handler->on_timeout(entry->id);
+ }
+};
+
+inline bool Pj_Async_Op::is_pending()
+{
+ return pj_ioqueue_is_pending(handler_->key_, this) != 0;
+}
+
+inline bool Pj_Async_Op::cancel(pj_ssize_t bytes_status)
+{
+ return pj_ioqueue_post_completion(handler_->key_, this,
+ bytes_status) == PJ_SUCCESS;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// Proactor
+//
+class Pj_Proactor : public Pj_Object
+{
+public:
+ //
+ // Default constructor, initializes to NULL.
+ //
+ Pj_Proactor()
+ : ioq_(NULL), th_(NULL)
+ {
+ cb_.on_read_complete = &read_complete_cb;
+ cb_.on_write_complete = &write_complete_cb;
+ cb_.on_accept_complete = &accept_complete_cb;
+ cb_.on_connect_complete = &connect_complete_cb;
+ }
+
+ //
+ // Construct proactor.
+ //
+ Pj_Proactor( Pj_Pool *pool, pj_size_t max_fd,
+ pj_size_t max_timer_entries )
+ : ioq_(NULL), th_(NULL)
+ {
+ cb_.on_read_complete = &read_complete_cb;
+ cb_.on_write_complete = &write_complete_cb;
+ cb_.on_accept_complete = &accept_complete_cb;
+ cb_.on_connect_complete = &connect_complete_cb;
+
+ create(pool, max_fd, max_timer_entries);
+ }
+
+ //
+ // Destructor.
+ //
+ ~Pj_Proactor()
+ {
+ destroy();
+ }
+
+ //
+ // Create proactor.
+ //
+ pj_status_t create( Pj_Pool *pool, pj_size_t max_fd,
+ pj_size_t timer_entry_count)
+ {
+ pj_status_t status;
+
+ destroy();
+
+ status = pj_ioqueue_create(pool->pool_(), max_fd, &ioq_);
+ if (status != PJ_SUCCESS)
+ return status;
+
+ status = pj_timer_heap_create(pool->pool_(),
+ timer_entry_count, &th_);
+ if (status != PJ_SUCCESS) {
+ pj_ioqueue_destroy(ioq_);
+ ioq_ = NULL;
+ return NULL;
+ }
+
+ return status;
+ }
+
+ //
+ // Destroy proactor.
+ //
+ void destroy()
+ {
+ if (ioq_) {
+ pj_ioqueue_destroy(ioq_);
+ ioq_ = NULL;
+ }
+ if (th_) {
+ pj_timer_heap_destroy(th_);
+ th_ = NULL;
+ }
+ }
+
+ //
+ // Register handler.
+ // This will call handler->get_socket_handle()
+ //
+ pj_status_t register_socket_handler(Pj_Pool *pool,
+ Pj_Event_Handler *handler)
+ {
+ return pj_ioqueue_register_sock( pool->pool_(), ioq_,
+ handler->get_socket_handle(),
+ handler, &cb_, &handler->key_ );
+ }
+
+ //
+ // Unregister handler.
+ //
+ static void unregister_handler(Pj_Event_Handler *handler)
+ {
+ if (handler->key_) {
+ pj_ioqueue_unregister( handler->key_ );
+ handler->key_ = NULL;
+ }
+ }
+
+ //
+ // Scheduler timer.
+ //
+ bool schedule_timer( Pj_Event_Handler *handler,
+ const Pj_Time_Val &delay,
+ int id=-1)
+ {
+ return schedule_timer(th_, handler, delay, id);
+ }
+
+ //
+ // Cancel timer.
+ //
+ bool cancel_timer(Pj_Event_Handler *handler)
+ {
+ return pj_timer_heap_cancel(th_, &handler->timer_) == 1;
+ }
+
+ //
+ // Handle events.
+ //
+ int handle_events(Pj_Time_Val *max_timeout)
+ {
+ Pj_Time_Val timeout(0, 0);
+ int timer_count;
+
+ timer_count = pj_timer_heap_poll( th_, &timeout );
+
+ if (timeout.get_sec() < 0)
+ timeout.sec = PJ_MAXINT32;
+
+ /* If caller specifies maximum time to wait, then compare the value
+ * with the timeout to wait from timer, and use the minimum value.
+ */
+ if (max_timeout && timeout >= *max_timeout) {
+ timeout = *max_timeout;
+ }
+
+ /* Poll events in ioqueue. */
+ int ioqueue_count;
+
+ ioqueue_count = pj_ioqueue_poll(ioq_, &timeout);
+ if (ioqueue_count < 0)
+ return ioqueue_count;
+
+ return ioqueue_count + timer_count;
+ }
+
+ //
+ // Get the internal ioqueue object.
+ //
+ pj_ioqueue_t *get_io_queue()
+ {
+ return ioq_;
+ }
+
+ //
+ // Get the internal timer heap object.
+ //
+ pj_timer_heap_t *get_timer_heap()
+ {
+ return th_;
+ }
+
+private:
+ pj_ioqueue_t *ioq_;
+ pj_timer_heap_t *th_;
+ pj_ioqueue_callback cb_;
+
+ static bool schedule_timer( pj_timer_heap_t *timer,
+ Pj_Event_Handler *handler,
+ const Pj_Time_Val &delay,
+ int id=-1)
+ {
+ handler->timer_.id = id;
+ return pj_timer_heap_schedule(timer, &handler->timer_, &delay) == 0;
+ }
+
+
+ //
+ // Static read completion callback.
+ //
+ static void read_complete_cb( pj_ioqueue_key_t *key,
+ pj_ioqueue_op_key_t *op_key,
+ pj_ssize_t bytes_read)
+ {
+ Pj_Event_Handler *handler =
+ (Pj_Event_Handler*) pj_ioqueue_get_user_data(key);
+
+ handler->on_read_complete((Pj_Async_Op*)op_key, bytes_read);
+ }
+
+ //
+ // Static write completion callback.
+ //
+ static void write_complete_cb(pj_ioqueue_key_t *key,
+ pj_ioqueue_op_key_t *op_key,
+ pj_ssize_t bytes_sent)
+ {
+ Pj_Event_Handler *handler =
+ (Pj_Event_Handler*) pj_ioqueue_get_user_data(key);
+
+ handler->on_write_complete((Pj_Async_Op*)op_key, bytes_sent);
+ }
+
+ //
+ // Static accept completion callback.
+ //
+ static void accept_complete_cb(pj_ioqueue_key_t *key,
+ pj_ioqueue_op_key_t *op_key,
+ pj_sock_t new_sock,
+ pj_status_t status)
+ {
+ Pj_Event_Handler *handler =
+ (Pj_Event_Handler*) pj_ioqueue_get_user_data(key);
+
+ handler->on_accept_complete((Pj_Async_Op*)op_key, new_sock, status);
+ }
+
+ //
+ // Static connect completion callback.
+ //
+ static void connect_complete_cb(pj_ioqueue_key_t *key,
+ pj_status_t status)
+ {
+ Pj_Event_Handler *handler =
+ (Pj_Event_Handler*) pj_ioqueue_get_user_data(key);
+
+ handler->on_connect_complete(status);
+ }
+
+};
+
+#endif /* __PJPP_PROACTOR_HPP__ */
+
diff --git a/jni/pjproject-android/.svn/pristine/64/64680bb237c9264fa75f8c2ffce96c7c52a47808.svn-base b/jni/pjproject-android/.svn/pristine/64/64680bb237c9264fa75f8c2ffce96c7c52a47808.svn-base
new file mode 100644
index 0000000..57bda40
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/64/64680bb237c9264fa75f8c2ffce96c7c52a47808.svn-base
@@ -0,0 +1,284 @@
+/* $Id$ */
+/*
+ * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * This is implementation of legacy sound device API, for applications
+ * that still use the old/deprecated sound device API. This implementation
+ * uses the new Audio Device API.
+ *
+ * Please see http://trac.pjsip.org/repos/wiki/Audio_Dev_API for more
+ * information.
+ */
+
+#include <pjmedia/sound.h>
+#include <pjmedia-audiodev/errno.h>
+#include <pj/assert.h>
+
+#if PJMEDIA_HAS_LEGACY_SOUND_API
+
+static struct legacy_subsys
+{
+ pjmedia_snd_dev_info info[4];
+ unsigned info_counter;
+ unsigned user_rec_latency;
+ unsigned user_play_latency;
+} g_sys;
+
+struct pjmedia_snd_stream
+{
+ pj_pool_t *pool;
+ pjmedia_aud_stream *aud_strm;
+ pjmedia_snd_rec_cb user_rec_cb;
+ pjmedia_snd_play_cb user_play_cb;
+ void *user_user_data;
+};
+
+PJ_DEF(pj_status_t) pjmedia_snd_init(pj_pool_factory *factory)
+{
+ return pjmedia_aud_subsys_init(factory);
+}
+
+PJ_DEF(pj_status_t) pjmedia_snd_deinit(void)
+{
+ return pjmedia_aud_subsys_shutdown();
+}
+
+PJ_DEF(int) pjmedia_snd_get_dev_count(void)
+{
+ return pjmedia_aud_dev_count();
+}
+
+PJ_DEF(const pjmedia_snd_dev_info*) pjmedia_snd_get_dev_info(unsigned index)
+{
+ pjmedia_snd_dev_info *oi = &g_sys.info[g_sys.info_counter];
+ pjmedia_aud_dev_info di;
+
+ g_sys.info_counter = (g_sys.info_counter+1) % PJ_ARRAY_SIZE(g_sys.info);
+
+ if (pjmedia_aud_dev_get_info(index, &di) != PJ_SUCCESS)
+ return NULL;
+
+ pj_bzero(oi, sizeof(*oi));
+ pj_ansi_strncpy(oi->name, di.name, sizeof(oi->name));
+ oi->name[sizeof(oi->name)-1] = '\0';
+ oi->input_count = di.input_count;
+ oi->output_count = di.output_count;
+ oi->default_samples_per_sec = di.default_samples_per_sec;
+
+ return oi;
+}
+
+
+static pj_status_t snd_play_cb(void *user_data,
+ pjmedia_frame *frame)
+{
+ pjmedia_snd_stream *strm = (pjmedia_snd_stream*)user_data;
+
+ frame->type = PJMEDIA_FRAME_TYPE_AUDIO;
+ return strm->user_play_cb(strm->user_user_data,
+ frame->timestamp.u32.lo,
+ frame->buf,
+ (unsigned)frame->size);
+}
+
+static pj_status_t snd_rec_cb(void *user_data,
+ pjmedia_frame *frame)
+{
+ pjmedia_snd_stream *strm = (pjmedia_snd_stream*)user_data;
+ return strm->user_rec_cb(strm->user_user_data,
+ frame->timestamp.u32.lo,
+ frame->buf,
+ (unsigned)frame->size);
+}
+
+static pj_status_t open_stream( pjmedia_dir dir,
+ int rec_id,
+ int play_id,
+ unsigned clock_rate,
+ unsigned channel_count,
+ unsigned samples_per_frame,
+ unsigned bits_per_sample,
+ pjmedia_snd_rec_cb rec_cb,
+ pjmedia_snd_play_cb play_cb,
+ void *user_data,
+ pjmedia_snd_stream **p_snd_strm)
+{
+ pj_pool_t *pool;
+ pjmedia_snd_stream *snd_strm;
+ pjmedia_aud_param param;
+ pj_status_t status;
+
+ /* Initialize parameters */
+ if (dir & PJMEDIA_DIR_CAPTURE) {
+ status = pjmedia_aud_dev_default_param(rec_id, ¶m);
+ } else {
+ status = pjmedia_aud_dev_default_param(play_id, ¶m);
+ }
+ if (status != PJ_SUCCESS)
+ return status;
+
+ param.dir = dir;
+ param.rec_id = rec_id;
+ param.play_id = play_id;
+ param.clock_rate = clock_rate;
+ param.channel_count = channel_count;
+ param.samples_per_frame = samples_per_frame;
+ param.bits_per_sample = bits_per_sample;
+
+ /* Latencies setting */
+ if ((dir & PJMEDIA_DIR_CAPTURE) && g_sys.user_rec_latency) {
+ param.flags |= PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY;
+ param.input_latency_ms = g_sys.user_rec_latency;
+ }
+ if ((dir & PJMEDIA_DIR_PLAYBACK) && g_sys.user_play_latency) {
+ param.flags |= PJMEDIA_AUD_DEV_CAP_OUTPUT_LATENCY;
+ param.output_latency_ms = g_sys.user_play_latency;
+ }
+
+ /* Create sound wrapper */
+ pool = pj_pool_create(pjmedia_aud_subsys_get_pool_factory(),
+ "legacy-snd", 512, 512, NULL);
+ snd_strm = PJ_POOL_ZALLOC_T(pool, pjmedia_snd_stream);
+ snd_strm->pool = pool;
+ snd_strm->user_rec_cb = rec_cb;
+ snd_strm->user_play_cb = play_cb;
+ snd_strm->user_user_data = user_data;
+
+ /* Create the stream */
+ status = pjmedia_aud_stream_create(¶m, &snd_rec_cb,
+ &snd_play_cb, snd_strm,
+ &snd_strm->aud_strm);
+ if (status != PJ_SUCCESS) {
+ pj_pool_release(pool);
+ return status;
+ }
+
+ *p_snd_strm = snd_strm;
+ return PJ_SUCCESS;
+}
+
+PJ_DEF(pj_status_t) pjmedia_snd_open_rec( int index,
+ unsigned clock_rate,
+ unsigned channel_count,
+ unsigned samples_per_frame,
+ unsigned bits_per_sample,
+ pjmedia_snd_rec_cb rec_cb,
+ void *user_data,
+ pjmedia_snd_stream **p_snd_strm)
+{
+ return open_stream(PJMEDIA_DIR_CAPTURE, index, PJMEDIA_AUD_INVALID_DEV,
+ clock_rate, channel_count, samples_per_frame,
+ bits_per_sample, rec_cb, NULL,
+ user_data, p_snd_strm);
+}
+
+PJ_DEF(pj_status_t) pjmedia_snd_open_player( int index,
+ unsigned clock_rate,
+ unsigned channel_count,
+ unsigned samples_per_frame,
+ unsigned bits_per_sample,
+ pjmedia_snd_play_cb play_cb,
+ void *user_data,
+ pjmedia_snd_stream **p_snd_strm )
+{
+ return open_stream(PJMEDIA_DIR_PLAYBACK, PJMEDIA_AUD_INVALID_DEV, index,
+ clock_rate, channel_count, samples_per_frame,
+ bits_per_sample, NULL, play_cb,
+ user_data, p_snd_strm);
+}
+
+PJ_DEF(pj_status_t) pjmedia_snd_open( int rec_id,
+ int play_id,
+ unsigned clock_rate,
+ unsigned channel_count,
+ unsigned samples_per_frame,
+ unsigned bits_per_sample,
+ pjmedia_snd_rec_cb rec_cb,
+ pjmedia_snd_play_cb play_cb,
+ void *user_data,
+ pjmedia_snd_stream **p_snd_strm)
+{
+ return open_stream(PJMEDIA_DIR_CAPTURE_PLAYBACK, rec_id, play_id,
+ clock_rate, channel_count, samples_per_frame,
+ bits_per_sample, rec_cb, play_cb,
+ user_data, p_snd_strm);
+}
+
+PJ_DEF(pj_status_t) pjmedia_snd_stream_start(pjmedia_snd_stream *stream)
+{
+ return pjmedia_aud_stream_start(stream->aud_strm);
+}
+
+PJ_DEF(pj_status_t) pjmedia_snd_stream_stop(pjmedia_snd_stream *stream)
+{
+ return pjmedia_aud_stream_stop(stream->aud_strm);
+}
+
+PJ_DEF(pj_status_t) pjmedia_snd_stream_get_info(pjmedia_snd_stream *strm,
+ pjmedia_snd_stream_info *pi)
+{
+ pjmedia_aud_param param;
+ pj_status_t status;
+
+ status = pjmedia_aud_stream_get_param(strm->aud_strm, ¶m);
+ if (status != PJ_SUCCESS)
+ return status;
+
+ pj_bzero(pi, sizeof(*pi));
+ pi->dir = param.dir;
+ pi->play_id = param.play_id;
+ pi->rec_id = param.rec_id;
+ pi->clock_rate = param.clock_rate;
+ pi->channel_count = param.channel_count;
+ pi->samples_per_frame = param.samples_per_frame;
+ pi->bits_per_sample = param.bits_per_sample;
+
+ if (param.flags & PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY) {
+ pi->rec_latency = param.input_latency_ms;
+ }
+ if (param.flags & PJMEDIA_AUD_DEV_CAP_OUTPUT_LATENCY) {
+ pi->play_latency = param.output_latency_ms;
+ }
+
+ return PJ_SUCCESS;
+}
+
+
+PJ_DEF(pj_status_t) pjmedia_snd_stream_close(pjmedia_snd_stream *stream)
+{
+ pj_status_t status;
+
+ status = pjmedia_aud_stream_destroy(stream->aud_strm);
+ if (status != PJ_SUCCESS)
+ return status;
+
+ pj_pool_release(stream->pool);
+ return PJ_SUCCESS;
+}
+
+PJ_DEF(pj_status_t) pjmedia_snd_set_latency(unsigned input_latency,
+ unsigned output_latency)
+{
+ g_sys.user_rec_latency = input_latency;
+ g_sys.user_play_latency = output_latency;
+ return PJ_SUCCESS;
+}
+
+#endif /* PJMEDIA_HAS_LEGACY_SOUND_API */
+
diff --git a/jni/pjproject-android/.svn/pristine/64/64778829aadfb7c54f54195b9dc3ec244ac8865d.svn-base b/jni/pjproject-android/.svn/pristine/64/64778829aadfb7c54f54195b9dc3ec244ac8865d.svn-base
new file mode 100644
index 0000000..41dd7d4
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/64/64778829aadfb7c54f54195b9dc3ec244ac8865d.svn-base
@@ -0,0 +1,11 @@
+# $Id$
+#
+from inc_cfg import *
+
+# simple test
+test_param = TestParam(
+ "Resample (large filter) 11 KHZ to 16 KHZ",
+ [
+ InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 16000 --play-file wavs/input.11.wav --rec-file wavs/tmp.16.wav")
+ ]
+ )
diff --git a/jni/pjproject-android/.svn/pristine/64/64cd8c2e8b37d827714ef1f6e12e8ba97de89dfe.svn-base b/jni/pjproject-android/.svn/pristine/64/64cd8c2e8b37d827714ef1f6e12e8ba97de89dfe.svn-base
new file mode 100644
index 0000000..e1d729f
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/64/64cd8c2e8b37d827714ef1f6e12e8ba97de89dfe.svn-base
@@ -0,0 +1,24 @@
+/* $Id$ */
+/*
+ * Copyright (C) 2009-2011 Teluu Inc. (http://www.teluu.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * This file is a C++ wrapper, see ticket #886 for details.
+ */
+
+#include "xml.c"