* #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/48/481e66f3bf9b7e3d2a4587968e47c60fdf307dc8.svn-base b/jni/pjproject-android/.svn/pristine/48/481e66f3bf9b7e3d2a4587968e47c60fdf307dc8.svn-base
new file mode 100644
index 0000000..44f9a4a
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/48/481e66f3bf9b7e3d2a4587968e47c60fdf307dc8.svn-base
@@ -0,0 +1,68 @@
+/*
+ * null-auth.h
+ *
+ * David A. McGrew
+ * Cisco Systems, Inc.
+ *
+ */
+
+/*
+ *
+ * Copyright (c) 2001-2006, Cisco Systems, Inc.
+ * All rights reserved.
+ *
+ * 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 Cisco Systems, Inc. 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
+ * COPYRIGHT HOLDERS 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.
+ *
+ */
+
+#ifndef NULL_AUTH_H
+#define NULL_AUTH_H
+
+#include "auth.h"
+
+typedef struct {
+ char foo;
+} null_auth_ctx_t;
+
+err_status_t
+null_auth_alloc(auth_t **a, int key_len, int out_len);
+
+err_status_t
+null_auth_dealloc(auth_t *a);
+
+err_status_t
+null_auth_init(null_auth_ctx_t *state, const uint8_t *key, int key_len);
+
+err_status_t
+null_auth_compute (null_auth_ctx_t *state, uint8_t *message,
+ int msg_octets, int tag_len, uint8_t *result);
+
+
+#endif /* NULL_AUTH_H */
diff --git a/jni/pjproject-android/.svn/pristine/48/484ac113519789e542eccc5486a5b5dd931c51c9.svn-base b/jni/pjproject-android/.svn/pristine/48/484ac113519789e542eccc5486a5b5dd931c51c9.svn-base
new file mode 100644
index 0000000..9139dc1
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/48/484ac113519789e542eccc5486a5b5dd931c51c9.svn-base
@@ -0,0 +1,10 @@
+include ../../../build.mak
+
+cflags:
+ @echo $(PJ_CFLAGS) $(CFLAGS)
+
+cxxflags: cflags
+
+ldflags:
+ @echo $(PJ_LDFLAGS) $(PJ_LDLIBS) $(LDFLAGS)
+
diff --git a/jni/pjproject-android/.svn/pristine/48/485161bb4fca8756b06f7e1d93d315574841525c.svn-base b/jni/pjproject-android/.svn/pristine/48/485161bb4fca8756b06f7e1d93d315574841525c.svn-base
new file mode 100644
index 0000000..e5a0088
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/48/485161bb4fca8756b06f7e1d93d315574841525c.svn-base
@@ -0,0 +1,45 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="org.pjsip.pjsua"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk
+ android:minSdkVersion="15"
+ android:targetSdkVersion="15" />
+
+ <uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.RECORD_AUDIO" />
+ <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
+ <uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
+ <uses-permission android:name="android.permission.WRITE_SETTINGS" />
+ <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+ <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
+ <uses-permission android:name="android.permission.VIBRATE" />
+ <uses-permission android:name="android.permission.READ_LOGS" />
+ <uses-permission android:name="android.permission.USE_SIP" />
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.CAMERA" />
+
+ <uses-feature
+ android:name="android.hardware.microphone"
+ android:required="true" />
+
+ <application
+ android:icon="@drawable/main_image"
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.DeviceDefault.NoActionBar" >
+ <activity
+ android:name=".MainActivity"
+ android:windowSoftInputMode="stateHidden"
+ android:label="@string/app_name" android:screenOrientation="portrait" android:theme="@android:style/Theme.NoTitleBar">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
\ No newline at end of file
diff --git a/jni/pjproject-android/.svn/pristine/48/4857b6eeb7951b1398589c2034e2c191a402c65c.svn-base b/jni/pjproject-android/.svn/pristine/48/4857b6eeb7951b1398589c2034e2c191a402c65c.svn-base
new file mode 100644
index 0000000..52eb9ab
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/48/4857b6eeb7951b1398589c2034e2c191a402c65c.svn-base
@@ -0,0 +1,95 @@
+/* $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
+ */
+#ifndef __PJ_ASSERT_H__
+#define __PJ_ASSERT_H__
+
+/**
+ * @file assert.h
+ * @brief Assertion macro pj_assert().
+ */
+
+#include <pj/config.h>
+#include <pj/compat/assert.h>
+
+/**
+ * @defgroup pj_assert Assertion Macro
+ * @ingroup PJ_MISC
+ * @{
+ *
+ * Assertion and other helper macros for sanity checking.
+ */
+
+/**
+ * @hideinitializer
+ * Check during debug build that an expression is true. If the expression
+ * computes to false during run-time, then the program will stop at the
+ * offending statements.
+ * For release build, this macro will not do anything.
+ *
+ * @param expr The expression to be evaluated.
+ */
+#ifndef pj_assert
+# define pj_assert(expr) assert(expr)
+#endif
+
+
+/**
+ * @hideinitializer
+ * If #PJ_ENABLE_EXTRA_CHECK is declared and the value is non-zero, then
+ * #PJ_ASSERT_RETURN macro will evaluate the expression in @a expr during
+ * run-time. If the expression yields false, assertion will be triggered
+ * and the current function will return with the specified return value.
+ *
+ * If #PJ_ENABLE_EXTRA_CHECK is not declared or is zero, then no run-time
+ * checking will be performed. The macro simply evaluates to pj_assert(expr).
+ */
+#if defined(PJ_ENABLE_EXTRA_CHECK) && PJ_ENABLE_EXTRA_CHECK != 0
+# define PJ_ASSERT_RETURN(expr,retval) \
+ do { \
+ if (!(expr)) { pj_assert(expr); return retval; } \
+ } while (0)
+#else
+# define PJ_ASSERT_RETURN(expr,retval) pj_assert(expr)
+#endif
+
+/**
+ * @hideinitializer
+ * If #PJ_ENABLE_EXTRA_CHECK is declared and non-zero, then
+ * #PJ_ASSERT_ON_FAIL macro will evaluate the expression in @a expr during
+ * run-time. If the expression yields false, assertion will be triggered
+ * and @a exec_on_fail will be executed.
+ *
+ * If #PJ_ENABLE_EXTRA_CHECK is not declared or is zero, then no run-time
+ * checking will be performed. The macro simply evaluates to pj_assert(expr).
+ */
+#if defined(PJ_ENABLE_EXTRA_CHECK) && PJ_ENABLE_EXTRA_CHECK != 0
+# define PJ_ASSERT_ON_FAIL(expr,exec_on_fail) \
+ do { \
+ pj_assert(expr); \
+ if (!(expr)) exec_on_fail; \
+ } while (0)
+#else
+# define PJ_ASSERT_ON_FAIL(expr,exec_on_fail) pj_assert(expr)
+#endif
+
+/** @} */
+
+#endif /* __PJ_ASSERT_H__ */
+
diff --git a/jni/pjproject-android/.svn/pristine/48/486a50d3df313e4666a57c25a06d8de396d7e2f0.svn-base b/jni/pjproject-android/.svn/pristine/48/486a50d3df313e4666a57c25a06d8de396d7e2f0.svn-base
new file mode 100644
index 0000000..bbcfad4
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/48/486a50d3df313e4666a57c25a06d8de396d7e2f0.svn-base
@@ -0,0 +1,8 @@
+#
+# PJMEDIA OS specific configuration for RTEMS OS target.
+#
+
+export CFLAGS += -DPJMEDIA_SOUND_IMPLEMENTATION=PJMEDIA_SOUND_NULL_SOUND
+export PJMEDIA_OBJS += nullsound.o
+export SOUND_OBJS = $(NULLSOUND_OBJS)
+
diff --git a/jni/pjproject-android/.svn/pristine/48/4884c4eb75d9f5d8b96291c63638f8eced91ded4.svn-base b/jni/pjproject-android/.svn/pristine/48/4884c4eb75d9f5d8b96291c63638f8eced91ded4.svn-base
new file mode 100644
index 0000000..6bab73e
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/48/4884c4eb75d9f5d8b96291c63638f8eced91ded4.svn-base
@@ -0,0 +1,198 @@
+/* $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_TIMER_HPP__
+#define __PJPP_TIMER_HPP__
+
+#include <pj/timer.h>
+#include <pj++/types.hpp>
+#include <pj/assert.h>
+#include <pj++/lock.hpp>
+
+class Pj_Timer_Heap;
+
+//////////////////////////////////////////////////////////////////////////////
+// Timer entry.
+//
+// How to use:
+// Derive class from Pj_Timer_Entry and override on_timeout().
+// Scheduler timer in Pj_Timer_Heap.
+//
+class Pj_Timer_Entry : public Pj_Object
+{
+ friend class Pj_Timer_Heap;
+
+public:
+ //
+ // Default constructor.
+ //
+ Pj_Timer_Entry()
+ {
+ entry_.user_data = this;
+ entry_.cb = &timer_heap_callback;
+ }
+
+ //
+ // Destructor, do nothing.
+ //
+ ~Pj_Timer_Entry()
+ {
+ }
+
+ //
+ // Override this to get the timeout notification.
+ //
+ virtual void on_timeout(int id) = 0;
+
+private:
+ pj_timer_entry entry_;
+
+ static void timer_heap_callback(pj_timer_heap_t*, pj_timer_entry *e)
+ {
+ Pj_Timer_Entry *entry = (Pj_Timer_Entry*) e->user_data;
+ entry->on_timeout(e->id);
+ }
+
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// Timer heap.
+//
+class Pj_Timer_Heap : public Pj_Object
+{
+public:
+ //
+ // Default constructor.
+ //
+ Pj_Timer_Heap()
+ : ht_(NULL)
+ {
+ }
+
+ //
+ // Construct timer heap.
+ //
+ Pj_Timer_Heap(Pj_Pool *pool, pj_size_t initial_count)
+ : ht_(NULL)
+ {
+ create(pool, initial_count);
+ }
+
+ //
+ // Destructor.
+ //
+ ~Pj_Timer_Heap()
+ {
+ destroy();
+ }
+
+ //
+ // Create
+ //
+ pj_status_t create(Pj_Pool *pool, pj_size_t initial_count)
+ {
+ destroy();
+ return pj_timer_heap_create(pool->pool_(), initial_count, &ht_);
+ }
+
+ //
+ // Destroy
+ //
+ void destroy()
+ {
+ if (ht_) {
+ pj_timer_heap_destroy(ht_);
+ ht_ = NULL;
+ }
+ }
+
+ //
+ // Get pjlib compatible timer heap object.
+ //
+ pj_timer_heap_t *get_timer_heap()
+ {
+ return ht_;
+ }
+
+ //
+ // Set the lock object.
+ //
+ void set_lock( Pj_Lock *lock, bool auto_delete )
+ {
+ pj_timer_heap_set_lock( ht_, lock->pj_lock_t_(), auto_delete);
+ }
+
+ //
+ // Set maximum number of timed out entries to be processed per poll.
+ //
+ unsigned set_max_timed_out_per_poll(unsigned count)
+ {
+ return pj_timer_heap_set_max_timed_out_per_poll(ht_, count);
+ }
+
+ //
+ // Schedule a timer.
+ //
+ bool schedule( Pj_Timer_Entry *ent, const Pj_Time_Val &delay,
+ int id)
+ {
+ ent->entry_.id = id;
+ return pj_timer_heap_schedule(ht_, &ent->entry_, &delay) == 0;
+ }
+
+ //
+ // Cancel a timer.
+ //
+ bool cancel(Pj_Timer_Entry *ent)
+ {
+ return pj_timer_heap_cancel(ht_, &ent->entry_) == 1;
+ }
+
+ //
+ // Get current number of timers
+ //
+ pj_size_t count()
+ {
+ return pj_timer_heap_count(ht_);
+ }
+
+ //
+ // Get the earliest time.
+ // Return false if no timer is found.
+ //
+ bool earliest_time(Pj_Time_Val *t)
+ {
+ return pj_timer_heap_earliest_time(ht_, t) == PJ_SUCCESS;
+ }
+
+ //
+ // Poll the timer.
+ // Return number of timed out entries has been called.
+ //
+ unsigned poll(Pj_Time_Val *next_delay = NULL)
+ {
+ return pj_timer_heap_poll(ht_, next_delay);
+ }
+
+private:
+ pj_timer_heap_t *ht_;
+};
+
+#endif /* __PJPP_TIMER_HPP__ */
+
diff --git a/jni/pjproject-android/.svn/pristine/48/4889ccde86b2182fe80537c43e63aed4d90aabb1.svn-base b/jni/pjproject-android/.svn/pristine/48/4889ccde86b2182fe80537c43e63aed4d90aabb1.svn-base
new file mode 100644
index 0000000..45903fe
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/48/4889ccde86b2182fe80537c43e63aed4d90aabb1.svn-base
@@ -0,0 +1,136 @@
+#if defined(PJ_BUILD_DLL)
+
+TARGET pjmedia.dll
+TARGETTYPE dll
+UID 0x0 0xA0000004
+
+CAPABILITY None
+LIBRARY null_audio.lib pjsdp.lib pjnath.lib pjlib_util.lib pjlib.lib esock.lib insock.lib charconv.lib euser.lib estlib.lib
+MACRO PJ_DLL
+MACRO PJ_EXPORTING
+
+DEFFILE .\pjmedia.def
+
+#else
+
+TARGET pjmedia.lib
+TARGETTYPE lib
+
+#endif
+
+SOURCEPATH ..\pjmedia\src\pjmedia
+
+//
+// GCCE optimization setting
+//
+OPTION GCCE -O2 -fno-unit-at-a-time
+
+MACRO PJ_M_I386=1
+MACRO PJ_SYMBIAN=1
+
+// Must compile as C++, otherwise exception would not work
+OPTION CW -lang c++
+OPTION ARMCC --cpp --gnu
+OPTION GCC -x c++
+OPTION GCCE -x c++
+
+//
+// Platform independent source
+//
+
+SOURCE alaw_ulaw.c
+SOURCE alaw_ulaw_table.c
+SOURCE avi_player.c
+SOURCE bidirectional.c
+SOURCE clock_thread.c
+SOURCE codec.c
+SOURCE conf_switch.c
+SOURCE conference.c
+SOURCE converter.c
+SOURCE converter_libswscale.c
+SOURCE delaybuf.c
+SOURCE echo_common.c
+SOURCE echo_port.c
+SOURCE echo_suppress.c
+SOURCE endpoint.c
+SOURCE errno.c
+SOURCE event.c
+SOURCE format.c
+SOURCE g711.c
+SOURCE jbuf.c
+SOURCE master_port.c
+SOURCE mem_capture.c
+SOURCE mem_player.c
+SOURCE null_port.c
+SOURCE plc_common.c
+SOURCE port.c
+SOURCE resample_port.c
+SOURCE resample_resample.c
+SOURCE rtcp.c
+SOURCE rtcp_xr.c
+SOURCE rtp.c
+//SDP files are in pjsdp.mmp: sdp.c, sdp_cmp.c, sdp_neg.c
+//SOURCE session.c // deprecated
+SOURCE silencedet.c
+SOURCE sound_port.c
+SOURCE splitcomb.c
+SOURCE stereo_port.c
+SOURCE stream.c
+SOURCE stream_common.c
+SOURCE stream_info.c
+SOURCE tonegen.c
+SOURCE transport_adapter_sample.c
+SOURCE transport_ice.c
+SOURCE transport_udp.c
+SOURCE transport_srtp.c
+SOURCE types.c
+SOURCE vid_codec.c
+SOURCE vid_codec_util.c
+SOURCE vid_port.c
+SOURCE vid_stream.c
+SOURCE vid_stream_info.c
+SOURCE vid_tee.c
+SOURCE wav_player.c
+SOURCE wav_playlist.c
+SOURCE wav_writer.c
+SOURCE wave.c
+SOURCE wsola.c
+
+//
+// pjmedia-codec common files
+//
+SOURCEPATH ..\pjmedia\src\pjmedia-codec
+SOURCE audio_codecs.c
+SOURCE amr_sdp_match.c
+SOURCE g7221_sdp_match.c
+SOURCE h263_packetizer.c
+SOURCE h264_packetizer.c
+
+
+//
+// Symbian specific
+// These are on separate project
+//
+//SOURCE symbian_sound.cpp
+//SOURCE null_sound.c
+
+
+//
+// Header files
+//
+
+
+SYSTEMINCLUDE ..\pjmedia\include
+SYSTEMINCLUDE ..\pjlib\include
+SYSTEMINCLUDE ..\pjlib-util\include
+SYSTEMINCLUDE ..\pjnath\include
+SYSTEMINCLUDE ..\third_party\srtp\include
+SYSTEMINCLUDE ..\third_party\srtp\crypto\include
+SYSTEMINCLUDE ..\third_party\build\srtp
+SYSTEMINCLUDE ..
+
+SYSTEMINCLUDE \epoc32\include
+SYSTEMINCLUDE \epoc32\include\libc
+//SYSTEMINCLUDE \epoc32\include\mmf\plugin
+
+
diff --git a/jni/pjproject-android/.svn/pristine/48/48ac3f6dd7d8f29ac80fb263a95e74a896a865c7.svn-base b/jni/pjproject-android/.svn/pristine/48/48ac3f6dd7d8f29ac80fb263a95e74a896a865c7.svn-base
new file mode 100644
index 0000000..0cb2682
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/48/48ac3f6dd7d8f29ac80fb263a95e74a896a865c7.svn-base
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<!-- 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 -->
+<!-- -->
+
+<scenario name="SUBSCRIBE tests">
+ <!-- Establish subscription -->
+ <recv request="SUBSCRIBE" crlf="true">
+ <action>
+ <ereg regexp=".*" search_in="hdr" header="From" assign_to="3"/>
+ <ereg regexp="sip:(.*)>" search_in="hdr" header="Contact" assign_to="4,5"/>
+ <assign assign_to="4" variable="5" />
+ </action>
+ </recv>
+
+ <send>
+ <![CDATA[
+
+ SIP/2.0 200 OK
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:sipp@[local_ip]:[local_port]>
+ Content-Length: 0
+ Expires: 60
+ ]]>
+ </send>
+
+ <send retrans="500">
+ <![CDATA[
+ NOTIFY sip:[$5] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=z9hG4bKPj01
+ From: sipp <sip:sipp@[local_ip]>;tag=[call_number]
+ To[$3]
+ Call-ID: [call_id]
+ Cseq: 1 NOTIFY
+ Contact: sip:sipp@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Event: presence
+ Subscription-State: active;expires=10
+ Content-Type: application/pidf+xml
+
+ <?xml version="1.0" encoding="UTF-8"?>
+ <presence xmlns="urn:ietf:params:xml:ns:pidf" xmlns:op="urn:oma:xml:prs:pidf:oma-pres" entity="sip:moto_red@ptt.intra.genaker.net">
+ <tuple id="17415d5738f332a64a2f1d8cfb4ab0a5">
+ <status>
+ <basic>open</basic>
+ </status>
+ </tuple>
+ </presence>
+ ]]>
+ </send>
+
+ <recv response="200">
+ </recv>
+
+ <!-- Subscription has been established at this point -->
+
+
+ <!-- *******
+
+ Wait for subscription refresh, reply with 481
+
+ -->
+
+ <recv request="SUBSCRIBE" crlf="true">
+ </recv>
+
+ <send>
+ <![CDATA[
+
+ SIP/2.0 481 You should resubscribe mow
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:sipp@[local_ip]:[local_port]>
+ Content-Length: 0
+ ]]>
+ </send>
+
+
+
+
+ <!-- definition of the response time repartition table (unit is ms) -->
+ <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+ <!-- definition of the call length repartition table (unit is ms) -->
+ <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+
diff --git a/jni/pjproject-android/.svn/pristine/48/48b3583a4f89e126c25172416b5cbfd9031abe15.svn-base b/jni/pjproject-android/.svn/pristine/48/48b3583a4f89e126c25172416b5cbfd9031abe15.svn-base
new file mode 100644
index 0000000..0d767f0
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/48/48b3583a4f89e126c25172416b5cbfd9031abe15.svn-base
@@ -0,0 +1,421 @@
+/* $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
+ */
+#ifndef __PJSIP_SIP_PARSER_H__
+#define __PJSIP_SIP_PARSER_H__
+
+/**
+ * @file sip_parser.h
+ * @brief SIP Message Parser
+ */
+
+#include <pjsip/sip_msg.h>
+#include <pjlib-util/scanner.h>
+#include <pj/list.h>
+
+PJ_BEGIN_DECL
+
+/**
+ * @defgroup PJSIP_PARSER Parser
+ * @ingroup PJSIP_MSG
+ * @brief Message and message elements parsing.
+ * @{
+ */
+
+/**
+ * URI Parsing options.
+ */
+enum
+{
+ /** If this option is specified, function #pjsip_parse_uri will return
+ * the URI object as pjsip_name_addr instead of the corresponding
+ * URI object.
+ */
+ PJSIP_PARSE_URI_AS_NAMEADDR = 1,
+
+ /** If this option is specified, function #pjsip_parse_uri and other
+ * internal functions that this function calls will parse URI according
+ * to convention for parsing From/To/Contact header. For example, when
+ * the URI is not enclosed in brackets ("<" and ">"), all parameters
+ * are treated as header parameters (not URI parameters).
+ */
+ PJSIP_PARSE_URI_IN_FROM_TO_HDR = 2
+};
+
+/**
+ * Parser syntax error exception value.
+ */
+extern int PJSIP_SYN_ERR_EXCEPTION;
+
+/**
+ * This structure is used to get error reporting from parser.
+ */
+typedef struct pjsip_parser_err_report
+{
+ /** Standard header fields. */
+ PJ_DECL_LIST_MEMBER(struct pjsip_parser_err_report);
+ int except_code; /**< Error exception (e.g. PJSIP_SYN_ERR_EXCEPTION) */
+ int line; /**< Line number. */
+ int col; /**< Column number. */
+ pj_str_t hname; /**< Header name, if any. */
+} pjsip_parser_err_report;
+
+
+/**
+ * Parsing context, the default argument for parsing functions.
+ */
+typedef struct pjsip_parse_ctx
+{
+ pj_scanner *scanner; /**< The scanner. */
+ pj_pool_t *pool; /**< The pool. */
+ pjsip_rx_data *rdata; /**< Optional rdata. */
+} pjsip_parse_ctx;
+
+
+/**
+ * Type of function to parse header. The parsing function must follow these
+ * specification:
+ * - It must not modify the input text.
+ * - The hname and HCOLON has been parsed prior to invoking the handler.
+ * - It returns the header instance on success.
+ * - For error reporting, it must throw PJSIP_SYN_ERR_EXCEPTION exception
+ * instead of just returning NULL.
+ * When exception is thrown, the return value is ignored.
+ * - It must read the header separator after finished reading the header
+ * body. The separator types are described below, and if they don't exist,
+ * exception must be thrown. Header separator can be a:
+ * - newline, such as when the header is part of a SIP message.
+ * - ampersand, such as when the header is part of an URI.
+ * - for the last header, these separator is optional since parsing
+ * can be terminated when seeing EOF.
+ */
+typedef pjsip_hdr* (pjsip_parse_hdr_func)(pjsip_parse_ctx *context);
+
+/**
+ * Type of function to parse URI scheme.
+ * Most of the specification of header parser handler (pjsip_parse_hdr_func)
+ * also applies here (except the separator part).
+ */
+typedef void* (pjsip_parse_uri_func)(pj_scanner *scanner, pj_pool_t *pool,
+ pj_bool_t parse_params);
+
+/**
+ * Register header parser handler. The parser handler MUST follow the
+ * specification of header parser handler function. New registration
+ * overwrites previous registration with the same name.
+ *
+ * @param hname The header name.
+ * @param hshortname The short header name or NULL.
+ * @param fptr The pointer to function to parser the header.
+ *
+ * @return PJ_SUCCESS if success, or the appropriate error code.
+ */
+PJ_DECL(pj_status_t) pjsip_register_hdr_parser( const char *hname,
+ const char *hshortname,
+ pjsip_parse_hdr_func *fptr);
+
+/**
+ * Unregister previously registered header parser handler.
+ * All the arguments MUST exactly equal to the value specified upon
+ * registration of the handler.
+ *
+ * @param hname The header name registered.
+ * @param hshortname The short header name registered, or NULL.
+ * @param fptr Previously registered function to parse the header.
+ *
+ * @return zero if unregistration was successfull.
+ */
+PJ_DECL(pj_status_t) pjsip_unregister_hdr_parser( const char *hname,
+ const char *hshortname,
+ pjsip_parse_hdr_func *fptr);
+
+/**
+ * Register URI scheme parser handler.
+ *
+ * @param scheme The URI scheme registered.
+ * @param func The URI parser function.
+ *
+ * @return zero on success.
+ */
+PJ_DECL(pj_status_t) pjsip_register_uri_parser( char *scheme,
+ pjsip_parse_uri_func *func);
+
+/**
+ * Unregister URI scheme parser handler.
+ * All the arguments MUST exactly equal to the value specified upon
+ * registration of the handler.
+ *
+ * @param scheme The URI scheme as registered previously.
+ * @param func The function handler as registered previously.
+ *
+ * @return zero if the registration was successfull.
+ */
+PJ_DECL(pj_status_t) pjsip_unregister_uri_parser( const char *scheme,
+ pjsip_parse_uri_func *func);
+
+/**
+ * Parse an URI in the input and return the correct instance of URI.
+ *
+ * @param pool The pool to get memory allocations.
+ * @param buf The input buffer, which MUST be NULL terminated.
+ * @param size The length of the string (not counting NULL terminator).
+ * @param options If no options are given (value is zero), the object
+ * returned is dependent on the syntax of the URI,
+ * eg. basic SIP URL, TEL URL, or name address.
+ * If option PJSIP_PARSE_URI_AS_NAMEADDR is given,
+ * then the returned object is always name address object,
+ * with the relevant URI object contained in the name
+ * address object.
+ * @return The URI or NULL when failed. No exception is thrown by
+ * this function (or any public parser functions).
+ */
+PJ_DECL(pjsip_uri*) pjsip_parse_uri( pj_pool_t *pool,
+ char *buf, pj_size_t size,
+ unsigned options);
+
+/**
+ * Parse SIP status line.
+ *
+ * @param buf Text buffer to parse, which MUST be NULL terminated.
+ * @param size The size of the buffer, excluding the NULL character.
+ * @param status_line Structure to receive the parsed elements.
+ *
+ * @return PJ_SUCCESS if a status line is parsed successfully.
+ */
+PJ_DECL(pj_status_t) pjsip_parse_status_line(char *buf, pj_size_t size,
+ pjsip_status_line *status_line);
+
+
+/**
+ * Parse a packet buffer and build a full SIP message from the packet. This
+ * function parses all parts of the message, including request/status line,
+ * all headers, and the message body. The message body however is only
+ * treated as a text block, ie. the function will not try to parse the content
+ * of the body.
+ *
+ * @param pool The pool to allocate memory.
+ * @param buf The input buffer, which MUST be NULL terminated.
+ * @param size The length of the string (not counting NULL terminator).
+ * @param err_list If this parameter is not NULL, then the parser will
+ * put error messages during parsing in this list.
+ *
+ * @return The message or NULL when failed. No exception is thrown
+ * by this function (or any public parser functions).
+ */
+PJ_DECL(pjsip_msg *) pjsip_parse_msg( pj_pool_t *pool,
+ char *buf, pj_size_t size,
+ pjsip_parser_err_report *err_list);
+
+
+/**
+ * Parse a packet buffer and build a rdata. The resulting message will be
+ * stored in \c msg field in the \c rdata. This behaves pretty much like
+ * #pjsip_parse_msg(), except that it will also initialize the header fields
+ * in the \c rdata.
+ *
+ * This function is normally called by the transport layer.
+ *
+ * @param buf The input buffer, which MUST be NULL terminated.
+ * @param size The length of the string (not counting NULL terminator).
+ * @param rdata The receive data buffer to store the message and
+ * its elements.
+ *
+ * @return The message inside the rdata if successfull, or NULL.
+ */
+PJ_DECL(pjsip_msg *) pjsip_parse_rdata( char *buf, pj_size_t size,
+ pjsip_rx_data *rdata );
+
+/**
+ * Check incoming packet to see if a (probably) valid SIP message has been
+ * received.
+ *
+ * @param buf The input buffer, which must be NULL terminated.
+ * @param size The buffer size.
+ * @param is_datagram Put non-zero if transport is datagram oriented.
+ * @param msg_size [out] If message is valid, this parameter will contain
+ * the size of the SIP message (including body, if any).
+ *
+ * @return PJ_SUCCESS if a message is found, or an error code.
+ */
+PJ_DECL(pj_status_t) pjsip_find_msg(const char *buf,
+ pj_size_t size,
+ pj_bool_t is_datagram,
+ pj_size_t *msg_size);
+
+/**
+ * Parse the content of a header and return the header instance.
+ * This function parses the content of a header (ie. part after colon) according
+ * to the expected name, and will return the correct instance of header.
+ *
+ * @param pool Pool to allocate memory for the header.
+ * @param hname Header name which is used to find the correct function
+ * to parse the header.
+ * @param line Header content, which must be NULL terminated.
+ * @param size The length of the string (not counting NULL terminator,
+ * if any).
+ * @param parsed_len If the value is not NULL, then upon return the function
+ * will fill the pointer with the length of the string
+ * that has been parsed. This is usefull for two purposes,
+ * one is when the string may contain more than one header
+ * lines, and two when an error happen the value can
+ * pinpoint the location of the error in the buffer.
+ *
+ * @return The instance of the header if parsing was successful,
+ * or otherwise a NULL pointer will be returned.
+ */
+PJ_DECL(void*) pjsip_parse_hdr( pj_pool_t *pool, const pj_str_t *hname,
+ char *line, pj_size_t size,
+ int *parsed_len);
+
+/**
+ * Parse header line(s). Multiple headers can be parsed by this function.
+ * When there are multiple headers, the headers MUST be separated by either
+ * a newline (as in SIP message) or ampersand mark (as in URI). This separator
+ * is optional for the last header.
+ *
+ * @param pool The pool.
+ * @param input The input text to parse, which must be NULL terminated.
+ * @param size The text length.
+ * @param hlist The header list to store the parsed headers.
+ * This list must have been initialized before calling
+ * this function.
+ * @param options Specify 1 here to make parsing stop when error is
+ * encountered when parsing the header. Otherwise the
+ * error is silently ignored and parsing resumes to the
+ * next line.
+ * @return zero if successfull, or -1 if error is encountered.
+ * Upon error, the \a hlist argument MAY contain
+ * successfully parsed headers.
+ */
+PJ_DECL(pj_status_t) pjsip_parse_headers( pj_pool_t *pool, char *input,
+ pj_size_t size, pjsip_hdr *hlist,
+ unsigned options);
+
+
+/**
+ * @}
+ */
+
+
+#ifdef _MSC_VER
+# pragma warning(push)
+# pragma warning(disable:4510) // default constructor could not be generated
+# pragma warning(disable:4512) // assignment operator could not be generated
+# pragma warning(disable:4610) // user defined constructor required
+#endif
+
+/**
+ * Parser constants. @see pjsip_parser_const()
+ */
+typedef struct pjsip_parser_const_t
+{
+ const pj_str_t pjsip_USER_STR; /**< "user" string constant. */
+ const pj_str_t pjsip_METHOD_STR; /**< "method" string constant */
+ const pj_str_t pjsip_TRANSPORT_STR; /**< "transport" string const. */
+ const pj_str_t pjsip_MADDR_STR; /**< "maddr" string const. */
+ const pj_str_t pjsip_LR_STR; /**< "lr" string const. */
+ const pj_str_t pjsip_SIP_STR; /**< "sip" string constant. */
+ const pj_str_t pjsip_SIPS_STR; /**< "sips" string constant. */
+ const pj_str_t pjsip_TEL_STR; /**< "tel" string constant. */
+ const pj_str_t pjsip_BRANCH_STR; /**< "branch" string constant. */
+ const pj_str_t pjsip_TTL_STR; /**< "ttl" string constant. */
+ const pj_str_t pjsip_RECEIVED_STR; /**< "received" string const. */
+ const pj_str_t pjsip_Q_STR; /**< "q" string constant. */
+ const pj_str_t pjsip_EXPIRES_STR; /**< "expires" string constant. */
+ const pj_str_t pjsip_TAG_STR; /**< "tag" string constant. */
+ const pj_str_t pjsip_RPORT_STR; /**< "rport" string const. */
+
+ pj_cis_t pjsip_HOST_SPEC; /**< For scanning host part. */
+ pj_cis_t pjsip_DIGIT_SPEC; /**< Decimal digits */
+ pj_cis_t pjsip_ALPHA_SPEC; /**< Alpha (A-Z, a-z) */
+ pj_cis_t pjsip_ALNUM_SPEC; /**< Decimal + Alpha. */
+ pj_cis_t pjsip_TOKEN_SPEC; /**< Token. */
+ pj_cis_t pjsip_TOKEN_SPEC_ESC; /**< Token without '%' character */
+ pj_cis_t pjsip_VIA_PARAM_SPEC; /**< Via param is token + ":" for
+ IPv6. */
+ pj_cis_t pjsip_VIA_PARAM_SPEC_ESC; /**< .. as above without '%' */
+ pj_cis_t pjsip_HEX_SPEC; /**< Hexadecimal digits. */
+ pj_cis_t pjsip_PARAM_CHAR_SPEC; /**< For scanning pname (or pvalue
+ when it's not quoted.) in URI */
+ pj_cis_t pjsip_PARAM_CHAR_SPEC_ESC; /**< Variant without the escape ('%')
+ char */
+ pj_cis_t pjsip_HDR_CHAR_SPEC; /**< Chars in hname/havalue in URL. */
+ pj_cis_t pjsip_HDR_CHAR_SPEC_ESC; /**< Variant without the escape ('%')
+ char */
+ pj_cis_t pjsip_PROBE_USER_HOST_SPEC;/**< Hostname characters. */
+ pj_cis_t pjsip_PASSWD_SPEC; /**< Password. */
+ pj_cis_t pjsip_PASSWD_SPEC_ESC; /**< Variant without the escape ('%')
+ char */
+ pj_cis_t pjsip_USER_SPEC; /**< User */
+ pj_cis_t pjsip_USER_SPEC_ESC; /**< Variant without the escape ('%')
+ char */
+ pj_cis_t pjsip_USER_SPEC_LENIENT; /**< User, with additional '#' char */
+ pj_cis_t pjsip_USER_SPEC_LENIENT_ESC;/**< pjsip_USER_SPEC_ESC with '#' */
+ pj_cis_t pjsip_NOT_NEWLINE; /**< For eating up header, basically
+ any chars except newlines or
+ zero. */
+ pj_cis_t pjsip_NOT_COMMA_OR_NEWLINE;/**< Array elements. */
+ pj_cis_t pjsip_DISPLAY_SPEC; /**< Used when searching for display
+ name. */
+ pj_cis_t pjsip_OTHER_URI_CONTENT; /**< Generic URI content. */
+
+} pjsip_parser_const_t;
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+
+/**
+ * Get parser constants.
+ */
+PJ_DECL(const pjsip_parser_const_t*) pjsip_parser_const(void);
+
+
+/*
+ * Parser utilities.
+ */
+enum
+{
+ PJSIP_PARSE_REMOVE_QUOTE = 1
+};
+
+/* Parse parameter in header (matching the character as token) */
+PJ_DECL(void) pjsip_parse_param_imp(pj_scanner *scanner, pj_pool_t *pool,
+ pj_str_t *pname, pj_str_t *pvalue,
+ unsigned opt);
+/* Parse parameter in URL (matching the character as paramchar) */
+PJ_DECL(void) pjsip_parse_uri_param_imp(pj_scanner *scanner, pj_pool_t *pool,
+ pj_str_t *pname, pj_str_t *pvalue,
+ unsigned opt);
+PJ_DECL(void) pjsip_concat_param_imp(pj_str_t *param, pj_pool_t *pool,
+ const pj_str_t *pname,
+ const pj_str_t *pvalue,
+ int sepchar);
+PJ_DECL(void) pjsip_parse_end_hdr_imp ( pj_scanner *scanner );
+
+/* Parse generic array header */
+PJ_DECL(void) pjsip_parse_generic_array_hdr_imp(pjsip_generic_array_hdr *hdr,
+ pj_scanner *scanner);
+
+
+PJ_END_DECL
+
+#endif /* __PJSIP_SIP_PARSER_H__ */
+
diff --git a/jni/pjproject-android/.svn/pristine/48/48b71679ef1df6c5ac257b6357d2d64c42ff9108.svn-base b/jni/pjproject-android/.svn/pristine/48/48b71679ef1df6c5ac257b6357d2d64c42ff9108.svn-base
new file mode 100644
index 0000000..3a1ca22
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/48/48b71679ef1df6c5ac257b6357d2d64c42ff9108.svn-base
@@ -0,0 +1,225 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<!-- 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 -->
+<!-- -->
+<!-- Sipp default 'uas' scenario. -->
+<!-- -->
+
+<scenario name="Forked INVITE, one of them require PRACK">
+ <recv request="INVITE" crlf="true">
+ <action>
+ <ereg regexp="branch=([^;]*)"
+ search_in="hdr"
+ header="Via"
+ assign_to="1,2"/>
+ <assign assign_to="1" variable="2"/>
+ <ereg regexp="CSeq: [ 0-9A-Z]+"
+ search_in="msg"
+ assign_to="4"/>
+ </action>
+ </recv>
+
+ <send>
+ <![CDATA[
+ SIP/2.0 100 Trying
+ [last_Via:]
+ [last_From:]
+ [last_To:]
+ [last_Call-ID:]
+ [$4]
+ ]]>
+ </send>
+
+ <!-- Call leg 1 sends 180/Ringing -->
+ <send retrans="500">
+ <![CDATA[
+ SIP/2.0 180 Ringing1
+ Via: SIP/2.0/UDP 127.0.0.1;received=127.0.0.1;branch=[$2]
+ [last_From:]
+ [last_To:];tag=UA_1
+ [last_Call-ID:]
+ [$4]
+ Contact: <sip:UA_1@[local_ip]:[local_port]>
+ Require: 100rel
+ RSeq: 1000
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <recv request="PRACK" crlf="true">
+ </recv>
+
+ <send>
+ <![CDATA[
+ SIP/2.0 200 OK
+ [last_Via:]
+ [last_From:]
+ [last_To:]
+ [last_Call-ID:]
+ [last_CSeq:]
+ ]]>
+ </send>
+
+
+ <pause milliseconds="2000" />
+
+ <!-- Call leg 2: 180/Ringing -->
+ <send retrans="500">
+ <![CDATA[
+ SIP/2.0 180 Ringing2
+ Via: SIP/2.0/UDP 127.0.0.1;received=127.0.0.1;branch=[$2]
+ [last_From:]
+ [last_To:];tag=UA_2
+ [last_Call-ID:]
+ [$4]
+ Contact: <sip:UA_2@[local_ip]:[local_port]>
+ Require: 100rel
+ RSeq: 2000
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <recv request="PRACK" crlf="true">
+ </recv>
+
+ <send>
+ <![CDATA[
+ SIP/2.0 200 OK
+ [last_Via:]
+ [last_From:]
+ [last_To:]
+ [last_Call-ID:]
+ [last_CSeq:]
+ ]]>
+ </send>
+
+
+ <pause milliseconds="2000" />
+
+ <!-- Call leg 2: sends Ringing again with correct RSeq -->
+ <send retrans="500">
+ <![CDATA[
+ SIP/2.0 180 Ringing2b
+ Via: SIP/2.0/UDP 127.0.0.1;received=127.0.0.1;branch=[$2]
+ [last_From:]
+ [last_To:];tag=UA_2
+ [last_Call-ID:]
+ [$4]
+ Contact: <sip:UA_2@[local_ip]:[local_port]>
+ Require: 100rel
+ RSeq: 2001
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <recv request="PRACK" crlf="true">
+ </recv>
+
+ <send>
+ <![CDATA[
+ SIP/2.0 200 OK
+ [last_Via:]
+ [last_From:]
+ [last_To:]
+ [last_Call-ID:]
+ [last_CSeq:]
+ ]]>
+ </send>
+
+
+ <pause milliseconds="2000" />
+
+ <!-- Call leg 2: sends Ringing again with WRONG RSeq. There should be no PRACK -->
+ <send>
+ <![CDATA[
+ SIP/2.0 180 Ringing2c
+ Via: SIP/2.0/UDP 127.0.0.1;received=127.0.0.1;branch=[$2]
+ [last_From:]
+ [last_To:];tag=UA_2
+ [last_Call-ID:]
+ [$4]
+ Contact: <sip:UA_2@[local_ip]:[local_port]>
+ Require: 100rel
+ RSeq: 2004
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <pause milliseconds="2000" />
+
+ <!-- Then Call leg 1 sends 180/Ringing again -->
+ <send retrans="500">
+ <![CDATA[
+ SIP/2.0 180 Ringing1b
+ Via: SIP/2.0/UDP 127.0.0.1;received=127.0.0.1;branch=[$2]
+ [last_From:]
+ [last_To:];tag=UA_1
+ [last_Call-ID:]
+ [$4]
+ Contact: <sip:UA_1@[local_ip]:[local_port]>
+ Require: 100rel
+ RSeq: 1001
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <recv request="PRACK" crlf="true">
+ </recv>
+
+ <send>
+ <![CDATA[
+ SIP/2.0 200 OK
+ [last_Via:]
+ [last_From:]
+ [last_To:]
+ [last_Call-ID:]
+ [last_CSeq:]
+ ]]>
+ </send>
+
+
+ <pause milliseconds="2000" />
+
+ <!-- 603/Decline -->
+ <send>
+ <![CDATA[
+ SIP/2.0 603 Decline
+ Via: SIP/2.0/UDP 127.0.0.1;received=127.0.0.1;rport=5080;branch=[$2]
+ [last_From:]
+ [last_To:];tag=UA_1
+ [last_Call-ID:]
+ [$4]
+ Content-Length: 0
+ ]]>
+ </send>
+
+
+ <!-- Receive ACK -->
+ <recv request="ACK"
+ optional="false"
+ rtd="true"
+ crlf="true">
+ </recv>
+
+ <!-- definition of the response time repartition table (unit is ms) -->
+ <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+ <!-- definition of the call length repartition table (unit is ms) -->
+ <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+
diff --git a/jni/pjproject-android/.svn/pristine/48/48be13bf75b0e1b38250dc879ae8bd5f91b5a32b.svn-base b/jni/pjproject-android/.svn/pristine/48/48be13bf75b0e1b38250dc879ae8bd5f91b5a32b.svn-base
new file mode 100644
index 0000000..c6a0299
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/48/48be13bf75b0e1b38250dc879ae8bd5f91b5a32b.svn-base
@@ -0,0 +1,234 @@
+/* $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 "test.h"
+#include <pjlib.h>
+#ifdef _MSC_VER
+# pragma warning(disable:4127)
+#endif
+
+#define DO_TEST(test) do { \
+ PJ_LOG(3, ("test", "Running %s...", #test)); \
+ rc = test; \
+ PJ_LOG(3, ("test", \
+ "%s(%d)", \
+ (rc ? "..ERROR" : "..success"), rc)); \
+ if (rc!=0) goto on_return; \
+ } while (0)
+
+
+pj_pool_factory *mem;
+
+int param_echo_sock_type;
+const char *param_echo_server = ECHO_SERVER_ADDRESS;
+int param_echo_port = ECHO_SERVER_START_PORT;
+int param_log_decor = PJ_LOG_HAS_NEWLINE | PJ_LOG_HAS_TIME |
+ PJ_LOG_HAS_MICRO_SEC;
+
+int null_func()
+{
+ return 0;
+}
+
+int test_inner(void)
+{
+ pj_caching_pool caching_pool;
+ const char *filename;
+ int line;
+ int rc = 0;
+
+ mem = &caching_pool.factory;
+
+ pj_log_set_level(3);
+ pj_log_set_decor(param_log_decor);
+
+ rc = pj_init();
+ if (rc != 0) {
+ app_perror("pj_init() error!!", rc);
+ return rc;
+ }
+
+ //pj_dump_config();
+ pj_caching_pool_init( &caching_pool, NULL, 0 );
+
+#if INCLUDE_ERRNO_TEST
+ DO_TEST( errno_test() );
+#endif
+
+#if INCLUDE_EXCEPTION_TEST
+ DO_TEST( exception_test() );
+#endif
+
+#if INCLUDE_OS_TEST
+ DO_TEST( os_test() );
+#endif
+
+#if INCLUDE_RAND_TEST
+ DO_TEST( rand_test() );
+#endif
+
+#if INCLUDE_LIST_TEST
+ DO_TEST( list_test() );
+#endif
+
+#if INCLUDE_POOL_TEST
+ DO_TEST( pool_test() );
+#endif
+
+#if INCLUDE_POOL_PERF_TEST
+ DO_TEST( pool_perf_test() );
+#endif
+
+#if INCLUDE_STRING_TEST
+ DO_TEST( string_test() );
+#endif
+
+#if INCLUDE_FIFOBUF_TEST
+ DO_TEST( fifobuf_test() );
+#endif
+
+#if INCLUDE_RBTREE_TEST
+ DO_TEST( rbtree_test() );
+#endif
+
+#if INCLUDE_HASH_TEST
+ DO_TEST( hash_test() );
+#endif
+
+#if INCLUDE_TIMESTAMP_TEST
+ DO_TEST( timestamp_test() );
+#endif
+
+#if INCLUDE_ATOMIC_TEST
+ DO_TEST( atomic_test() );
+#endif
+
+#if INCLUDE_MUTEX_TEST
+ DO_TEST( mutex_test() );
+#endif
+
+#if INCLUDE_TIMER_TEST
+ DO_TEST( timer_test() );
+#endif
+
+#if INCLUDE_SLEEP_TEST
+ DO_TEST( sleep_test() );
+#endif
+
+#if INCLUDE_THREAD_TEST
+ DO_TEST( thread_test() );
+#endif
+
+#if INCLUDE_SOCK_TEST
+ DO_TEST( sock_test() );
+#endif
+
+#if INCLUDE_SOCK_PERF_TEST
+ DO_TEST( sock_perf_test() );
+#endif
+
+#if INCLUDE_SELECT_TEST
+ DO_TEST( select_test() );
+#endif
+
+#if INCLUDE_UDP_IOQUEUE_TEST
+ DO_TEST( udp_ioqueue_test() );
+#endif
+
+#if PJ_HAS_TCP && INCLUDE_TCP_IOQUEUE_TEST
+ DO_TEST( tcp_ioqueue_test() );
+#endif
+
+#if INCLUDE_IOQUEUE_PERF_TEST
+ DO_TEST( ioqueue_perf_test() );
+#endif
+
+#if INCLUDE_IOQUEUE_UNREG_TEST
+ DO_TEST( udp_ioqueue_unreg_test() );
+#endif
+
+#if INCLUDE_ACTIVESOCK_TEST
+ DO_TEST( activesock_test() );
+#endif
+
+#if INCLUDE_FILE_TEST
+ DO_TEST( file_test() );
+#endif
+
+#if INCLUDE_SSLSOCK_TEST
+ DO_TEST( ssl_sock_test() );
+#endif
+
+#if INCLUDE_ECHO_SERVER
+ //echo_server();
+ //echo_srv_sync();
+ udp_echo_srv_ioqueue();
+
+#elif INCLUDE_ECHO_CLIENT
+ if (param_echo_sock_type == 0)
+ param_echo_sock_type = pj_SOCK_DGRAM();
+
+ echo_client( param_echo_sock_type,
+ param_echo_server,
+ param_echo_port);
+#endif
+
+ goto on_return;
+
+on_return:
+
+ pj_caching_pool_destroy( &caching_pool );
+
+ PJ_LOG(3,("test", ""));
+
+ pj_thread_get_stack_info(pj_thread_this(), &filename, &line);
+ PJ_LOG(3,("test", "Stack max usage: %u, deepest: %s:%u",
+ pj_thread_get_stack_max_usage(pj_thread_this()),
+ filename, line));
+ if (rc == 0)
+ PJ_LOG(3,("test", "Looks like everything is okay!.."));
+ else
+ PJ_LOG(3,("test", "Test completed with error(s)"));
+
+ pj_shutdown();
+
+ return 0;
+}
+
+#include <pj/sock.h>
+
+int test_main(void)
+{
+ int i;
+ PJ_USE_EXCEPTION;
+
+ i = pj_AF_INET();
+
+ PJ_TRY {
+ return test_inner();
+ }
+ PJ_CATCH_ANY {
+ int id = PJ_GET_EXCEPTION();
+ PJ_LOG(3,("test", "FATAL: unhandled exception id %d (%s)",
+ id, pj_exception_id_name(id)));
+ }
+ PJ_END;
+
+ return -1;
+}
diff --git a/jni/pjproject-android/.svn/pristine/48/48dbc5e7e6ac04eff23e6b05eb2f32d14679d45c.svn-base b/jni/pjproject-android/.svn/pristine/48/48dbc5e7e6ac04eff23e6b05eb2f32d14679d45c.svn-base
new file mode 100644
index 0000000..1ac6276
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/48/48dbc5e7e6ac04eff23e6b05eb2f32d14679d45c.svn-base
@@ -0,0 +1,76 @@
+/* $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
+ */
+#ifndef __PJNATH_TYPES_H__
+#define __PJNATH_TYPES_H__
+
+/**
+ * @file types.h
+ * @brief PJNATH types.
+ */
+
+#include <pj/types.h>
+#include <pjnath/config.h>
+
+/**
+ * @defgroup PJNATH NAT Traversal Helper Library
+ * @{
+ */
+
+PJ_BEGIN_DECL
+
+/**
+ * This constant describes a number to be used to identify an invalid TURN
+ * channel number.
+ */
+#define PJ_TURN_INVALID_CHANNEL 0xFFFF
+
+
+/**
+ * Initialize pjnath library.
+ *
+ * @return Initialization status.
+ */
+PJ_DECL(pj_status_t) pjnath_init(void);
+
+
+/**
+ * Display error to the log.
+ *
+ * @param sender The sender name.
+ * @param title Title message.
+ * @param status The error status.
+ */
+#if PJNATH_ERROR_LEVEL <= PJ_LOG_MAX_LEVEL
+PJ_DECL(void) pjnath_perror(const char *sender, const char *title,
+ pj_status_t status);
+#else
+# define pjnath_perror(sender, title, status)
+#endif
+
+
+
+PJ_END_DECL
+
+/**
+ * @}
+ */
+
+#endif /* __PJNATH_TYPES_H__ */
+
diff --git a/jni/pjproject-android/.svn/pristine/48/48e19015b540486be07b74b6e3525d636a0b5097.svn-base b/jni/pjproject-android/.svn/pristine/48/48e19015b540486be07b74b6e3525d636a0b5097.svn-base
new file mode 100644
index 0000000..b04da2e
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/48/48e19015b540486be07b74b6e3525d636a0b5097.svn-base
@@ -0,0 +1,404 @@
+/* $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/transport_loop.h>
+#include <pj/array.h>
+#include <pj/assert.h>
+#include <pj/errno.h>
+#include <pj/ioqueue.h>
+#include <pj/log.h>
+#include <pj/pool.h>
+#include <pj/rand.h>
+#include <pj/string.h>
+
+
+struct user
+{
+ pj_bool_t rx_disabled; /**< Doesn't want to receive pkt? */
+ void *user_data; /**< Only valid when attached */
+ void (*rtp_cb)( void*, /**< To report incoming RTP. */
+ void*,
+ pj_ssize_t);
+ void (*rtcp_cb)( void*, /**< To report incoming RTCP. */
+ void*,
+ pj_ssize_t);
+};
+
+struct transport_loop
+{
+ pjmedia_transport base; /**< Base transport. */
+
+ pj_pool_t *pool; /**< Memory pool */
+ unsigned user_cnt; /**< Number of attachments */
+ struct user users[4]; /**< Array of users. */
+
+ unsigned tx_drop_pct; /**< Percent of tx pkts to drop. */
+ unsigned rx_drop_pct; /**< Percent of rx pkts to drop. */
+
+};
+
+
+
+/*
+ * These are media transport operations.
+ */
+static pj_status_t transport_get_info (pjmedia_transport *tp,
+ pjmedia_transport_info *info);
+static pj_status_t transport_attach (pjmedia_transport *tp,
+ void *user_data,
+ const pj_sockaddr_t *rem_addr,
+ const pj_sockaddr_t *rem_rtcp,
+ unsigned addr_len,
+ void (*rtp_cb)(void*,
+ void*,
+ pj_ssize_t),
+ void (*rtcp_cb)(void*,
+ void*,
+ pj_ssize_t));
+static void transport_detach (pjmedia_transport *tp,
+ void *strm);
+static pj_status_t transport_send_rtp( pjmedia_transport *tp,
+ const void *pkt,
+ pj_size_t size);
+static pj_status_t transport_send_rtcp(pjmedia_transport *tp,
+ const void *pkt,
+ pj_size_t size);
+static pj_status_t transport_send_rtcp2(pjmedia_transport *tp,
+ const pj_sockaddr_t *addr,
+ unsigned addr_len,
+ const void *pkt,
+ pj_size_t size);
+static pj_status_t transport_media_create(pjmedia_transport *tp,
+ pj_pool_t *pool,
+ unsigned options,
+ const pjmedia_sdp_session *sdp_remote,
+ unsigned media_index);
+static pj_status_t transport_encode_sdp(pjmedia_transport *tp,
+ pj_pool_t *pool,
+ pjmedia_sdp_session *sdp_local,
+ const pjmedia_sdp_session *rem_sdp,
+ unsigned media_index);
+static pj_status_t transport_media_start (pjmedia_transport *tp,
+ pj_pool_t *pool,
+ const pjmedia_sdp_session *sdp_local,
+ const pjmedia_sdp_session *sdp_remote,
+ unsigned media_index);
+static pj_status_t transport_media_stop(pjmedia_transport *tp);
+static pj_status_t transport_simulate_lost(pjmedia_transport *tp,
+ pjmedia_dir dir,
+ unsigned pct_lost);
+static pj_status_t transport_destroy (pjmedia_transport *tp);
+
+
+static pjmedia_transport_op transport_udp_op =
+{
+ &transport_get_info,
+ &transport_attach,
+ &transport_detach,
+ &transport_send_rtp,
+ &transport_send_rtcp,
+ &transport_send_rtcp2,
+ &transport_media_create,
+ &transport_encode_sdp,
+ &transport_media_start,
+ &transport_media_stop,
+ &transport_simulate_lost,
+ &transport_destroy
+};
+
+
+/**
+ * Create loopback transport.
+ */
+PJ_DEF(pj_status_t) pjmedia_transport_loop_create(pjmedia_endpt *endpt,
+ pjmedia_transport **p_tp)
+{
+ struct transport_loop *tp;
+ pj_pool_t *pool;
+
+ /* Sanity check */
+ PJ_ASSERT_RETURN(endpt && p_tp, PJ_EINVAL);
+
+ /* Create transport structure */
+ pool = pjmedia_endpt_create_pool(endpt, "tploop", 512, 512);
+ if (!pool)
+ return PJ_ENOMEM;
+
+ tp = PJ_POOL_ZALLOC_T(pool, struct transport_loop);
+ tp->pool = pool;
+ pj_ansi_strncpy(tp->base.name, tp->pool->obj_name, PJ_MAX_OBJ_NAME-1);
+ tp->base.op = &transport_udp_op;
+ tp->base.type = PJMEDIA_TRANSPORT_TYPE_UDP;
+
+ /* Done */
+ *p_tp = &tp->base;
+ return PJ_SUCCESS;
+}
+
+
+PJ_DEF(pj_status_t) pjmedia_transport_loop_disable_rx( pjmedia_transport *tp,
+ void *user,
+ pj_bool_t disabled)
+{
+ struct transport_loop *loop = (struct transport_loop*) tp;
+ unsigned i;
+
+ for (i=0; i<loop->user_cnt; ++i) {
+ if (loop->users[i].user_data == user) {
+ loop->users[i].rx_disabled = disabled;
+ return PJ_SUCCESS;
+ }
+ }
+ pj_assert(!"Invalid stream user");
+ return PJ_ENOTFOUND;
+}
+
+/**
+ * Close loopback transport.
+ */
+static pj_status_t transport_destroy(pjmedia_transport *tp)
+{
+ struct transport_loop *loop = (struct transport_loop*) tp;
+
+ /* Sanity check */
+ PJ_ASSERT_RETURN(tp, PJ_EINVAL);
+
+ pj_pool_release(loop->pool);
+
+ return PJ_SUCCESS;
+}
+
+
+/* Called to get the transport info */
+static pj_status_t transport_get_info(pjmedia_transport *tp,
+ pjmedia_transport_info *info)
+{
+ PJ_ASSERT_RETURN(tp && info, PJ_EINVAL);
+
+ info->sock_info.rtp_sock = 1;
+ pj_sockaddr_in_init(&info->sock_info.rtp_addr_name.ipv4, 0, 0);
+ info->sock_info.rtcp_sock = 2;
+ pj_sockaddr_in_init(&info->sock_info.rtcp_addr_name.ipv4, 0, 0);
+
+ return PJ_SUCCESS;
+}
+
+
+/* Called by application to initialize the transport */
+static pj_status_t transport_attach( pjmedia_transport *tp,
+ void *user_data,
+ const pj_sockaddr_t *rem_addr,
+ const pj_sockaddr_t *rem_rtcp,
+ unsigned addr_len,
+ void (*rtp_cb)(void*,
+ void*,
+ pj_ssize_t),
+ void (*rtcp_cb)(void*,
+ void*,
+ pj_ssize_t))
+{
+ struct transport_loop *loop = (struct transport_loop*) tp;
+ unsigned i;
+ const pj_sockaddr *rtcp_addr;
+
+ /* Validate arguments */
+ PJ_ASSERT_RETURN(tp && rem_addr && addr_len, PJ_EINVAL);
+
+ /* Must not be "attached" to same user */
+ for (i=0; i<loop->user_cnt; ++i) {
+ PJ_ASSERT_RETURN(loop->users[i].user_data != user_data,
+ PJ_EINVALIDOP);
+ }
+ PJ_ASSERT_RETURN(loop->user_cnt != PJ_ARRAY_SIZE(loop->users),
+ PJ_ETOOMANY);
+
+ PJ_UNUSED_ARG(rem_rtcp);
+ PJ_UNUSED_ARG(rtcp_addr);
+
+ /* "Attach" the application: */
+
+ /* Save the new user */
+ loop->users[loop->user_cnt].rtp_cb = rtp_cb;
+ loop->users[loop->user_cnt].rtcp_cb = rtcp_cb;
+ loop->users[loop->user_cnt].user_data = user_data;
+ ++loop->user_cnt;
+
+ return PJ_SUCCESS;
+}
+
+
+/* Called by application when it no longer needs the transport */
+static void transport_detach( pjmedia_transport *tp,
+ void *user_data)
+{
+ struct transport_loop *loop = (struct transport_loop*) tp;
+ unsigned i;
+
+ pj_assert(tp);
+
+ for (i=0; i<loop->user_cnt; ++i) {
+ if (loop->users[i].user_data == user_data)
+ break;
+ }
+
+ /* Remove this user */
+ if (i != loop->user_cnt) {
+ pj_array_erase(loop->users, sizeof(loop->users[0]),
+ loop->user_cnt, i);
+ --loop->user_cnt;
+ }
+}
+
+
+/* Called by application to send RTP packet */
+static pj_status_t transport_send_rtp( pjmedia_transport *tp,
+ const void *pkt,
+ pj_size_t size)
+{
+ struct transport_loop *loop = (struct transport_loop*)tp;
+ unsigned i;
+
+ /* Simulate packet lost on TX direction */
+ if (loop->tx_drop_pct) {
+ if ((pj_rand() % 100) <= (int)loop->tx_drop_pct) {
+ PJ_LOG(5,(loop->base.name,
+ "TX RTP packet dropped because of pkt lost "
+ "simulation"));
+ return PJ_SUCCESS;
+ }
+ }
+
+ /* Simulate packet lost on RX direction */
+ if (loop->rx_drop_pct) {
+ if ((pj_rand() % 100) <= (int)loop->rx_drop_pct) {
+ PJ_LOG(5,(loop->base.name,
+ "RX RTP packet dropped because of pkt lost "
+ "simulation"));
+ return PJ_SUCCESS;
+ }
+ }
+
+ /* Distribute to users */
+ for (i=0; i<loop->user_cnt; ++i) {
+ if (!loop->users[i].rx_disabled && loop->users[i].rtp_cb)
+ (*loop->users[i].rtp_cb)(loop->users[i].user_data, (void*)pkt,
+ size);
+ }
+
+ return PJ_SUCCESS;
+}
+
+/* Called by application to send RTCP packet */
+static pj_status_t transport_send_rtcp(pjmedia_transport *tp,
+ const void *pkt,
+ pj_size_t size)
+{
+ return transport_send_rtcp2(tp, NULL, 0, pkt, size);
+}
+
+
+/* Called by application to send RTCP packet */
+static pj_status_t transport_send_rtcp2(pjmedia_transport *tp,
+ const pj_sockaddr_t *addr,
+ unsigned addr_len,
+ const void *pkt,
+ pj_size_t size)
+{
+ struct transport_loop *loop = (struct transport_loop*)tp;
+ unsigned i;
+
+ PJ_UNUSED_ARG(addr_len);
+ PJ_UNUSED_ARG(addr);
+
+ /* Distribute to users */
+ for (i=0; i<loop->user_cnt; ++i) {
+ if (!loop->users[i].rx_disabled && loop->users[i].rtcp_cb)
+ (*loop->users[i].rtcp_cb)(loop->users[i].user_data, (void*)pkt,
+ size);
+ }
+
+ return PJ_SUCCESS;
+}
+
+
+static pj_status_t transport_media_create(pjmedia_transport *tp,
+ pj_pool_t *pool,
+ unsigned options,
+ const pjmedia_sdp_session *sdp_remote,
+ unsigned media_index)
+{
+ PJ_UNUSED_ARG(tp);
+ PJ_UNUSED_ARG(pool);
+ PJ_UNUSED_ARG(options);
+ PJ_UNUSED_ARG(sdp_remote);
+ PJ_UNUSED_ARG(media_index);
+ return PJ_SUCCESS;
+}
+
+static pj_status_t transport_encode_sdp(pjmedia_transport *tp,
+ pj_pool_t *pool,
+ pjmedia_sdp_session *sdp_local,
+ const pjmedia_sdp_session *rem_sdp,
+ unsigned media_index)
+{
+ PJ_UNUSED_ARG(tp);
+ PJ_UNUSED_ARG(pool);
+ PJ_UNUSED_ARG(sdp_local);
+ PJ_UNUSED_ARG(rem_sdp);
+ PJ_UNUSED_ARG(media_index);
+ return PJ_SUCCESS;
+}
+
+static pj_status_t transport_media_start(pjmedia_transport *tp,
+ pj_pool_t *pool,
+ const pjmedia_sdp_session *sdp_local,
+ const pjmedia_sdp_session *sdp_remote,
+ unsigned media_index)
+{
+ PJ_UNUSED_ARG(tp);
+ PJ_UNUSED_ARG(pool);
+ PJ_UNUSED_ARG(sdp_local);
+ PJ_UNUSED_ARG(sdp_remote);
+ PJ_UNUSED_ARG(media_index);
+ return PJ_SUCCESS;
+}
+
+static pj_status_t transport_media_stop(pjmedia_transport *tp)
+{
+ PJ_UNUSED_ARG(tp);
+ return PJ_SUCCESS;
+}
+
+static pj_status_t transport_simulate_lost(pjmedia_transport *tp,
+ pjmedia_dir dir,
+ unsigned pct_lost)
+{
+ struct transport_loop *loop = (struct transport_loop*)tp;
+
+ PJ_ASSERT_RETURN(tp && pct_lost <= 100, PJ_EINVAL);
+
+ if (dir & PJMEDIA_DIR_ENCODING)
+ loop->tx_drop_pct = pct_lost;
+
+ if (dir & PJMEDIA_DIR_DECODING)
+ loop->rx_drop_pct = pct_lost;
+
+ return PJ_SUCCESS;
+}
+
diff --git a/jni/pjproject-android/.svn/pristine/48/48e90e66fc27139a0769b51ba1a192f6808b4595.svn-base b/jni/pjproject-android/.svn/pristine/48/48e90e66fc27139a0769b51ba1a192f6808b4595.svn-base
new file mode 100644
index 0000000..5379486
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/48/48e90e66fc27139a0769b51ba1a192f6808b4595.svn-base
@@ -0,0 +1,371 @@
+/* $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 <pj/pool.h>
+
+PJ_IDEF(pj_str_t) pj_str(char *str)
+{
+ pj_str_t dst;
+ dst.ptr = str;
+ dst.slen = str ? pj_ansi_strlen(str) : 0;
+ return dst;
+}
+
+PJ_IDEF(pj_str_t*) pj_strdup(pj_pool_t *pool,
+ pj_str_t *dst,
+ const pj_str_t *src)
+{
+ /* Without this, destination will be corrupted */
+ if (dst == src)
+ return dst;
+
+ if (src->slen) {
+ dst->ptr = (char*)pj_pool_alloc(pool, src->slen);
+ pj_memcpy(dst->ptr, src->ptr, src->slen);
+ }
+ dst->slen = src->slen;
+ return dst;
+}
+
+PJ_IDEF(pj_str_t*) pj_strdup_with_null( pj_pool_t *pool,
+ pj_str_t *dst,
+ const pj_str_t *src)
+{
+ dst->ptr = (char*)pj_pool_alloc(pool, src->slen+1);
+ if (src->slen) {
+ pj_memcpy(dst->ptr, src->ptr, src->slen);
+ }
+ dst->slen = src->slen;
+ dst->ptr[dst->slen] = '\0';
+ return dst;
+}
+
+PJ_IDEF(pj_str_t*) pj_strdup2(pj_pool_t *pool,
+ pj_str_t *dst,
+ const char *src)
+{
+ dst->slen = src ? pj_ansi_strlen(src) : 0;
+ if (dst->slen) {
+ dst->ptr = (char*)pj_pool_alloc(pool, dst->slen);
+ pj_memcpy(dst->ptr, src, dst->slen);
+ } else {
+ dst->ptr = NULL;
+ }
+ return dst;
+}
+
+PJ_IDEF(pj_str_t*) pj_strdup2_with_null( pj_pool_t *pool,
+ pj_str_t *dst,
+ const char *src)
+{
+ dst->slen = src ? pj_ansi_strlen(src) : 0;
+ dst->ptr = (char*)pj_pool_alloc(pool, dst->slen+1);
+ if (dst->slen) {
+ pj_memcpy(dst->ptr, src, dst->slen);
+ }
+ dst->ptr[dst->slen] = '\0';
+ return dst;
+}
+
+PJ_IDEF(pj_str_t) pj_strdup3(pj_pool_t *pool, const char *src)
+{
+ pj_str_t temp;
+ pj_strdup2(pool, &temp, src);
+ return temp;
+}
+
+PJ_IDEF(pj_str_t*) pj_strassign( pj_str_t *dst, pj_str_t *src )
+{
+ dst->ptr = src->ptr;
+ dst->slen = src->slen;
+ return dst;
+}
+
+PJ_IDEF(pj_str_t*) pj_strcpy(pj_str_t *dst, const pj_str_t *src)
+{
+ dst->slen = src->slen;
+ if (src->slen > 0)
+ pj_memcpy(dst->ptr, src->ptr, src->slen);
+ return dst;
+}
+
+PJ_IDEF(pj_str_t*) pj_strcpy2(pj_str_t *dst, const char *src)
+{
+ dst->slen = src ? pj_ansi_strlen(src) : 0;
+ if (dst->slen > 0)
+ pj_memcpy(dst->ptr, src, dst->slen);
+ return dst;
+}
+
+PJ_IDEF(pj_str_t*) pj_strncpy( pj_str_t *dst, const pj_str_t *src,
+ pj_ssize_t max)
+{
+ if (max > src->slen) max = src->slen;
+ pj_memcpy(dst->ptr, src->ptr, max);
+ dst->slen = max;
+ return dst;
+}
+
+PJ_IDEF(pj_str_t*) pj_strncpy_with_null( pj_str_t *dst, const pj_str_t *src,
+ pj_ssize_t max)
+{
+ if (max <= src->slen)
+ max = max-1;
+ else
+ max = src->slen;
+
+ pj_memcpy(dst->ptr, src->ptr, max);
+ dst->ptr[max] = '\0';
+ dst->slen = max;
+ return dst;
+}
+
+
+PJ_IDEF(int) pj_strcmp( const pj_str_t *str1, const pj_str_t *str2)
+{
+ if (str1->slen == 0) {
+ return str2->slen==0 ? 0 : -1;
+ } else if (str2->slen == 0) {
+ return 1;
+ } else {
+ pj_size_t min = (str1->slen < str2->slen)? str1->slen : str2->slen;
+ int res = pj_memcmp(str1->ptr, str2->ptr, min);
+ if (res == 0) {
+ return (str1->slen < str2->slen) ? -1 :
+ (str1->slen == str2->slen ? 0 : 1);
+ } else {
+ return res;
+ }
+ }
+}
+
+PJ_IDEF(int) pj_strncmp( const pj_str_t *str1, const pj_str_t *str2,
+ pj_size_t len)
+{
+ pj_str_t copy1, copy2;
+
+ if (len < (unsigned)str1->slen) {
+ copy1.ptr = str1->ptr;
+ copy1.slen = len;
+ str1 = ©1;
+ }
+
+ if (len < (unsigned)str2->slen) {
+ copy2.ptr = str2->ptr;
+ copy2.slen = len;
+ str2 = ©2;
+ }
+
+ return pj_strcmp(str1, str2);
+}
+
+PJ_IDEF(int) pj_strncmp2( const pj_str_t *str1, const char *str2,
+ pj_size_t len)
+{
+ pj_str_t copy2;
+
+ if (str2) {
+ copy2.ptr = (char*)str2;
+ copy2.slen = pj_ansi_strlen(str2);
+ } else {
+ copy2.slen = 0;
+ }
+
+ return pj_strncmp(str1, ©2, len);
+}
+
+PJ_IDEF(int) pj_strcmp2( const pj_str_t *str1, const char *str2 )
+{
+ pj_str_t copy2;
+
+ if (str2) {
+ copy2.ptr = (char*)str2;
+ copy2.slen = pj_ansi_strlen(str2);
+ } else {
+ copy2.ptr = NULL;
+ copy2.slen = 0;
+ }
+
+ return pj_strcmp(str1, ©2);
+}
+
+PJ_IDEF(int) pj_stricmp( const pj_str_t *str1, const pj_str_t *str2)
+{
+ if (str1->slen == 0) {
+ return str2->slen==0 ? 0 : -1;
+ } else if (str2->slen == 0) {
+ return 1;
+ } else {
+ pj_size_t min = (str1->slen < str2->slen)? str1->slen : str2->slen;
+ int res = pj_ansi_strnicmp(str1->ptr, str2->ptr, min);
+ if (res == 0) {
+ return (str1->slen < str2->slen) ? -1 :
+ (str1->slen == str2->slen ? 0 : 1);
+ } else {
+ return res;
+ }
+ }
+}
+
+#if defined(PJ_HAS_STRICMP_ALNUM) && PJ_HAS_STRICMP_ALNUM!=0
+PJ_IDEF(int) strnicmp_alnum( const char *str1, const char *str2,
+ int len)
+{
+ if (len==0)
+ return 0;
+ else {
+ register const pj_uint32_t *p1 = (pj_uint32_t*)str1,
+ *p2 = (pj_uint32_t*)str2;
+ while (len > 3 && (*p1 & 0x5F5F5F5F)==(*p2 & 0x5F5F5F5F))
+ ++p1, ++p2, len-=4;
+
+ if (len > 3)
+ return -1;
+#if defined(PJ_IS_LITTLE_ENDIAN) && PJ_IS_LITTLE_ENDIAN!=0
+ else if (len==3)
+ return ((*p1 & 0x005F5F5F)==(*p2 & 0x005F5F5F)) ? 0 : -1;
+ else if (len==2)
+ return ((*p1 & 0x00005F5F)==(*p2 & 0x00005F5F)) ? 0 : -1;
+ else if (len==1)
+ return ((*p1 & 0x0000005F)==(*p2 & 0x0000005F)) ? 0 : -1;
+#else
+ else if (len==3)
+ return ((*p1 & 0x5F5F5F00)==(*p2 & 0x5F5F5F00)) ? 0 : -1;
+ else if (len==2)
+ return ((*p1 & 0x5F5F0000)==(*p2 & 0x5F5F0000)) ? 0 : -1;
+ else if (len==1)
+ return ((*p1 & 0x5F000000)==(*p2 & 0x5F000000)) ? 0 : -1;
+#endif
+ else
+ return 0;
+ }
+}
+
+PJ_IDEF(int) pj_stricmp_alnum(const pj_str_t *str1, const pj_str_t *str2)
+{
+ register int len = str1->slen;
+
+ if (len != str2->slen) {
+ return (len < str2->slen) ? -1 : 1;
+ } else if (len == 0) {
+ return 0;
+ } else {
+ register const pj_uint32_t *p1 = (pj_uint32_t*)str1->ptr,
+ *p2 = (pj_uint32_t*)str2->ptr;
+ while (len > 3 && (*p1 & 0x5F5F5F5F)==(*p2 & 0x5F5F5F5F))
+ ++p1, ++p2, len-=4;
+
+ if (len > 3)
+ return -1;
+#if defined(PJ_IS_LITTLE_ENDIAN) && PJ_IS_LITTLE_ENDIAN!=0
+ else if (len==3)
+ return ((*p1 & 0x005F5F5F)==(*p2 & 0x005F5F5F)) ? 0 : -1;
+ else if (len==2)
+ return ((*p1 & 0x00005F5F)==(*p2 & 0x00005F5F)) ? 0 : -1;
+ else if (len==1)
+ return ((*p1 & 0x0000005F)==(*p2 & 0x0000005F)) ? 0 : -1;
+#else
+ else if (len==3)
+ return ((*p1 & 0x5F5F5F00)==(*p2 & 0x5F5F5F00)) ? 0 : -1;
+ else if (len==2)
+ return ((*p1 & 0x5F5F0000)==(*p2 & 0x5F5F0000)) ? 0 : -1;
+ else if (len==1)
+ return ((*p1 & 0x5F000000)==(*p2 & 0x5F000000)) ? 0 : -1;
+#endif
+ else
+ return 0;
+ }
+}
+#endif /* PJ_HAS_STRICMP_ALNUM */
+
+PJ_IDEF(int) pj_stricmp2( const pj_str_t *str1, const char *str2)
+{
+ pj_str_t copy2;
+
+ if (str2) {
+ copy2.ptr = (char*)str2;
+ copy2.slen = pj_ansi_strlen(str2);
+ } else {
+ copy2.ptr = NULL;
+ copy2.slen = 0;
+ }
+
+ return pj_stricmp(str1, ©2);
+}
+
+PJ_IDEF(int) pj_strnicmp( const pj_str_t *str1, const pj_str_t *str2,
+ pj_size_t len)
+{
+ pj_str_t copy1, copy2;
+
+ if (len < (unsigned)str1->slen) {
+ copy1.ptr = str1->ptr;
+ copy1.slen = len;
+ str1 = ©1;
+ }
+
+ if (len < (unsigned)str2->slen) {
+ copy2.ptr = str2->ptr;
+ copy2.slen = len;
+ str2 = ©2;
+ }
+
+ return pj_stricmp(str1, str2);
+}
+
+PJ_IDEF(int) pj_strnicmp2( const pj_str_t *str1, const char *str2,
+ pj_size_t len)
+{
+ pj_str_t copy2;
+
+ if (str2) {
+ copy2.ptr = (char*)str2;
+ copy2.slen = pj_ansi_strlen(str2);
+ } else {
+ copy2.slen = 0;
+ }
+
+ return pj_strnicmp(str1, ©2, len);
+}
+
+PJ_IDEF(void) pj_strcat(pj_str_t *dst, const pj_str_t *src)
+{
+ if (src->slen) {
+ pj_memcpy(dst->ptr + dst->slen, src->ptr, src->slen);
+ dst->slen += src->slen;
+ }
+}
+
+PJ_IDEF(void) pj_strcat2(pj_str_t *dst, const char *str)
+{
+ pj_size_t len = str? pj_ansi_strlen(str) : 0;
+ if (len) {
+ pj_memcpy(dst->ptr + dst->slen, str, len);
+ dst->slen += len;
+ }
+}
+
+PJ_IDEF(pj_str_t*) pj_strtrim( pj_str_t *str )
+{
+ pj_strltrim(str);
+ pj_strrtrim(str);
+ return str;
+}
+
diff --git a/jni/pjproject-android/.svn/pristine/48/48f57c5707f4c9fb4d82e8f5ff489392a4b59ffe.svn-base b/jni/pjproject-android/.svn/pristine/48/48f57c5707f4c9fb4d82e8f5ff489392a4b59ffe.svn-base
new file mode 100644
index 0000000..a71004c
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/48/48f57c5707f4c9fb4d82e8f5ff489392a4b59ffe.svn-base
@@ -0,0 +1,17 @@
+# $Id$
+#
+from inc_cfg import *
+
+# Call with L16/16000/1 codec
+test_param = TestParam(
+ "PESQ codec L16/16000/1 (RX side uses snd dev)",
+ [
+ InstanceParam("UA1", "--max-calls=1 --add-codec L16/16000/1 --clock-rate 16000 --play-file wavs/input.16.wav --null-audio"),
+ InstanceParam("UA2", "--max-calls=1 --add-codec L16/16000/1 --clock-rate 16000 --rec-file wavs/tmp.16.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/48/48fac219ee3d8b02afceca65e691a7ab95043618.svn-base b/jni/pjproject-android/.svn/pristine/48/48fac219ee3d8b02afceca65e691a7ab95043618.svn-base
new file mode 100644
index 0000000..db5ea4a
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/48/48fac219ee3d8b02afceca65e691a7ab95043618.svn-base
@@ -0,0 +1,296 @@
+/* Copyright (C) 2002 Jean-Marc Valin
+ File: stereo.c
+
+ 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.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <speex/speex_stereo.h>
+#include <speex/speex_callbacks.h>
+#include "math_approx.h"
+#include "vq.h"
+#include <math.h>
+#include "os_support.h"
+
+typedef struct RealSpeexStereoState {
+ spx_word32_t balance; /**< Left/right balance info */
+ spx_word32_t e_ratio; /**< Ratio of energies: E(left+right)/[E(left)+E(right)] */
+ spx_word32_t smooth_left; /**< Smoothed left channel gain */
+ spx_word32_t smooth_right; /**< Smoothed right channel gain */
+ spx_uint32_t reserved1; /**< Reserved for future use */
+ spx_int32_t reserved2; /**< Reserved for future use */
+} RealSpeexStereoState;
+
+
+/*float e_ratio_quant[4] = {1, 1.26, 1.587, 2};*/
+#ifndef FIXED_POINT
+static const float e_ratio_quant[4] = {.25f, .315f, .397f, .5f};
+static const float e_ratio_quant_bounds[3] = {0.2825f, 0.356f, 0.4485f};
+#else
+static const spx_word16_t e_ratio_quant[4] = {8192, 10332, 13009, 16384};
+static const spx_word16_t e_ratio_quant_bounds[3] = {9257, 11665, 14696};
+static const spx_word16_t balance_bounds[31] = {18, 23, 30, 38, 49, 63, 81, 104,
+ 134, 172, 221, 284, 364, 468, 600, 771,
+ 990, 1271, 1632, 2096, 2691, 3455, 4436, 5696,
+ 7314, 9392, 12059, 15484, 19882, 25529, 32766};
+#endif
+
+/* This is an ugly compatibility hack that properly resets the stereo state
+ In case it it compiled in fixed-point, but initialised with the deprecated
+ floating point static initialiser */
+#ifdef FIXED_POINT
+#define COMPATIBILITY_HACK(s) do {if ((s)->reserved1 != 0xdeadbeef) speex_stereo_state_reset((SpeexStereoState*)s); } while (0);
+#else
+#define COMPATIBILITY_HACK(s)
+#endif
+
+EXPORT SpeexStereoState *speex_stereo_state_init()
+{
+ SpeexStereoState *stereo = speex_alloc(sizeof(SpeexStereoState));
+ speex_stereo_state_reset(stereo);
+ return stereo;
+}
+
+EXPORT void speex_stereo_state_reset(SpeexStereoState *_stereo)
+{
+ RealSpeexStereoState *stereo = (RealSpeexStereoState*)_stereo;
+#ifdef FIXED_POINT
+ stereo->balance = 65536;
+ stereo->e_ratio = 16384;
+ stereo->smooth_left = 16384;
+ stereo->smooth_right = 16384;
+ stereo->reserved1 = 0xdeadbeef;
+ stereo->reserved2 = 0;
+#else
+ stereo->balance = 1.0f;
+ stereo->e_ratio = .5f;
+ stereo->smooth_left = 1.f;
+ stereo->smooth_right = 1.f;
+ stereo->reserved1 = 0;
+ stereo->reserved2 = 0;
+#endif
+}
+
+EXPORT void speex_stereo_state_destroy(SpeexStereoState *stereo)
+{
+ speex_free(stereo);
+}
+
+#ifndef DISABLE_FLOAT_API
+EXPORT void speex_encode_stereo(float *data, int frame_size, SpeexBits *bits)
+{
+ int i, tmp;
+ float e_left=0, e_right=0, e_tot=0;
+ float balance, e_ratio;
+ for (i=0;i<frame_size;i++)
+ {
+ e_left += ((float)data[2*i])*data[2*i];
+ e_right += ((float)data[2*i+1])*data[2*i+1];
+ data[i] = .5*(((float)data[2*i])+data[2*i+1]);
+ e_tot += ((float)data[i])*data[i];
+ }
+ balance=(e_left+1)/(e_right+1);
+ e_ratio = e_tot/(1+e_left+e_right);
+
+ /*Quantization*/
+ speex_bits_pack(bits, 14, 5);
+ speex_bits_pack(bits, SPEEX_INBAND_STEREO, 4);
+
+ balance=4*log(balance);
+
+ /*Pack sign*/
+ if (balance>0)
+ speex_bits_pack(bits, 0, 1);
+ else
+ speex_bits_pack(bits, 1, 1);
+ balance=floor(.5+fabs(balance));
+ if (balance>30)
+ balance=31;
+
+ speex_bits_pack(bits, (int)balance, 5);
+
+ /* FIXME: this is a hack */
+ tmp=scal_quant(e_ratio*Q15_ONE, e_ratio_quant_bounds, 4);
+ speex_bits_pack(bits, tmp, 2);
+}
+#endif /* #ifndef DISABLE_FLOAT_API */
+
+EXPORT void speex_encode_stereo_int(spx_int16_t *data, int frame_size, SpeexBits *bits)
+{
+ int i, tmp;
+ spx_word32_t e_left=0, e_right=0, e_tot=0;
+ spx_word32_t balance, e_ratio;
+ spx_word32_t largest, smallest;
+ int balance_id;
+#ifdef FIXED_POINT
+ int shift;
+#endif
+
+ /* In band marker */
+ speex_bits_pack(bits, 14, 5);
+ /* Stereo marker */
+ speex_bits_pack(bits, SPEEX_INBAND_STEREO, 4);
+
+ for (i=0;i<frame_size;i++)
+ {
+ e_left += SHR32(MULT16_16(data[2*i],data[2*i]),8);
+ e_right += SHR32(MULT16_16(data[2*i+1],data[2*i+1]),8);
+#ifdef FIXED_POINT
+ /* I think this is actually unbiased */
+ data[i] = SHR16(data[2*i],1)+PSHR16(data[2*i+1],1);
+#else
+ data[i] = .5*(((float)data[2*i])+data[2*i+1]);
+#endif
+ e_tot += SHR32(MULT16_16(data[i],data[i]),8);
+ }
+ if (e_left > e_right)
+ {
+ speex_bits_pack(bits, 0, 1);
+ largest = e_left;
+ smallest = e_right;
+ } else {
+ speex_bits_pack(bits, 1, 1);
+ largest = e_right;
+ smallest = e_left;
+ }
+
+ /* Balance quantization */
+#ifdef FIXED_POINT
+ shift = spx_ilog2(largest)-15;
+ largest = VSHR32(largest, shift-4);
+ smallest = VSHR32(smallest, shift);
+ balance = DIV32(largest, ADD32(smallest, 1));
+ if (balance > 32767)
+ balance = 32767;
+ balance_id = scal_quant(EXTRACT16(balance), balance_bounds, 32);
+#else
+ balance=(largest+1.)/(smallest+1.);
+ balance=4*log(balance);
+ balance_id=floor(.5+fabs(balance));
+ if (balance_id>30)
+ balance_id=31;
+#endif
+
+ speex_bits_pack(bits, balance_id, 5);
+
+ /* "coherence" quantisation */
+#ifdef FIXED_POINT
+ shift = spx_ilog2(e_tot);
+ e_tot = VSHR32(e_tot, shift-25);
+ e_left = VSHR32(e_left, shift-10);
+ e_right = VSHR32(e_right, shift-10);
+ e_ratio = DIV32(e_tot, e_left+e_right+1);
+#else
+ e_ratio = e_tot/(1.+e_left+e_right);
+#endif
+
+ tmp=scal_quant(EXTRACT16(e_ratio), e_ratio_quant_bounds, 4);
+ /*fprintf (stderr, "%d %d %d %d\n", largest, smallest, balance_id, e_ratio);*/
+ speex_bits_pack(bits, tmp, 2);
+}
+
+#ifndef DISABLE_FLOAT_API
+EXPORT void speex_decode_stereo(float *data, int frame_size, SpeexStereoState *_stereo)
+{
+ int i;
+ spx_word32_t balance;
+ spx_word16_t e_left, e_right, e_ratio;
+ RealSpeexStereoState *stereo = (RealSpeexStereoState*)_stereo;
+
+ COMPATIBILITY_HACK(stereo);
+
+ balance=stereo->balance;
+ e_ratio=stereo->e_ratio;
+
+ /* These two are Q14, with max value just below 2. */
+ e_right = DIV32(QCONST32(1., 22), spx_sqrt(MULT16_32_Q15(e_ratio, ADD32(QCONST32(1., 16), balance))));
+ e_left = SHR32(MULT16_16(spx_sqrt(balance), e_right), 8);
+
+ for (i=frame_size-1;i>=0;i--)
+ {
+ spx_word16_t tmp=data[i];
+ stereo->smooth_left = EXTRACT16(PSHR32(MAC16_16(MULT16_16(stereo->smooth_left, QCONST16(0.98, 15)), e_left, QCONST16(0.02, 15)), 15));
+ stereo->smooth_right = EXTRACT16(PSHR32(MAC16_16(MULT16_16(stereo->smooth_right, QCONST16(0.98, 15)), e_right, QCONST16(0.02, 15)), 15));
+ data[2*i] = (float)MULT16_16_P14(stereo->smooth_left, tmp);
+ data[2*i+1] = (float)MULT16_16_P14(stereo->smooth_right, tmp);
+ }
+}
+#endif /* #ifndef DISABLE_FLOAT_API */
+
+EXPORT void speex_decode_stereo_int(spx_int16_t *data, int frame_size, SpeexStereoState *_stereo)
+{
+ int i;
+ spx_word32_t balance;
+ spx_word16_t e_left, e_right, e_ratio;
+ RealSpeexStereoState *stereo = (RealSpeexStereoState*)_stereo;
+
+ COMPATIBILITY_HACK(stereo);
+
+ balance=stereo->balance;
+ e_ratio=stereo->e_ratio;
+
+ /* These two are Q14, with max value just below 2. */
+ e_right = DIV32(QCONST32(1., 22), spx_sqrt(MULT16_32_Q15(e_ratio, ADD32(QCONST32(1., 16), balance))));
+ e_left = SHR32(MULT16_16(spx_sqrt(balance), e_right), 8);
+
+ for (i=frame_size-1;i>=0;i--)
+ {
+ spx_int16_t tmp=data[i];
+ stereo->smooth_left = EXTRACT16(PSHR32(MAC16_16(MULT16_16(stereo->smooth_left, QCONST16(0.98, 15)), e_left, QCONST16(0.02, 15)), 15));
+ stereo->smooth_right = EXTRACT16(PSHR32(MAC16_16(MULT16_16(stereo->smooth_right, QCONST16(0.98, 15)), e_right, QCONST16(0.02, 15)), 15));
+ data[2*i] = (spx_int16_t)MULT16_16_P14(stereo->smooth_left, tmp);
+ data[2*i+1] = (spx_int16_t)MULT16_16_P14(stereo->smooth_right, tmp);
+ }
+}
+
+EXPORT int speex_std_stereo_request_handler(SpeexBits *bits, void *state, void *data)
+{
+ RealSpeexStereoState *stereo;
+ spx_word16_t sign=1, dexp;
+ int tmp;
+
+ stereo = (RealSpeexStereoState*)data;
+
+ COMPATIBILITY_HACK(stereo);
+
+ if (speex_bits_unpack_unsigned(bits, 1))
+ sign=-1;
+ dexp = speex_bits_unpack_unsigned(bits, 5);
+#ifndef FIXED_POINT
+ stereo->balance = exp(sign*.25*dexp);
+#else
+ stereo->balance = spx_exp(MULT16_16(sign, SHL16(dexp, 9)));
+#endif
+ tmp = speex_bits_unpack_unsigned(bits, 2);
+ stereo->e_ratio = e_ratio_quant[tmp];
+
+ return 0;
+}