* #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/14/140fc5d2d7cc4b0c5a3a4af64168c5f6dd099833.svn-base b/jni/pjproject-android/.svn/pristine/14/140fc5d2d7cc4b0c5a3a4af64168c5f6dd099833.svn-base
new file mode 100644
index 0000000..de9c29f
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/14/140fc5d2d7cc4b0c5a3a4af64168c5f6dd099833.svn-base
@@ -0,0 +1,609 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 2008-2011 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 
+ */
+
+#include <pjmedia.h>
+#include <pjlib-util.h>	/* pj_getopt */
+#include <pjlib.h>
+
+#include <stdlib.h>	/* atoi() */
+#include <stdio.h>
+
+#include "util.h"
+
+/**
+ * \page page_pjmedia_samples_confsample_c Samples: Using Conference Bridge
+ *
+ * Sample to mix multiple files in the conference bridge and play the
+ * result to sound device.
+ *
+ * This file is pjsip-apps/src/samples/confsample.c
+ *
+ * \includelineno confsample.c
+ */
+
+
+/* For logging purpose. */
+#define THIS_FILE   "confsample.c"
+
+
+/* Shall we put recorder in the conference */
+#define RECORDER    1
+
+
+static const char *desc = 
+ " FILE:								    \n"
+ "									    \n"
+ "  confsample.c							    \n"
+ "									    \n"
+ " PURPOSE:								    \n"
+ "									    \n"
+ "  Demonstrate how to use conference bridge.				    \n"
+ "									    \n"
+ " USAGE:								    \n"
+ "									    \n"
+ "  confsample [options] [file1.wav] [file2.wav] ...			    \n"
+ "									    \n"
+ " options:								    \n"
+ SND_USAGE
+ "									    \n"
+ "  fileN.wav are optional WAV files to be connected to the conference      \n"
+ "  bridge. The WAV files MUST have single channel (mono) and 16 bit PCM    \n"
+ "  samples. It can have arbitrary sampling rate.			    \n"
+ "									    \n"
+ " DESCRIPTION:								    \n"
+ "									    \n"
+ "  Here we create a conference bridge, with at least one port (port zero   \n"
+ "  is always created for the sound device).				    \n"
+ "									    \n"
+ "  If WAV files are specified, the WAV file player ports will be connected \n"
+ "  to slot starting from number one in the bridge. The WAV files can have  \n"
+ "  arbitrary sampling rate; the bridge will convert it to its clock rate.  \n"
+ "  However, the files MUST have a single audio channel only (i.e. mono).  \n";
+
+
+ 
+/* 
+ * Prototypes: 
+ */
+
+/* List the ports in the conference bridge */
+static void conf_list(pjmedia_conf *conf, pj_bool_t detail);
+
+/* Display VU meter */
+static void monitor_level(pjmedia_conf *conf, int slot, int dir, int dur);
+
+
+/* Show usage */
+static void usage(void)
+{
+    puts("");
+    puts(desc);
+}
+
+
+
+/* Input simple string */
+static pj_bool_t input(const char *title, char *buf, pj_size_t len)
+{
+    char *p;
+
+    printf("%s (empty to cancel): ", title); fflush(stdout);
+    if (fgets(buf, (int)len, stdin) == NULL)
+	return PJ_FALSE;
+
+    /* Remove trailing newlines. */
+    for (p=buf; ; ++p) {
+	if (*p=='\r' || *p=='\n') *p='\0';
+	else if (!*p) break;
+    }
+
+    if (!*buf)
+	return PJ_FALSE;
+    
+    return PJ_TRUE;
+}
+
+
+/*****************************************************************************
+ * main()
+ */
+int main(int argc, char *argv[])
+{
+    int dev_id = -1;
+    int clock_rate = CLOCK_RATE;
+    int channel_count = NCHANNELS;
+    int samples_per_frame = NSAMPLES;
+    int bits_per_sample = NBITS;
+
+    pj_caching_pool cp;
+    pjmedia_endpt *med_endpt;
+    pj_pool_t *pool;
+    pjmedia_conf *conf;
+
+    int i, port_count, file_count;
+    pjmedia_port **file_port;	/* Array of file ports */
+    pjmedia_port *rec_port = NULL;  /* Wav writer port */
+
+    char tmp[10];
+    pj_status_t status;
+
+
+    /* Must init PJLIB first: */
+    status = pj_init();
+    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+    /* Get command line options. */
+    if (get_snd_options(THIS_FILE, argc, argv, &dev_id, &clock_rate,
+			&channel_count, &samples_per_frame, &bits_per_sample))
+    {
+	usage();
+	return 1;
+    }
+
+    /* Must create a pool factory before we can allocate any memory. */
+    pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0);
+
+    /* 
+     * Initialize media endpoint.
+     * This will implicitly initialize PJMEDIA too.
+     */
+    status = pjmedia_endpt_create(&cp.factory, NULL, 1, &med_endpt);
+    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+    /* Create memory pool to allocate memory */
+    pool = pj_pool_create( &cp.factory,	    /* pool factory	    */
+			   "wav",	    /* pool name.	    */
+			   4000,	    /* init size	    */
+			   4000,	    /* increment size	    */
+			   NULL		    /* callback on error    */
+			   );
+
+
+    file_count = argc - pj_optind;
+    port_count = file_count + 1 + RECORDER;
+
+    /* Create the conference bridge. 
+     * With default options (zero), the bridge will create an instance of
+     * sound capture and playback device and connect them to slot zero.
+     */
+    status = pjmedia_conf_create( pool,	    /* pool to use	    */
+				  port_count,/* number of ports	    */
+				  clock_rate,
+				  channel_count,
+				  samples_per_frame,
+				  bits_per_sample,
+				  0,	    /* options		    */
+				  &conf	    /* result		    */
+				  );
+    if (status != PJ_SUCCESS) {
+	app_perror(THIS_FILE, "Unable to create conference bridge", status);
+	return 1;
+    }
+
+#if RECORDER
+    status = pjmedia_wav_writer_port_create(  pool, "confrecord.wav",
+					      clock_rate, channel_count,
+					      samples_per_frame, 
+					      bits_per_sample, 0, 0, 
+					      &rec_port);
+    if (status != PJ_SUCCESS) {
+	app_perror(THIS_FILE, "Unable to create WAV writer", status);
+	return 1;
+    }
+
+    pjmedia_conf_add_port(conf, pool, rec_port, NULL, NULL);
+#endif
+
+
+    /* Create file ports. */
+    file_port = pj_pool_alloc(pool, file_count * sizeof(pjmedia_port*));
+
+    for (i=0; i<file_count; ++i) {
+
+	/* Load the WAV file to file port. */
+	status = pjmedia_wav_player_port_create( 
+			pool,		    /* pool.	    */
+			argv[i+pj_optind],  /* filename	    */
+			0,		    /* use default ptime */
+			0,		    /* flags	    */
+			0,		    /* buf size	    */
+			&file_port[i]	    /* result	    */
+			);
+	if (status != PJ_SUCCESS) {
+	    char title[80];
+	    pj_ansi_sprintf(title, "Unable to use %s", argv[i+pj_optind]);
+	    app_perror(THIS_FILE, title, status);
+	    usage();
+	    return 1;
+	}
+
+	/* Add the file port to conference bridge */
+	status = pjmedia_conf_add_port( conf,		/* The bridge	    */
+					pool,		/* pool		    */
+					file_port[i],	/* port to connect  */
+					NULL,		/* Use port's name  */
+					NULL		/* ptr for slot #   */
+					);
+	if (status != PJ_SUCCESS) {
+	    app_perror(THIS_FILE, "Unable to add conference port", status);
+	    return 1;
+	}
+    }
+
+
+    /* 
+     * All ports are set up in the conference bridge.
+     * But at this point, no media will be flowing since no ports are
+     * "connected". User must connect the port manually.
+     */
+
+
+    /* Dump memory usage */
+    dump_pool_usage(THIS_FILE, &cp);
+
+    /* Sleep to allow log messages to flush */
+    pj_thread_sleep(100);
+
+
+    /*
+     * UI Menu: 
+     */
+    for (;;) {
+	char tmp1[10];
+	char tmp2[10];
+	char *err;
+	int src, dst, level, dur;
+
+	puts("");
+	conf_list(conf, 0);
+	puts("");
+	puts("Menu:");
+	puts("  s    Show ports details");
+	puts("  c    Connect one port to another");
+	puts("  d    Disconnect port connection");
+	puts("  t    Adjust signal level transmitted (tx) to a port");
+	puts("  r    Adjust signal level received (rx) from a port");
+	puts("  v    Display VU meter for a particular port");
+	puts("  q    Quit");
+	puts("");
+	
+	printf("Enter selection: "); fflush(stdout);
+
+	if (fgets(tmp, sizeof(tmp), stdin) == NULL)
+	    break;
+
+	switch (tmp[0]) {
+	case 's':
+	    puts("");
+	    conf_list(conf, 1);
+	    break;
+
+	case 'c':
+	    puts("");
+	    puts("Connect source port to destination port");
+	    if (!input("Enter source port number", tmp1, sizeof(tmp1)) )
+		continue;
+	    src = strtol(tmp1, &err, 10);
+	    if (*err || src < 0 || src >= port_count) {
+		puts("Invalid slot number");
+		continue;
+	    }
+
+	    if (!input("Enter destination port number", tmp2, sizeof(tmp2)) )
+		continue;
+	    dst = strtol(tmp2, &err, 10);
+	    if (*err || dst < 0 || dst >= port_count) {
+		puts("Invalid slot number");
+		continue;
+	    }
+
+	    status = pjmedia_conf_connect_port(conf, src, dst, 0);
+	    if (status != PJ_SUCCESS)
+		app_perror(THIS_FILE, "Error connecting port", status);
+	    
+	    break;
+
+	case 'd':
+	    puts("");
+	    puts("Disconnect port connection");
+	    if (!input("Enter source port number", tmp1, sizeof(tmp1)) )
+		continue;
+	    src = strtol(tmp1, &err, 10);
+	    if (*err || src < 0 || src >= port_count) {
+		puts("Invalid slot number");
+		continue;
+	    }
+
+	    if (!input("Enter destination port number", tmp2, sizeof(tmp2)) )
+		continue;
+	    dst = strtol(tmp2, &err, 10);
+	    if (*err || dst < 0 || dst >= port_count) {
+		puts("Invalid slot number");
+		continue;
+	    }
+
+	    status = pjmedia_conf_disconnect_port(conf, src, dst);
+	    if (status != PJ_SUCCESS)
+		app_perror(THIS_FILE, "Error connecting port", status);
+	    
+
+	    break;
+
+	case 't':
+	    puts("");
+	    puts("Adjust transmit level of a port");
+	    if (!input("Enter port number", tmp1, sizeof(tmp1)) )
+		continue;
+	    src = strtol(tmp1, &err, 10);
+	    if (*err || src < 0 || src >= port_count) {
+		puts("Invalid slot number");
+		continue;
+	    }
+
+	    if (!input("Enter level (-128 to >127, 0 for normal)", 
+			      tmp2, sizeof(tmp2)) )
+		continue;
+	    level = strtol(tmp2, &err, 10);
+	    if (*err || level < -128) {
+		puts("Invalid level");
+		continue;
+	    }
+
+	    status = pjmedia_conf_adjust_tx_level( conf, src, level);
+	    if (status != PJ_SUCCESS)
+		app_perror(THIS_FILE, "Error adjusting level", status);
+	    break;
+
+
+	case 'r':
+	    puts("");
+	    puts("Adjust receive level of a port");
+	    if (!input("Enter port number", tmp1, sizeof(tmp1)) )
+		continue;
+	    src = strtol(tmp1, &err, 10);
+	    if (*err || src < 0 || src >= port_count) {
+		puts("Invalid slot number");
+		continue;
+	    }
+
+	    if (!input("Enter level (-128 to >127, 0 for normal)", 
+			      tmp2, sizeof(tmp2)) )
+		continue;
+	    level = strtol(tmp2, &err, 10);
+	    if (*err || level < -128) {
+		puts("Invalid level");
+		continue;
+	    }
+
+	    status = pjmedia_conf_adjust_rx_level( conf, src, level);
+	    if (status != PJ_SUCCESS)
+		app_perror(THIS_FILE, "Error adjusting level", status);
+	    break;
+
+	case 'v':
+	    puts("");
+	    puts("Display VU meter");
+	    if (!input("Enter port number to monitor", tmp1, sizeof(tmp1)) )
+		continue;
+	    src = strtol(tmp1, &err, 10);
+	    if (*err || src < 0 || src >= port_count) {
+		puts("Invalid slot number");
+		continue;
+	    }
+
+	    if (!input("Enter r for rx level or t for tx level", tmp2, sizeof(tmp2)))
+		continue;
+	    if (tmp2[0] != 'r' && tmp2[0] != 't') {
+		puts("Invalid option");
+		continue;
+	    }
+
+	    if (!input("Duration to monitor (in seconds)", tmp1, sizeof(tmp1)) )
+		continue;
+	    dur = strtol(tmp1, &err, 10);
+	    if (*err) {
+		puts("Invalid duration number");
+		continue;
+	    }
+
+	    monitor_level(conf, src, tmp2[0], dur);
+	    break;
+
+	case 'q':
+	    goto on_quit;
+
+	default:
+	    printf("Invalid input character '%c'\n", tmp[0]);
+	    break;
+	}
+    }
+
+on_quit:
+    
+    /* Start deinitialization: */
+
+    /* Destroy conference bridge */
+    status = pjmedia_conf_destroy( conf );
+    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+
+    /* Destroy file ports */
+    for (i=0; i<file_count; ++i) {
+	status = pjmedia_port_destroy( file_port[i]);
+	PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+    }
+
+    /* Destroy recorder port */
+    if (rec_port)
+	pjmedia_port_destroy(rec_port);
+
+    /* Release application pool */
+    pj_pool_release( pool );
+
+    /* Destroy media endpoint. */
+    pjmedia_endpt_destroy( med_endpt );
+
+    /* Destroy pool factory */
+    pj_caching_pool_destroy( &cp );
+
+    /* Shutdown PJLIB */
+    pj_shutdown();
+
+    /* Done. */
+    return 0;
+}
+
+
+/*
+ * List the ports in conference bridge
+ */
+static void conf_list(pjmedia_conf *conf, int detail)
+{
+    enum { MAX_PORTS = 32 };
+    unsigned i, count;
+    pjmedia_conf_port_info info[MAX_PORTS];
+
+    printf("Conference ports:\n");
+
+    count = PJ_ARRAY_SIZE(info);
+    pjmedia_conf_get_ports_info(conf, &count, info);
+
+    for (i=0; i<count; ++i) {
+	char txlist[4*MAX_PORTS];
+	unsigned j;
+	pjmedia_conf_port_info *port_info = &info[i];	
+	
+	txlist[0] = '\0';
+	for (j=0; j<port_info->listener_cnt; ++j) {
+	    char s[10];
+	    pj_ansi_sprintf(s, "#%d ", port_info->listener_slots[j]);
+	    pj_ansi_strcat(txlist, s);
+
+	}
+
+	if (txlist[0] == '\0') {
+	    txlist[0] = '-';
+	    txlist[1] = '\0';
+	}
+
+	if (!detail) {
+	    printf("Port #%02d %-25.*s  transmitting to: %s\n", 
+		   port_info->slot, 
+		   (int)port_info->name.slen, 
+		   port_info->name.ptr,
+		   txlist);
+	} else {
+	    unsigned tx_level, rx_level;
+
+	    pjmedia_conf_get_signal_level(conf, port_info->slot,
+					  &tx_level, &rx_level);
+
+	    printf("Port #%02d:\n"
+		   "  Name                    : %.*s\n"
+		   "  Sampling rate           : %d Hz\n"
+		   "  Samples per frame       : %d\n"
+		   "  Frame time              : %d ms\n"
+		   "  Signal level adjustment : tx=%d, rx=%d\n"
+		   "  Current signal level    : tx=%u, rx=%u\n"
+		   "  Transmitting to ports   : %s\n\n",
+		   port_info->slot,
+		   (int)port_info->name.slen,
+		   port_info->name.ptr,
+		   port_info->clock_rate,
+		   port_info->samples_per_frame,
+		   port_info->samples_per_frame*1000/port_info->clock_rate,
+		   port_info->tx_adj_level,
+		   port_info->rx_adj_level,
+		   tx_level,
+		   rx_level,
+		   txlist);
+	}
+
+    }
+    puts("");
+}
+
+
+/*
+ * Display VU meter
+ */
+static void monitor_level(pjmedia_conf *conf, int slot, int dir, int dur)
+{
+    enum { SLEEP = 20, SAMP_CNT = 2};
+    pj_status_t status;
+    int i, total_count;
+    unsigned level, samp_cnt;
+
+
+    puts("");
+    printf("Displaying VU meter for port %d for about %d seconds\n",
+	   slot, dur);
+
+    total_count = dur * 1000 / SLEEP;
+
+    level = 0;
+    samp_cnt = 0;
+
+    for (i=0; i<total_count; ++i) {
+	unsigned tx_level, rx_level;
+	int j, length;
+	char meter[21];
+
+	/* Poll the volume every 20 msec */
+	status = pjmedia_conf_get_signal_level(conf, slot, 
+					       &tx_level, &rx_level);
+	if (status != PJ_SUCCESS) {
+	    app_perror(THIS_FILE, "Unable to read level", status);
+	    return;
+	}
+
+	level += (dir=='r' ? rx_level : tx_level);
+	++samp_cnt;
+
+	/* Accumulate until we have enough samples */
+	if (samp_cnt < SAMP_CNT) {
+	    pj_thread_sleep(SLEEP);
+	    continue;
+	}
+
+	/* Get average */
+	level = level / samp_cnt;
+
+	/* Draw bar */
+	length = 20 * level / 255;
+	for (j=0; j<length; ++j)
+	    meter[j] = '#';
+	for (; j<20; ++j)
+	    meter[j] = ' ';
+	meter[20] = '\0';
+
+	printf("Port #%02d %cx level: [%s] %d  \r",
+	       slot, dir, meter, level);
+
+	/* Next.. */
+	samp_cnt = 0;
+	level = 0;
+
+	pj_thread_sleep(SLEEP);
+    }
+
+    puts("");
+}
+
diff --git a/jni/pjproject-android/.svn/pristine/14/1425ce54faa3107646fbcd45c3e2213146ae976b.svn-base b/jni/pjproject-android/.svn/pristine/14/1425ce54faa3107646fbcd45c3e2213146ae976b.svn-base
new file mode 100644
index 0000000..4bb333d
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/14/1425ce54faa3107646fbcd45c3e2213146ae976b.svn-base
@@ -0,0 +1,336 @@
+/* Copyright (C) 2002 Jean-Marc Valin */
+/**
+   @file filters_sse.h
+   @brief Various analysis/synthesis filters (SSE version)
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - 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.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``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 FOUNDATION OR
+   CONTRIBUTORS 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.
+*/
+
+#include <xmmintrin.h>
+
+void filter_mem16_10(const float *x, const float *_num, const float *_den, float *y, int N, int ord, float *_mem)
+{
+   __m128 num[3], den[3], mem[3];
+
+   int i;
+
+   /* Copy numerator, denominator and memory to aligned xmm */
+   for (i=0;i<2;i++)
+   {
+      mem[i] = _mm_loadu_ps(_mem+4*i);
+      num[i] = _mm_loadu_ps(_num+4*i);
+      den[i] = _mm_loadu_ps(_den+4*i);
+   }
+   mem[2] = _mm_setr_ps(_mem[8], _mem[9], 0, 0);
+   num[2] = _mm_setr_ps(_num[8], _num[9], 0, 0);
+   den[2] = _mm_setr_ps(_den[8], _den[9], 0, 0);
+   
+   for (i=0;i<N;i++)
+   {
+      __m128 xx;
+      __m128 yy;
+      /* Compute next filter result */
+      xx = _mm_load_ps1(x+i);
+      yy = _mm_add_ss(xx, mem[0]);
+      _mm_store_ss(y+i, yy);
+      yy = _mm_shuffle_ps(yy, yy, 0);
+      
+      /* Update memory */
+      mem[0] = _mm_move_ss(mem[0], mem[1]);
+      mem[0] = _mm_shuffle_ps(mem[0], mem[0], 0x39);
+
+      mem[0] = _mm_add_ps(mem[0], _mm_mul_ps(xx, num[0]));
+      mem[0] = _mm_sub_ps(mem[0], _mm_mul_ps(yy, den[0]));
+
+      mem[1] = _mm_move_ss(mem[1], mem[2]);
+      mem[1] = _mm_shuffle_ps(mem[1], mem[1], 0x39);
+
+      mem[1] = _mm_add_ps(mem[1], _mm_mul_ps(xx, num[1]));
+      mem[1] = _mm_sub_ps(mem[1], _mm_mul_ps(yy, den[1]));
+
+      mem[2] = _mm_shuffle_ps(mem[2], mem[2], 0xfd);
+
+      mem[2] = _mm_add_ps(mem[2], _mm_mul_ps(xx, num[2]));
+      mem[2] = _mm_sub_ps(mem[2], _mm_mul_ps(yy, den[2]));
+   }
+   /* Put memory back in its place */
+   _mm_storeu_ps(_mem, mem[0]);
+   _mm_storeu_ps(_mem+4, mem[1]);
+   _mm_store_ss(_mem+8, mem[2]);
+   mem[2] = _mm_shuffle_ps(mem[2], mem[2], 0x55);
+   _mm_store_ss(_mem+9, mem[2]);
+}
+
+void filter_mem16_8(const float *x, const float *_num, const float *_den, float *y, int N, int ord, float *_mem)
+{
+   __m128 num[2], den[2], mem[2];
+
+   int i;
+
+   /* Copy numerator, denominator and memory to aligned xmm */
+   for (i=0;i<2;i++)
+   {
+      mem[i] = _mm_loadu_ps(_mem+4*i);
+      num[i] = _mm_loadu_ps(_num+4*i);
+      den[i] = _mm_loadu_ps(_den+4*i);
+   }
+   
+   for (i=0;i<N;i++)
+   {
+      __m128 xx;
+      __m128 yy;
+      /* Compute next filter result */
+      xx = _mm_load_ps1(x+i);
+      yy = _mm_add_ss(xx, mem[0]);
+      _mm_store_ss(y+i, yy);
+      yy = _mm_shuffle_ps(yy, yy, 0);
+      
+      /* Update memory */
+      mem[0] = _mm_move_ss(mem[0], mem[1]);
+      mem[0] = _mm_shuffle_ps(mem[0], mem[0], 0x39);
+
+      mem[0] = _mm_add_ps(mem[0], _mm_mul_ps(xx, num[0]));
+      mem[0] = _mm_sub_ps(mem[0], _mm_mul_ps(yy, den[0]));
+
+      mem[1] = _mm_sub_ss(mem[1], mem[1]);
+      mem[1] = _mm_shuffle_ps(mem[1], mem[1], 0x39);
+
+      mem[1] = _mm_add_ps(mem[1], _mm_mul_ps(xx, num[1]));
+      mem[1] = _mm_sub_ps(mem[1], _mm_mul_ps(yy, den[1]));
+   }
+   /* Put memory back in its place */
+   _mm_storeu_ps(_mem, mem[0]);
+   _mm_storeu_ps(_mem+4, mem[1]);
+}
+
+
+#define OVERRIDE_FILTER_MEM16
+void filter_mem16(const float *x, const float *_num, const float *_den, float *y, int N, int ord, float *_mem, char *stack)
+{
+   if(ord==10)
+      filter_mem16_10(x, _num, _den, y, N, ord, _mem);
+   else if (ord==8)
+      filter_mem16_8(x, _num, _den, y, N, ord, _mem);
+}
+
+
+
+void iir_mem16_10(const float *x, const float *_den, float *y, int N, int ord, float *_mem)
+{
+   __m128 den[3], mem[3];
+
+   int i;
+
+   /* Copy numerator, denominator and memory to aligned xmm */
+   for (i=0;i<2;i++)
+   {
+      mem[i] = _mm_loadu_ps(_mem+4*i);
+      den[i] = _mm_loadu_ps(_den+4*i);
+   }
+   mem[2] = _mm_setr_ps(_mem[8], _mem[9], 0, 0);
+   den[2] = _mm_setr_ps(_den[8], _den[9], 0, 0);
+   
+   for (i=0;i<N;i++)
+   {
+      __m128 xx;
+      __m128 yy;
+      /* Compute next filter result */
+      xx = _mm_load_ps1(x+i);
+      yy = _mm_add_ss(xx, mem[0]);
+      _mm_store_ss(y+i, yy);
+      yy = _mm_shuffle_ps(yy, yy, 0);
+      
+      /* Update memory */
+      mem[0] = _mm_move_ss(mem[0], mem[1]);
+      mem[0] = _mm_shuffle_ps(mem[0], mem[0], 0x39);
+
+      mem[0] = _mm_sub_ps(mem[0], _mm_mul_ps(yy, den[0]));
+
+      mem[1] = _mm_move_ss(mem[1], mem[2]);
+      mem[1] = _mm_shuffle_ps(mem[1], mem[1], 0x39);
+
+      mem[1] = _mm_sub_ps(mem[1], _mm_mul_ps(yy, den[1]));
+
+      mem[2] = _mm_shuffle_ps(mem[2], mem[2], 0xfd);
+
+      mem[2] = _mm_sub_ps(mem[2], _mm_mul_ps(yy, den[2]));
+   }
+   /* Put memory back in its place */
+   _mm_storeu_ps(_mem, mem[0]);
+   _mm_storeu_ps(_mem+4, mem[1]);
+   _mm_store_ss(_mem+8, mem[2]);
+   mem[2] = _mm_shuffle_ps(mem[2], mem[2], 0x55);
+   _mm_store_ss(_mem+9, mem[2]);
+}
+
+
+void iir_mem16_8(const float *x, const float *_den, float *y, int N, int ord, float *_mem)
+{
+   __m128 den[2], mem[2];
+
+   int i;
+
+   /* Copy numerator, denominator and memory to aligned xmm */
+   for (i=0;i<2;i++)
+   {
+      mem[i] = _mm_loadu_ps(_mem+4*i);
+      den[i] = _mm_loadu_ps(_den+4*i);
+   }
+   
+   for (i=0;i<N;i++)
+   {
+      __m128 xx;
+      __m128 yy;
+      /* Compute next filter result */
+      xx = _mm_load_ps1(x+i);
+      yy = _mm_add_ss(xx, mem[0]);
+      _mm_store_ss(y+i, yy);
+      yy = _mm_shuffle_ps(yy, yy, 0);
+      
+      /* Update memory */
+      mem[0] = _mm_move_ss(mem[0], mem[1]);
+      mem[0] = _mm_shuffle_ps(mem[0], mem[0], 0x39);
+
+      mem[0] = _mm_sub_ps(mem[0], _mm_mul_ps(yy, den[0]));
+
+      mem[1] = _mm_sub_ss(mem[1], mem[1]);
+      mem[1] = _mm_shuffle_ps(mem[1], mem[1], 0x39);
+
+      mem[1] = _mm_sub_ps(mem[1], _mm_mul_ps(yy, den[1]));
+   }
+   /* Put memory back in its place */
+   _mm_storeu_ps(_mem, mem[0]);
+   _mm_storeu_ps(_mem+4, mem[1]);
+}
+
+#define OVERRIDE_IIR_MEM16
+void iir_mem16(const float *x, const float *_den, float *y, int N, int ord, float *_mem, char *stack)
+{
+   if(ord==10)
+      iir_mem16_10(x, _den, y, N, ord, _mem);
+   else if (ord==8)
+      iir_mem16_8(x, _den, y, N, ord, _mem);
+}
+
+
+void fir_mem16_10(const float *x, const float *_num, float *y, int N, int ord, float *_mem)
+{
+   __m128 num[3], mem[3];
+
+   int i;
+
+   /* Copy numerator, denominator and memory to aligned xmm */
+   for (i=0;i<2;i++)
+   {
+      mem[i] = _mm_loadu_ps(_mem+4*i);
+      num[i] = _mm_loadu_ps(_num+4*i);
+   }
+   mem[2] = _mm_setr_ps(_mem[8], _mem[9], 0, 0);
+   num[2] = _mm_setr_ps(_num[8], _num[9], 0, 0);
+   
+   for (i=0;i<N;i++)
+   {
+      __m128 xx;
+      __m128 yy;
+      /* Compute next filter result */
+      xx = _mm_load_ps1(x+i);
+      yy = _mm_add_ss(xx, mem[0]);
+      _mm_store_ss(y+i, yy);
+      yy = _mm_shuffle_ps(yy, yy, 0);
+      
+      /* Update memory */
+      mem[0] = _mm_move_ss(mem[0], mem[1]);
+      mem[0] = _mm_shuffle_ps(mem[0], mem[0], 0x39);
+
+      mem[0] = _mm_add_ps(mem[0], _mm_mul_ps(xx, num[0]));
+
+      mem[1] = _mm_move_ss(mem[1], mem[2]);
+      mem[1] = _mm_shuffle_ps(mem[1], mem[1], 0x39);
+
+      mem[1] = _mm_add_ps(mem[1], _mm_mul_ps(xx, num[1]));
+
+      mem[2] = _mm_shuffle_ps(mem[2], mem[2], 0xfd);
+
+      mem[2] = _mm_add_ps(mem[2], _mm_mul_ps(xx, num[2]));
+   }
+   /* Put memory back in its place */
+   _mm_storeu_ps(_mem, mem[0]);
+   _mm_storeu_ps(_mem+4, mem[1]);
+   _mm_store_ss(_mem+8, mem[2]);
+   mem[2] = _mm_shuffle_ps(mem[2], mem[2], 0x55);
+   _mm_store_ss(_mem+9, mem[2]);
+}
+
+void fir_mem16_8(const float *x, const float *_num, float *y, int N, int ord, float *_mem)
+{
+   __m128 num[2], mem[2];
+
+   int i;
+
+   /* Copy numerator, denominator and memory to aligned xmm */
+   for (i=0;i<2;i++)
+   {
+      mem[i] = _mm_loadu_ps(_mem+4*i);
+      num[i] = _mm_loadu_ps(_num+4*i);
+   }
+   
+   for (i=0;i<N;i++)
+   {
+      __m128 xx;
+      __m128 yy;
+      /* Compute next filter result */
+      xx = _mm_load_ps1(x+i);
+      yy = _mm_add_ss(xx, mem[0]);
+      _mm_store_ss(y+i, yy);
+      yy = _mm_shuffle_ps(yy, yy, 0);
+      
+      /* Update memory */
+      mem[0] = _mm_move_ss(mem[0], mem[1]);
+      mem[0] = _mm_shuffle_ps(mem[0], mem[0], 0x39);
+
+      mem[0] = _mm_add_ps(mem[0], _mm_mul_ps(xx, num[0]));
+
+      mem[1] = _mm_sub_ss(mem[1], mem[1]);
+      mem[1] = _mm_shuffle_ps(mem[1], mem[1], 0x39);
+
+      mem[1] = _mm_add_ps(mem[1], _mm_mul_ps(xx, num[1]));
+   }
+   /* Put memory back in its place */
+   _mm_storeu_ps(_mem, mem[0]);
+   _mm_storeu_ps(_mem+4, mem[1]);
+}
+
+#define OVERRIDE_FIR_MEM16
+void fir_mem16(const float *x, const float *_num, float *y, int N, int ord, float *_mem, char *stack)
+{
+   if(ord==10)
+      fir_mem16_10(x, _num, y, N, ord, _mem);
+   else if (ord==8)
+      fir_mem16_8(x, _num, y, N, ord, _mem);
+}
diff --git a/jni/pjproject-android/.svn/pristine/14/143e08391ed2b406768663b1481410be30ef51d6.svn-base b/jni/pjproject-android/.svn/pristine/14/143e08391ed2b406768663b1481410be30ef51d6.svn-base
new file mode 100644
index 0000000..d404f2d
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/14/143e08391ed2b406768663b1481410be30ef51d6.svn-base
@@ -0,0 +1,17 @@
+# $Id$
+#
+from inc_cfg import *
+
+# Call with L16/8000/1 codec
+test_param = TestParam(
+		"PESQ codec L16/8000/1 (RX side uses snd dev)",
+		[
+			InstanceParam("UA1", "--max-calls=1 --add-codec L16/8000/1 --clock-rate 8000 --play-file wavs/input.8.wav --null-audio"),
+			InstanceParam("UA2", "--max-calls=1 --add-codec L16/8000/1 --clock-rate 8000 --rec-file  wavs/tmp.8.wav   --auto-answer 200")
+		]
+		)
+
+if (HAS_SND_DEV == 0):
+	test_param.skip = True
+
+pesq_threshold = 3.5
diff --git a/jni/pjproject-android/.svn/pristine/14/1449629de1ca1d4d516db3a0d86bfbaa6a9cc5b0.svn-base b/jni/pjproject-android/.svn/pristine/14/1449629de1ca1d4d516db3a0d86bfbaa6a9cc5b0.svn-base
new file mode 100644
index 0000000..9fb6682
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/14/1449629de1ca1d4d516db3a0d86bfbaa6a9cc5b0.svn-base
@@ -0,0 +1,50 @@
+/*
+ * aes_cbc.h
+ *
+ * Header for AES Cipher Blobk Chaining Mode.
+ *
+ * David A. McGrew
+ * Cisco Systems, Inc.
+ *
+ */
+
+#ifndef AES_CBC_H
+#define AES_CBC_H
+
+#include "aes.h"
+#include "cipher.h"
+
+typedef struct {
+  v128_t   state;                  /* cipher chaining state            */
+  v128_t   previous;               /* previous ciphertext block        */
+  aes_expanded_key_t expanded_key; /* the cipher key                   */
+} aes_cbc_ctx_t;
+
+err_status_t
+aes_cbc_set_key(aes_cbc_ctx_t *c,
+		const unsigned char *key); 
+
+err_status_t
+aes_cbc_encrypt(aes_cbc_ctx_t *c, 
+		unsigned char *buf, 
+		unsigned int  *bytes_in_data);
+
+err_status_t
+aes_cbc_context_init(aes_cbc_ctx_t *c, const uint8_t *key, 
+		     cipher_direction_t dir);
+
+err_status_t
+aes_cbc_set_iv(aes_cbc_ctx_t *c, void *iv);
+
+err_status_t
+aes_cbc_nist_encrypt(aes_cbc_ctx_t *c,
+		     unsigned char *data, 
+		     unsigned int *bytes_in_data);
+
+err_status_t
+aes_cbc_nist_decrypt(aes_cbc_ctx_t *c,
+		     unsigned char *data, 
+		     unsigned int *bytes_in_data);
+
+#endif /* AES_CBC_H */
+
diff --git a/jni/pjproject-android/.svn/pristine/14/14569c39e96ceb32d9cee63912ab03b73c970894.svn-base b/jni/pjproject-android/.svn/pristine/14/14569c39e96ceb32d9cee63912ab03b73c970894.svn-base
new file mode 100644
index 0000000..82e182d
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/14/14569c39e96ceb32d9cee63912ab03b73c970894.svn-base
@@ -0,0 +1,145 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 2008-2011 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 
+ */
+#include "auth.h"
+#include <pjlib.h>
+
+
+#define MAX_REALM	80
+#define MAX_USERNAME	32
+#define MAX_PASSWORD	32
+#define MAX_NONCE	32
+
+static char g_realm[MAX_REALM];
+
+static struct cred_t
+{
+    char    username[MAX_USERNAME];
+    char    passwd[MAX_PASSWORD];
+} g_cred[] = 
+{
+    { "100", "100" },
+    { "700", "700" },
+    { "701", "701" }
+};
+
+#define THIS_FILE	"auth.c"
+#define THE_NONCE	"pjnath"
+#define LOG(expr)	PJ_LOG(3,expr)
+
+
+/*
+ * Initialize TURN authentication subsystem.
+ */
+PJ_DEF(pj_status_t) pj_turn_auth_init(const char *realm)
+{
+    PJ_ASSERT_RETURN(pj_ansi_strlen(realm) < MAX_REALM, PJ_ENAMETOOLONG);
+    pj_ansi_strcpy(g_realm, realm);
+    return PJ_SUCCESS;
+}
+
+/*
+ * Shutdown TURN authentication subsystem.
+ */
+PJ_DEF(void) pj_turn_auth_dinit(void)
+{
+    /* Nothing to do */
+}
+
+
+/*
+ * This function is called by pj_stun_verify_credential() when
+ * server needs to challenge the request with 401 response.
+ */
+PJ_DEF(pj_status_t) pj_turn_get_auth(void *user_data,
+				     pj_pool_t *pool,
+				     pj_str_t *realm,
+				     pj_str_t *nonce)
+{
+    PJ_UNUSED_ARG(user_data);
+    PJ_UNUSED_ARG(pool);
+
+    *realm = pj_str(g_realm);
+    *nonce = pj_str(THE_NONCE);
+
+    return PJ_SUCCESS;
+}
+
+/*
+ * This function is called to get the password for the specified username.
+ * This function is also used to check whether the username is valid.
+ */
+PJ_DEF(pj_status_t) pj_turn_get_password(const pj_stun_msg *msg,
+					 void *user_data, 
+					 const pj_str_t *realm,
+					 const pj_str_t *username,
+					 pj_pool_t *pool,
+					 pj_stun_passwd_type *data_type,
+					 pj_str_t *data)
+{
+    unsigned i;
+
+    PJ_UNUSED_ARG(msg);
+    PJ_UNUSED_ARG(user_data);
+    PJ_UNUSED_ARG(pool);
+
+    if (pj_stricmp2(realm, g_realm)) {
+	LOG((THIS_FILE, "auth error: invalid realm '%.*s'", 
+			(int)realm->slen, realm->ptr));
+	return PJ_EINVAL;
+    }
+
+    for (i=0; i<PJ_ARRAY_SIZE(g_cred); ++i) {
+	if (pj_stricmp2(username, g_cred[i].username) == 0) {
+	    *data_type = PJ_STUN_PASSWD_PLAIN;
+	    *data = pj_str(g_cred[i].passwd);
+	    return PJ_SUCCESS;
+	}
+    }
+
+    LOG((THIS_FILE, "auth error: user '%.*s' not found", 
+		    (int)username->slen, username->ptr));
+    return PJ_ENOTFOUND;
+}
+
+/*
+ * This function will be called to verify that the NONCE given
+ * in the message can be accepted. If this callback returns
+ * PJ_FALSE, 438 (Stale Nonce) response will be created.
+ */
+PJ_DEF(pj_bool_t) pj_turn_verify_nonce(const pj_stun_msg *msg,
+				       void *user_data,
+				       const pj_str_t *realm,
+				       const pj_str_t *username,
+				       const pj_str_t *nonce)
+{
+    PJ_UNUSED_ARG(msg);
+    PJ_UNUSED_ARG(user_data);
+    PJ_UNUSED_ARG(realm);
+    PJ_UNUSED_ARG(username);
+
+    if (pj_stricmp2(nonce, THE_NONCE)) {
+	LOG((THIS_FILE, "auth error: invalid nonce '%.*s'", 
+			(int)nonce->slen, nonce->ptr));
+	return PJ_FALSE;
+    }
+
+    return PJ_TRUE;
+}
+