* #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/a5/a5158b14bf18e4d3472907dc2db5525ab55a6b0b.svn-base b/jni/pjproject-android/.svn/pristine/a5/a5158b14bf18e4d3472907dc2db5525ab55a6b0b.svn-base
new file mode 100644
index 0000000..d408cbc
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/a5/a5158b14bf18e4d3472907dc2db5525ab55a6b0b.svn-base
@@ -0,0 +1,5 @@
+<resources>
+
+    <style name="AppTheme" parent="android:Theme.Holo.Light" />
+
+</resources>
\ No newline at end of file
diff --git a/jni/pjproject-android/.svn/pristine/a5/a5189f6a602209d568bd32b7b5fcee1efae57b99.svn-base b/jni/pjproject-android/.svn/pristine/a5/a5189f6a602209d568bd32b7b5fcee1efae57b99.svn-base
new file mode 100644
index 0000000..fb20485
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/a5/a5189f6a602209d568bd32b7b5fcee1efae57b99.svn-base
@@ -0,0 +1,478 @@
+/* $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 __PJMEDIA_RTCP_XR_H__
+#define __PJMEDIA_RTCP_XR_H__
+
+/**
+ * @file rtcp_xr.h
+ * @brief RTCP XR implementation.
+ */
+
+#include <pjmedia/types.h>
+#include <pj/math.h>
+
+
+PJ_BEGIN_DECL
+
+
+/**
+ * @defgroup PJMED_RTCP_XR RTCP Extended Report (XR) - RFC 3611
+ * @ingroup PJMEDIA_SESSION
+ * @brief RTCP XR extension to RTCP session
+ * @{
+ *
+ * PJMEDIA implements subsets of RTCP XR specification (RFC 3611) to monitor
+ * the quality of the real-time media (audio/video) transmission.
+ */
+
+/**
+ * Enumeration of report types of RTCP XR. Useful for user to enable varying
+ * combinations of RTCP XR report blocks.
+ */
+typedef enum {
+    PJMEDIA_RTCP_XR_LOSS_RLE	    = (1 << 0),
+    PJMEDIA_RTCP_XR_DUP_RLE	    = (1 << 1),
+    PJMEDIA_RTCP_XR_RCPT_TIMES	    = (1 << 2),
+    PJMEDIA_RTCP_XR_RR_TIME	    = (1 << 3),
+    PJMEDIA_RTCP_XR_DLRR	    = (1 << 4),
+    PJMEDIA_RTCP_XR_STATS	    = (1 << 5),
+    PJMEDIA_RTCP_XR_VOIP_METRICS    = (1 << 6)
+} pjmedia_rtcp_xr_type;
+
+/**
+ * Enumeration of info need to be updated manually to RTCP XR. Most info
+ * could be updated automatically each time RTP received.
+ */
+typedef enum {
+    PJMEDIA_RTCP_XR_INFO_SIGNAL_LVL = 1,
+    PJMEDIA_RTCP_XR_INFO_NOISE_LVL  = 2,
+    PJMEDIA_RTCP_XR_INFO_RERL	    = 3,
+    PJMEDIA_RTCP_XR_INFO_R_FACTOR   = 4,
+    PJMEDIA_RTCP_XR_INFO_MOS_LQ	    = 5,
+    PJMEDIA_RTCP_XR_INFO_MOS_CQ	    = 6,
+    PJMEDIA_RTCP_XR_INFO_CONF_PLC   = 7,
+    PJMEDIA_RTCP_XR_INFO_CONF_JBA   = 8,
+    PJMEDIA_RTCP_XR_INFO_CONF_JBR   = 9,
+    PJMEDIA_RTCP_XR_INFO_JB_NOM	    = 10,
+    PJMEDIA_RTCP_XR_INFO_JB_MAX	    = 11,
+    PJMEDIA_RTCP_XR_INFO_JB_ABS_MAX = 12
+} pjmedia_rtcp_xr_info;
+
+/**
+ * Enumeration of PLC types definitions for RTCP XR report.
+ */
+typedef enum {
+    PJMEDIA_RTCP_XR_PLC_UNK	    = 0,
+    PJMEDIA_RTCP_XR_PLC_DIS	    = 1,
+    PJMEDIA_RTCP_XR_PLC_ENH	    = 2,
+    PJMEDIA_RTCP_XR_PLC_STD	    = 3
+} pjmedia_rtcp_xr_plc_type;
+
+/**
+ * Enumeration of jitter buffer types definitions for RTCP XR report.
+ */
+typedef enum {
+    PJMEDIA_RTCP_XR_JB_UNKNOWN      = 0,
+    PJMEDIA_RTCP_XR_JB_FIXED        = 2,
+    PJMEDIA_RTCP_XR_JB_ADAPTIVE     = 3
+} pjmedia_rtcp_xr_jb_type;
+
+
+#pragma pack(1)
+
+/**
+ * This type declares RTCP XR Report Header.
+ */
+typedef struct pjmedia_rtcp_xr_rb_header
+{
+    pj_uint8_t		 bt;		/**< Block type.		*/
+    pj_uint8_t		 specific;	/**< Block specific data.	*/
+    pj_uint16_t		 length;	/**< Block length.		*/
+} pjmedia_rtcp_xr_rb_header;
+
+/**
+ * This type declares RTCP XR Receiver Reference Time Report Block.
+ */
+typedef struct pjmedia_rtcp_xr_rb_rr_time
+{
+    pjmedia_rtcp_xr_rb_header header;	/**< Block header.		*/
+    pj_uint32_t		 ntp_sec;	/**< NTP time, seconds part.	*/
+    pj_uint32_t		 ntp_frac;	/**< NTP time, fractions part.	*/
+} pjmedia_rtcp_xr_rb_rr_time;
+
+
+/**
+ * This type declares RTCP XR DLRR Report Sub-block
+ */
+typedef struct pjmedia_rtcp_xr_rb_dlrr_item
+{
+    pj_uint32_t		 ssrc;		/**< receiver SSRC		*/
+    pj_uint32_t		 lrr;		/**< last receiver report	*/
+    pj_uint32_t		 dlrr;		/**< delay since last receiver
+					     report			*/
+} pjmedia_rtcp_xr_rb_dlrr_item;
+
+/**
+ * This type declares RTCP XR DLRR Report Block
+ */
+typedef struct pjmedia_rtcp_xr_rb_dlrr
+{
+    pjmedia_rtcp_xr_rb_header header;	/**< Block header.		*/
+    pjmedia_rtcp_xr_rb_dlrr_item item;	/**< Block contents, 
+					     variable length list	*/
+} pjmedia_rtcp_xr_rb_dlrr;
+
+/**
+ * This type declares RTCP XR Statistics Summary Report Block
+ */
+typedef struct pjmedia_rtcp_xr_rb_stats
+{
+    pjmedia_rtcp_xr_rb_header header;	/**< Block header.		     */
+    pj_uint32_t		 ssrc;		/**< Receiver SSRC		     */
+    pj_uint16_t		 begin_seq;	/**< Begin RTP sequence reported     */
+    pj_uint16_t		 end_seq;	/**< End RTP sequence reported       */
+    pj_uint32_t		 lost;		/**< Number of packet lost in this 
+					     interval  */
+    pj_uint32_t		 dup;		/**< Number of duplicated packet in 
+					     this interval */
+    pj_uint32_t		 jitter_min;	/**< Minimum jitter in this interval */
+    pj_uint32_t		 jitter_max;	/**< Maximum jitter in this interval */
+    pj_uint32_t		 jitter_mean;	/**< Average jitter in this interval */
+    pj_uint32_t		 jitter_dev;	/**< Jitter deviation in this 
+					     interval */
+    pj_uint32_t		 toh_min:8;	/**< Minimum ToH in this interval    */
+    pj_uint32_t		 toh_max:8;	/**< Maximum ToH in this interval    */
+    pj_uint32_t		 toh_mean:8;	/**< Average ToH in this interval    */
+    pj_uint32_t		 toh_dev:8;	/**< ToH deviation in this interval  */
+} pjmedia_rtcp_xr_rb_stats;
+
+/**
+ * This type declares RTCP XR VoIP Metrics Report Block
+ */
+typedef struct pjmedia_rtcp_xr_rb_voip_mtc
+{
+    pjmedia_rtcp_xr_rb_header header;	/**< Block header.		*/
+    pj_uint32_t		 ssrc;		/**< Receiver SSRC		*/
+    pj_uint8_t		 loss_rate;	/**< Packet loss rate		*/
+    pj_uint8_t		 discard_rate;	/**< Packet discarded rate	*/
+    pj_uint8_t		 burst_den;	/**< Burst density		*/
+    pj_uint8_t		 gap_den;	/**< Gap density		*/
+    pj_uint16_t		 burst_dur;	/**< Burst duration		*/
+    pj_uint16_t		 gap_dur;	/**< Gap duration		*/
+    pj_uint16_t		 rnd_trip_delay;/**< Round trip delay		*/
+    pj_uint16_t		 end_sys_delay; /**< End system delay		*/
+    pj_uint8_t		 signal_lvl;	/**< Signal level		*/
+    pj_uint8_t		 noise_lvl;	/**< Noise level		*/
+    pj_uint8_t		 rerl;		/**< Residual Echo Return Loss	*/
+    pj_uint8_t		 gmin;		/**< The gap threshold		*/
+    pj_uint8_t		 r_factor;	/**< Voice quality metric carried
+					     over this RTP session	*/
+    pj_uint8_t		 ext_r_factor;  /**< Voice quality metric carried 
+					     outside of this RTP session*/
+    pj_uint8_t		 mos_lq;	/**< Mean Opinion Score for 
+					     Listening Quality          */
+    pj_uint8_t		 mos_cq;	/**< Mean Opinion Score for 
+					     Conversation Quality       */
+    pj_uint8_t		 rx_config;	/**< Receiver configuration	*/
+    pj_uint8_t		 reserved2;	/**< Not used			*/
+    pj_uint16_t		 jb_nom;	/**< Current delay by jitter
+					     buffer			*/
+    pj_uint16_t		 jb_max;	/**< Maximum delay by jitter
+					     buffer			*/
+    pj_uint16_t		 jb_abs_max;	/**< Maximum possible delay by
+					     jitter buffer		*/
+} pjmedia_rtcp_xr_rb_voip_mtc;
+
+
+/**
+ * Constant of RTCP-XR content size.
+ */
+#define PJMEDIA_RTCP_XR_BUF_SIZE \
+    sizeof(pjmedia_rtcp_xr_rb_rr_time) + \
+    sizeof(pjmedia_rtcp_xr_rb_dlrr) + \
+    sizeof(pjmedia_rtcp_xr_rb_stats) + \
+    sizeof(pjmedia_rtcp_xr_rb_voip_mtc)
+
+
+/**
+ * This structure declares RTCP XR (Extended Report) packet.
+ */
+typedef struct pjmedia_rtcp_xr_pkt
+{
+    struct {
+#if defined(PJ_IS_BIG_ENDIAN) && PJ_IS_BIG_ENDIAN!=0
+	unsigned	 version:2;	/**< packet type            */
+	unsigned	 p:1;		/**< padding flag           */
+	unsigned	 count:5;	/**< varies by payload type */
+	unsigned	 pt:8;		/**< payload type           */
+#else
+	unsigned	 count:5;	/**< varies by payload type */
+	unsigned	 p:1;		/**< padding flag           */
+	unsigned	 version:2;	/**< packet type            */
+	unsigned	 pt:8;		/**< payload type           */
+#endif
+	unsigned	 length:16;	/**< packet length          */
+	pj_uint32_t	 ssrc;		/**< SSRC identification    */
+    } common;
+
+    pj_int8_t		 buf[PJMEDIA_RTCP_XR_BUF_SIZE];
+					/**< Content buffer   */
+} pjmedia_rtcp_xr_pkt;
+
+#pragma pack()
+
+
+/**
+ * This structure describes RTCP XR statitic.
+ */
+typedef struct pjmedia_rtcp_xr_stream_stat
+{
+    struct {
+	pj_time_val	    update;	/**< Time of last update.	    */
+
+	pj_uint32_t	    begin_seq;	/**< Begin # seq of this interval.  */
+	pj_uint32_t	    end_seq;	/**< End # seq of this interval.    */
+	unsigned	    count;	/**< Number of packets.		    */
+
+	/**
+	 * Flags represent whether the such report is valid/updated
+	 */
+	unsigned	    l:1;	/**< Lost flag			    */
+	unsigned	    d:1;	/**< Duplicated flag		    */
+	unsigned	    j:1;	/**< Jitter flag		    */
+	unsigned	    t:2;	/**< TTL or Hop Limit, 
+					     0=none, 1=TTL, 2=HL	    */
+
+	unsigned	    lost;	/**< Number of packets lost	    */
+	unsigned	    dup;	/**< Number of duplicated packets   */
+	pj_math_stat	    jitter;	/**< Jitter statistics (in usec)    */
+	pj_math_stat	    toh;	/**< TTL of hop limit statistics.   */
+    } stat_sum;
+
+    struct {
+	pj_time_val	    update;	    /**< Time of last update.	    */
+
+	pj_uint8_t	    loss_rate;	    /**< Packet loss rate	    */
+	pj_uint8_t	    discard_rate;   /**< Packet discarded rate	    */
+	pj_uint8_t	    burst_den;	    /**< Burst density		    */
+	pj_uint8_t	    gap_den;	    /**< Gap density		    */
+	pj_uint16_t	    burst_dur;	    /**< Burst duration		    */
+	pj_uint16_t	    gap_dur;	    /**< Gap duration		    */
+	pj_uint16_t	    rnd_trip_delay; /**< Round trip delay	    */
+	pj_uint16_t	    end_sys_delay;  /**< End system delay	    */
+	pj_int8_t	    signal_lvl;	    /**< Signal level		    */
+	pj_int8_t	    noise_lvl;	    /**< Noise level		    */
+	pj_uint8_t	    rerl;	    /**< Residual Echo Return Loss  */
+	pj_uint8_t	    gmin;	    /**< The gap threshold	    */
+	pj_uint8_t	    r_factor;	    /**< Voice quality metric carried
+						 over this RTP session	    */
+	pj_uint8_t	    ext_r_factor;   /**< Voice quality metric carried 
+						 outside of this RTP session*/
+	pj_uint8_t	    mos_lq;	    /**< Mean Opinion Score for 
+						 Listening Quality          */
+	pj_uint8_t	    mos_cq;	    /**< Mean Opinion Score for 
+						 Conversation Quality       */
+	pj_uint8_t	    rx_config;	    /**< Receiver configuration	    */
+	pj_uint16_t	    jb_nom;	    /**< Current delay by jitter
+						 buffer			    */
+	pj_uint16_t	    jb_max;	    /**< Maximum delay by jitter
+						 buffer			    */
+	pj_uint16_t	    jb_abs_max;	    /**< Maximum possible delay by
+						 jitter buffer		    */
+    } voip_mtc;
+
+} pjmedia_rtcp_xr_stream_stat;
+
+typedef struct pjmedia_rtcp_xr_stat
+{
+    pjmedia_rtcp_xr_stream_stat	 rx;  /**< Decoding direction statistics.   */
+    pjmedia_rtcp_xr_stream_stat	 tx;  /**< Encoding direction statistics.   */
+    pj_math_stat		 rtt; /**< Round-trip delay stat (in usec) 
+					   the value is calculated from 
+					   receiver side.		    */
+} pjmedia_rtcp_xr_stat;
+
+/**
+ * Forward declaration of RTCP session
+ */
+struct pjmedia_rtcp_session;
+
+/**
+ * RTCP session is used to monitor the RTP session of one endpoint. There
+ * should only be one RTCP session for a bidirectional RTP streams.
+ */
+struct pjmedia_rtcp_xr_session
+{
+    char		   *name;	/**< Name identification.	    */
+    pjmedia_rtcp_xr_pkt	    pkt;	/**< Cached RTCP XR packet.	    */
+
+    pj_uint32_t		    rx_lrr;	/**< NTP ts in last RR received.    */
+    pj_timestamp	    rx_lrr_time;/**< Time when last RR is received. */
+    pj_uint32_t		    rx_last_rr; /**< # pkt received since last 
+				             sending RR time.		    */
+
+    pjmedia_rtcp_xr_stat    stat;	/**< RTCP XR statistics.	    */
+
+    /* The reference sequence number is an extended sequence number
+     * that serves as the basis for determining whether a new 16 bit
+     * sequence number comes earlier or later in the 32 bit sequence
+     * space.
+     */
+    pj_uint32_t		    src_ref_seq;
+    pj_bool_t		    uninitialized_src_ref_seq;
+
+    /* This structure contains variables needed for calculating 
+     * burst metrics.
+     */
+    struct {
+	pj_uint32_t	    pkt;
+	pj_uint32_t	    lost;
+	pj_uint32_t	    loss_count;
+	pj_uint32_t	    discard_count;
+	pj_uint32_t	    c11;
+	pj_uint32_t	    c13;
+	pj_uint32_t	    c14;
+	pj_uint32_t	    c22;
+	pj_uint32_t	    c23;
+	pj_uint32_t	    c33;
+    } voip_mtc_stat;
+
+    unsigned ptime;			/**< Packet time.		    */
+    unsigned frames_per_packet;		/**< # frames per packet.	    */
+
+    struct pjmedia_rtcp_session *rtcp_session;
+					/**< Parent/RTCP session.	    */
+};
+
+typedef struct pjmedia_rtcp_xr_session pjmedia_rtcp_xr_session;
+
+/**
+ * Build an RTCP XR packet which contains one or more RTCP XR report blocks.
+ * There are seven report types as defined in RFC 3611.
+ *
+ * @param session   The RTCP XR session.
+ * @param rpt_types Report types to be included in the packet, report types
+ *		    are defined in pjmedia_rtcp_xr_type, set this to zero
+ *		    will make this function build all reports appropriately.
+ * @param rtcp_pkt  Upon return, it will contain pointer to the RTCP XR packet.
+ * @param len	    Upon return, it will indicate the size of the generated 
+ *		    RTCP XR packet.
+ */
+PJ_DECL(void) pjmedia_rtcp_build_rtcp_xr( pjmedia_rtcp_xr_session *session,
+					  unsigned rpt_types,
+					  void **rtcp_pkt, int *len);
+
+/**
+ * Call this function to manually update some info needed by RTCP XR to 
+ * generate report which could not be populated directly when receiving
+ * RTP.
+ *
+ * @param session   The RTCP XR session.
+ * @param info	    Info type to be updated, @see pjmedia_rtcp_xr_info.
+ * @param val	    Value.
+ */
+PJ_DECL(pj_status_t) pjmedia_rtcp_xr_update_info(
+					  pjmedia_rtcp_xr_session *session,
+					  unsigned info,
+					  pj_int32_t val);
+
+/*
+ * Private APIs:
+ */
+
+/**
+ * This function is called internally by RTCP session when RTCP XR is enabled
+ * to initialize the RTCP XR session.
+ *
+ * @param session   RTCP XR session.
+ * @param r_session RTCP session.
+ * @param gmin      Gmin value (defined in RFC 3611), set to 0 for default (16).
+ * @param frames_per_packet
+		    Number of frames per packet.
+ */
+void pjmedia_rtcp_xr_init( pjmedia_rtcp_xr_session *session, 
+			   struct pjmedia_rtcp_session *r_session,
+			   pj_uint8_t gmin,
+			   unsigned frames_per_packet);
+
+/**
+ * This function is called internally by RTCP session to destroy 
+ * the RTCP XR session.
+ *
+ * @param session   RTCP XR session.
+ */
+void pjmedia_rtcp_xr_fini( pjmedia_rtcp_xr_session *session );
+
+/**
+ * This function is called internally by RTCP session when it receives 
+ * incoming RTCP XR packets.
+ *
+ * @param session   RTCP XR session.
+ * @param rtcp_pkt  The received RTCP XR packet.
+ * @param size	    Size of the incoming packet.
+ */
+void pjmedia_rtcp_xr_rx_rtcp_xr( pjmedia_rtcp_xr_session *session,
+				 const void *rtcp_pkt,
+				 pj_size_t size);
+
+/**
+ * This function is called internally by RTCP session whenever an RTP packet
+ * is received or lost to let the RTCP XR session update its statistics.
+ * Data passed to this function is a result of analyzation by RTCP and the
+ * jitter buffer. Whenever some info is available, the value should be zero
+ * or more (no negative info), otherwise if info is not available the info
+ * should be -1 so no update will be done for this info in the RTCP XR session.
+ *
+ * @param session   RTCP XR session.
+ * @param seq	    Sequence number of RTP packet.
+ * @param lost	    Info if this packet is lost. 
+ * @param dup	    Info if this packet is a duplication. 
+ * @param discarded Info if this packet is discarded 
+ *		    (not because of duplication).
+ * @param jitter    Info jitter of this packet.
+ * @param toh	    Info Time To Live or Hops Limit of this packet.
+ * @param toh_ipv4  Set PJ_TRUE if packet is transported over IPv4.
+ */
+void pjmedia_rtcp_xr_rx_rtp( pjmedia_rtcp_xr_session *session,
+			     unsigned seq, 
+			     int lost,
+			     int dup,
+			     int discarded,
+			     int jitter,
+			     int toh, pj_bool_t toh_ipv4);
+
+/**
+ * This function is called internally by RTCP session whenever an RTP 
+ * packet is sent to let the RTCP XR session do its internal calculations.
+ *
+ * @param session   RTCP XR session.
+ * @param ptsize    Size of RTP payload being sent.
+ */
+void pjmedia_rtcp_xr_tx_rtp( pjmedia_rtcp_xr_session *session, 
+			     unsigned ptsize );
+
+/**
+ * @}
+ */
+
+PJ_END_DECL
+
+
+#endif	/* __PJMEDIA_RTCP_XR_H__ */
diff --git a/jni/pjproject-android/.svn/pristine/a5/a576bb1b1aa13ff40aa08aad72d008987d2c9ffe.svn-base b/jni/pjproject-android/.svn/pristine/a5/a576bb1b1aa13ff40aa08aad72d008987d2c9ffe.svn-base
new file mode 100644
index 0000000..a8b1d10
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/a5/a576bb1b1aa13ff40aa08aad72d008987d2c9ffe.svn-base
@@ -0,0 +1,30 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+# Offer contains "inactive" attribute in the session, however the media
+# also has "sendonly" attribute. Answer should appropriately respond
+# direction attribute in media, instead of the one in session.
+sdp = \
+"""
+v=0
+o=- 0 0 IN IP4 127.0.0.1
+s=-
+c=IN IP4 127.0.0.1
+t=0 0
+a=inactive
+m=audio 5000 RTP/AVP 0
+a=sendonly
+"""
+
+pjsua_args = "--null-audio --auto-answer 200"
+extra_headers = ""
+include = ["Content-Type: application/sdp",	# response must include SDP
+	       "a=recvonly"
+	   ]
+exclude = []
+
+sendto_cfg = sip.SendtoCfg("SDP direction in session", pjsua_args, sdp, 200,
+			   extra_headers=extra_headers,
+			   resp_inc=include, resp_exc=exclude) 
+
diff --git a/jni/pjproject-android/.svn/pristine/a5/a5bd1682f261afdb5ee277f0da459a741de4a29f.svn-base b/jni/pjproject-android/.svn/pristine/a5/a5bd1682f261afdb5ee277f0da459a741de4a29f.svn-base
new file mode 100644
index 0000000..e874d56
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/a5/a5bd1682f261afdb5ee277f0da459a741de4a29f.svn-base
@@ -0,0 +1,269 @@
+/* $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-audiodev/audiotest.h>
+#include <pjmedia-audiodev/audiodev.h>
+#include <pjlib.h>
+#include <pjlib-util.h>
+ 
+#define THIS_FILE	    "audiotest.c"
+
+/* Test duration in msec */
+#define DURATION	    10000
+
+/* Skip the first msec from the calculation */
+#define SKIP_DURATION	    1000
+
+/* Division helper */
+#define DIV_ROUND_UP(a,b) (((a) + ((b) - 1)) / (b))
+#define DIV_ROUND(a,b) (((a) + ((b)/2 - 1)) / (b))
+
+struct stream_data
+{
+    pj_uint32_t	    first_timestamp;
+    pj_uint32_t	    last_timestamp;
+    pj_timestamp    last_called;
+    pj_math_stat    delay;
+};
+
+struct test_data 
+{
+    pj_pool_t			   *pool;
+    const pjmedia_aud_param	   *param;
+    pjmedia_aud_test_results	   *result;
+    pj_bool_t			    running;
+    pj_bool_t			    has_error;
+    pj_mutex_t			   *mutex;
+
+    struct stream_data		    capture_data;
+    struct stream_data		    playback_data;
+};
+
+static pj_status_t play_cb(void *user_data, pjmedia_frame *frame)
+{
+    struct test_data *test_data = (struct test_data *)user_data;
+    struct stream_data *strm_data = &test_data->playback_data;
+
+    pj_mutex_lock(test_data->mutex);
+
+    /* Skip frames when test is not started or test has finished */
+    if (!test_data->running) {
+	pj_bzero(frame->buf, frame->size);
+	pj_mutex_unlock(test_data->mutex);
+	return PJ_SUCCESS;
+    }
+
+    /* Save last timestamp seen (to calculate drift) */
+    strm_data->last_timestamp = frame->timestamp.u32.lo;
+
+    if (strm_data->last_called.u64 == 0) {
+	/* Init vars. */
+	pj_get_timestamp(&strm_data->last_called);
+	pj_math_stat_init(&strm_data->delay);
+	strm_data->first_timestamp = frame->timestamp.u32.lo;
+    } else {
+	pj_timestamp now;
+	unsigned delay;
+
+	/* Calculate frame interval */
+	pj_get_timestamp(&now);
+	delay = pj_elapsed_usec(&strm_data->last_called, &now);
+	strm_data->last_called = now;
+
+	/* Update frame interval statistic */
+	pj_math_stat_update(&strm_data->delay, delay);
+    }
+
+    pj_bzero(frame->buf, frame->size);
+
+    pj_mutex_unlock(test_data->mutex);
+
+    return PJ_SUCCESS;
+}
+
+static pj_status_t rec_cb(void *user_data, pjmedia_frame *frame)
+{
+    struct test_data *test_data = (struct test_data*)user_data;
+    struct stream_data *strm_data = &test_data->capture_data;
+
+    pj_mutex_lock(test_data->mutex);
+
+    /* Skip frames when test is not started or test has finished */
+    if (!test_data->running) {
+	pj_mutex_unlock(test_data->mutex);
+	return PJ_SUCCESS;
+    }
+
+    /* Save last timestamp seen (to calculate drift) */
+    strm_data->last_timestamp = frame->timestamp.u32.lo;
+
+    if (strm_data->last_called.u64 == 0) {
+	/* Init vars. */
+	pj_get_timestamp(&strm_data->last_called);
+	pj_math_stat_init(&strm_data->delay);
+	strm_data->first_timestamp = frame->timestamp.u32.lo;
+    } else {
+	pj_timestamp now;
+	unsigned delay;
+
+	/* Calculate frame interval */
+	pj_get_timestamp(&now);
+	delay = pj_elapsed_usec(&strm_data->last_called, &now);
+	strm_data->last_called = now;
+
+	/* Update frame interval statistic */
+	pj_math_stat_update(&strm_data->delay, delay);
+    }
+
+    pj_mutex_unlock(test_data->mutex);
+    return PJ_SUCCESS;
+}
+
+static void app_perror(const char *title, pj_status_t status)
+{
+    char errmsg[PJ_ERR_MSG_SIZE];
+
+    pj_strerror(status, errmsg, sizeof(errmsg));	
+    printf( "%s: %s (err=%d)\n",
+	    title, errmsg, status);
+}
+
+
+PJ_DEF(pj_status_t) pjmedia_aud_test( const pjmedia_aud_param *param,
+				      pjmedia_aud_test_results *result)
+{
+    pj_status_t status = PJ_SUCCESS;
+    pjmedia_aud_stream *strm;
+    struct test_data test_data;
+    unsigned ptime, tmp;
+    
+    /*
+     * Init test parameters
+     */
+    pj_bzero(&test_data, sizeof(test_data));
+    test_data.param = param;
+    test_data.result = result;
+
+    test_data.pool = pj_pool_create(pjmedia_aud_subsys_get_pool_factory(),
+				    "audtest", 1000, 1000, NULL);
+    pj_mutex_create_simple(test_data.pool, "sndtest", &test_data.mutex); 
+
+    /*
+     * Open device.
+     */
+    status = pjmedia_aud_stream_create(test_data.param, &rec_cb, &play_cb, 
+				       &test_data, &strm);
+    if (status != PJ_SUCCESS) {
+        app_perror("Unable to open device", status);
+	pj_pool_release(test_data.pool);
+        return status;
+    }
+
+
+    /* Sleep for a while to let sound device "settles" */
+    pj_thread_sleep(200);
+
+    /*
+     * Start the stream.
+     */
+    status = pjmedia_aud_stream_start(strm);
+    if (status != PJ_SUCCESS) {
+        app_perror("Unable to start capture stream", status);
+	pjmedia_aud_stream_destroy(strm);
+	pj_pool_release(test_data.pool);
+        return status;
+    }
+
+    PJ_LOG(3,(THIS_FILE,
+	      " Please wait while test is in progress (~%d secs)..",
+	      (DURATION+SKIP_DURATION)/1000));
+
+    /* Let the stream runs for few msec/sec to get stable result.
+     * (capture normally begins with frames available simultaneously).
+     */
+    pj_thread_sleep(SKIP_DURATION);
+
+
+    /* Begin gather data */
+    test_data.running = 1;
+
+    /* 
+     * Let the test runs for a while.
+     */
+    pj_thread_sleep(DURATION);
+
+
+    /*
+     * Close stream.
+     */
+    test_data.running = 0;
+    pjmedia_aud_stream_destroy(strm);
+    pj_pool_release(test_data.pool);
+
+
+    /* 
+     * Gather results
+     */
+    ptime = param->samples_per_frame * 1000 / param->clock_rate;
+
+    tmp = pj_math_stat_get_stddev(&test_data.capture_data.delay);
+    result->rec.frame_cnt = test_data.capture_data.delay.n;
+    result->rec.min_interval = DIV_ROUND(test_data.capture_data.delay.min, 1000);
+    result->rec.max_interval = DIV_ROUND(test_data.capture_data.delay.max, 1000);
+    result->rec.avg_interval = DIV_ROUND(test_data.capture_data.delay.mean, 1000);
+    result->rec.dev_interval = DIV_ROUND(tmp, 1000);
+    result->rec.max_burst    = DIV_ROUND_UP(result->rec.max_interval, ptime);
+
+    tmp = pj_math_stat_get_stddev(&test_data.playback_data.delay);
+    result->play.frame_cnt = test_data.playback_data.delay.n;
+    result->play.min_interval = DIV_ROUND(test_data.playback_data.delay.min, 1000);
+    result->play.max_interval = DIV_ROUND(test_data.playback_data.delay.max, 1000);
+    result->play.avg_interval = DIV_ROUND(test_data.playback_data.delay.mean, 1000);
+    result->play.dev_interval = DIV_ROUND(tmp, 1000);
+    result->play.max_burst    = DIV_ROUND_UP(result->play.max_interval, ptime);
+
+    /* Check drifting */
+    if (param->dir == PJMEDIA_DIR_CAPTURE_PLAYBACK) {
+	int play_diff, cap_diff, drift;
+
+	play_diff = test_data.playback_data.last_timestamp -
+		    test_data.playback_data.first_timestamp;
+	cap_diff  = test_data.capture_data.last_timestamp -
+		    test_data.capture_data.first_timestamp;
+	drift = play_diff > cap_diff? play_diff - cap_diff :
+		cap_diff - play_diff;
+
+	/* Allow one frame tolerance for clock drift detection */
+	if (drift < (int)param->samples_per_frame) {
+	    result->rec_drift_per_sec = 0;
+	} else {
+	    unsigned msec_dur;
+
+	    msec_dur = (test_data.capture_data.last_timestamp - 
+		       test_data.capture_data.first_timestamp) * 1000 /
+		       test_data.param->clock_rate;
+
+	    result->rec_drift_per_sec = drift * 1000 / msec_dur;
+
+	}
+    }
+
+    return test_data.has_error? PJ_EUNKNOWN : PJ_SUCCESS;
+}
+
diff --git a/jni/pjproject-android/.svn/pristine/a5/a5e62be71b41902b783d124c2233aa13182cb4a6.svn-base b/jni/pjproject-android/.svn/pristine/a5/a5e62be71b41902b783d124c2233aa13182cb4a6.svn-base
new file mode 100644
index 0000000..6f94c93
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/a5/a5e62be71b41902b783d124c2233aa13182cb4a6.svn-base
@@ -0,0 +1,32 @@
+
+                       vidgui
+                       
+This directory contains a Qt based video GUI sample. 
+
+Requirements:
+========================
+  - pjsip built with video support
+  - Qt SDK version 4.5 or above (version <4.5 doesn't have Cocoa support)
+
+Build instructions:
+===================
+  - Build pjsip first
+  - Follow the instructions for the appropriate platform below:
+
+    Visual Studio
+    -------------
+      - Run this to generate Visual Studio project file:
+         c:> qmake -tp vc
+      - Open vidgui.vcproj and build the app
+
+
+    Mac OS X
+    --------
+      $ qmake -spec macx-g++
+      $ make
+
+    Linux 
+    -----
+      $ qmake
+      $ make
+
diff --git a/jni/pjproject-android/.svn/pristine/a5/a5f0b235cd646bacdc88eb5a5e4d5dff12e122d0.svn-base b/jni/pjproject-android/.svn/pristine/a5/a5f0b235cd646bacdc88eb5a5e4d5dff12e122d0.svn-base
new file mode 100644
index 0000000..32b0b50
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/a5/a5f0b235cd646bacdc88eb5a5e4d5dff12e122d0.svn-base
@@ -0,0 +1,145 @@
+# By default, the test application includes main.o.
+# OS make file may override this with os-specific files
+export PJNATH_TEST_OBJS = main.o
+
+include ../../build.mak
+include ../../version.mak
+include $(PJDIR)/build/common.mak
+
+RULES_MAK := $(PJDIR)/build/rules.mak
+
+PJLIB_LIB:=../../pjlib/lib/libpj-$(TARGET_NAME)$(LIBEXT)
+PJLIB_UTIL_LIB:=../../pjlib-util/lib/libpjlib-util-$(TARGET_NAME)$(LIBEXT)
+export PJNATH_LIB:=../lib/libpjnath-$(TARGET_NAME)$(LIBEXT)
+
+###############################################################################
+# Gather all flags.
+#
+export _CFLAGS 	:= $(CC_CFLAGS) $(OS_CFLAGS) $(HOST_CFLAGS) $(M_CFLAGS) \
+		   $(CFLAGS) $(CC_INC)../include $(CC_INC)../../pjlib/include \
+		   $(CC_INC)../../pjlib-util/include
+export _CXXFLAGS:= $(_CFLAGS) $(CC_CXXFLAGS) $(OS_CXXFLAGS) $(M_CXXFLAGS) \
+		   $(HOST_CXXFLAGS) $(CXXFLAGS)
+export _LDFLAGS := $(subst /,$(HOST_PSEP),$(PJNATH_LIB)) \
+		   $(subst /,$(HOST_PSEP),$(PJLIB_UTIL_LIB)) \
+		   $(subst /,$(HOST_PSEP),$(PJLIB_LIB)) \
+		   $(CC_LDFLAGS) $(OS_LDFLAGS) $(M_LDFLAGS) $(HOST_LDFLAGS) \
+		   $(LDFLAGS) 
+
+###############################################################################
+# Defines for building PJNATH library
+#
+export PJNATH_SRCDIR = ../src/pjnath
+export PJNATH_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
+		errno.o ice_session.o ice_strans.o nat_detect.o stun_auth.o \
+		stun_msg.o stun_msg_dump.o stun_session.o stun_sock.o \
+		stun_transaction.o turn_session.o turn_sock.o
+export PJNATH_CFLAGS += $(_CFLAGS)
+
+###############################################################################
+# Defines for building test application
+#
+export PJNATH_TEST_SRCDIR = ../src/pjnath-test
+export PJNATH_TEST_OBJS += ice_test.o stun.o sess_auth.o server.o concur_test.o \
+			    stun_sock_test.o turn_sock_test.o test.o
+export PJNATH_TEST_CFLAGS += $(_CFLAGS)
+export PJNATH_TEST_LDFLAGS += $(_LDFLAGS)
+export PJNATH_TEST_EXE:=../bin/pjnath-test-$(TARGET_NAME)$(HOST_EXE)
+
+	
+###############################################################################
+# Defines for building TURN client application
+#
+export PJTURN_CLIENT_SRCDIR = ../src/pjturn-client
+export PJTURN_CLIENT_OBJS += client_main.o
+export PJTURN_CLIENT_CFLAGS += $(_CFLAGS)
+export PJTURN_CLIENT_LDFLAGS += $(_LDFLAGS)
+export PJTURN_CLIENT_EXE:=../bin/pjturn-client-$(TARGET_NAME)$(HOST_EXE)
+
+###############################################################################
+# Defines for building TURN server application
+#
+export PJTURN_SRV_SRCDIR = ../src/pjturn-srv
+export PJTURN_SRV_OBJS += allocation.o auth.o listener_udp.o \
+			  listener_tcp.o server.o main.o
+export PJTURN_SRV_CFLAGS += $(_CFLAGS)
+export PJTURN_SRV_LDFLAGS += $(_LDFLAGS)
+export PJTURN_SRV_EXE:=../bin/pjturn-srv-$(TARGET_NAME)$(HOST_EXE)
+
+	
+	
+export CC_OUT CC AR RANLIB HOST_MV HOST_RM HOST_RMDIR HOST_MKDIR OBJEXT LD LDOUT 
+###############################################################################
+# Main entry
+#
+# $(TARGET) is defined in os-$(OS_NAME).mak file in current directory.
+#
+TARGETS := pjnath pjnath-test pjturn-client pjturn-srv
+
+all: $(TARGETS)
+
+doc:
+	cd .. && rm -rf docs/$(PJ_VERSION) && doxygen docs/doxygen.cfg
+	@if [ -n "$(WWWDIR)" ] && ! [ -d "$(WWWDIR)/docs/$(PJ_VERSION)/pjnath/docs/html" ] ; then \
+		echo "Creating docs/$(PJ_VERSION)/pjnath/docs/html" ; \
+		mkdir -p $(WWWDIR)/docs/$(PJ_VERSION)/pjnath/docs/html ; \
+	fi 
+	@if [ -n "$(WWWDIR)" ] && [ -d "$(WWWDIR)/docs/$(PJ_VERSION)/pjnath/docs/html" ] ; then \
+		echo "Copying docs/$(PJ_VERSION) to $(WWWDIR)/docs/$(PJ_VERSION)/pjnath/docs/html.." ; \
+		cp -v -a ../docs/$(PJ_VERSION)/html/* $(WWWDIR)/docs/$(PJ_VERSION)/pjnath/docs/html/ ; \
+	fi
+
+dep: depend
+distclean: realclean
+
+.PHONY: dep depend pjlib pjlib-test clean realclean distclean
+
+pjnath:
+	$(MAKE) -f $(RULES_MAK) APP=PJNATH app=pjnath $(PJNATH_LIB)
+
+$$(PJNATH_LIB): pjnath
+
+pjnath-test: $(PJLIB_LIB) $(PJLIB_UTIL_LIB) $(PJNATH_LIB)
+	$(MAKE) -f $(RULES_MAK) APP=PJNATH_TEST app=pjnath-test $(PJNATH_TEST_EXE)
+
+pjturn-client: $(PJLIB_LIB) $(PJLIB_UTIL_LIB) $(PJNATH_LIB)
+	$(MAKE) -f $(RULES_MAK) APP=PJTURN_CLIENT app=pjturn-client $(PJTURN_CLIENT_EXE)
+
+pjturn-srv: $(PJLIB_LIB) $(PJLIB_UTIL_LIB) $(PJNATH_LIB)
+	$(MAKE) -f $(RULES_MAK) APP=PJTURN_SRV app=pjturn-srv $(PJTURN_SRV_EXE)
+
+.PHONY: ../lib/pjnath.ko
+../lib/pjnath.ko:
+	echo Making $@
+	$(MAKE) -f $(RULES_MAK) APP=PJNATH app=pjnath $@
+
+.PHONY: ../lib/pjnath-test.ko
+../lib/pjnath-test.ko:
+	$(MAKE) -f $(RULES_MAK) APP=PJNATH_TEST app=pjnath-test $@
+
+clean:
+	$(MAKE) -f $(RULES_MAK) APP=PJNATH app=pjnath $@
+	$(MAKE) -f $(RULES_MAK) APP=PJNATH_TEST app=pjnath-test $@
+	$(MAKE) -f $(RULES_MAK) APP=PJTURN_CLIENT app=pjturn-client $@
+	$(MAKE) -f $(RULES_MAK) APP=PJTURN_SRV app=pjturn-srv $@
+
+realclean:
+	$(subst @@,$(subst /,$(HOST_PSEP),.pjnath-$(TARGET_NAME).depend),$(HOST_RMR))
+	$(subst @@,$(subst /,$(HOST_PSEP),.pjnath-test-$(TARGET_NAME).depend),$(HOST_RMR))
+	$(subst @@,$(subst /,$(HOST_PSEP),.pjturn-client-$(TARGET_NAME).depend),$(HOST_RMR))
+	$(subst @@,$(subst /,$(HOST_PSEP),.pjturn-srv-$(TARGET_NAME).depend),$(HOST_RMR))
+	$(MAKE) -f $(RULES_MAK) APP=PJNATH app=pjnath $@
+	$(MAKE) -f $(RULES_MAK) APP=PJNATH_TEST app=pjnath-test $@
+	$(MAKE) -f $(RULES_MAK) APP=PJTURN_CLIENT app=pjturn-client $@
+	$(MAKE) -f $(RULES_MAK) APP=PJTURN_SRV app=pjturn-srv $@
+
+depend:
+	$(MAKE) -f $(RULES_MAK) APP=PJNATH app=pjnath $@
+	$(MAKE) -f $(RULES_MAK) APP=PJNATH_TEST app=pjnath-test $@
+	$(MAKE) -f $(RULES_MAK) APP=PJTURN_CLIENT app=pjturn-client $@
+	$(MAKE) -f $(RULES_MAK) APP=PJTURN_SRV app=pjturn-srv $@
+	echo '$(PJNATH_TEST_EXE): $(PJNATH_LIB) $(PJLIB_UTIL_LIB) $(PJLIB_LIB)' >> .pjnath-test-$(TARGET_NAME).depend
+	echo '$(PJTURN_CLIENT_EXE): $(PJNATH_LIB) $(PJLIB_UTIL_LIB) $(PJLIB_LIB)' >> .pjturn-client-$(TARGET_NAME).depend
+	echo '$(PJTURN_SRV_EXE): $(PJNATH_LIB) $(PJLIB_UTIL_LIB) $(PJLIB_LIB)' >> .pjturn-srv-$(TARGET_NAME).depend
+
+