* #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/cb/cb0f6be587ce08848fe6d4484581326f095d0f26.svn-base b/jni/pjproject-android/.svn/pristine/cb/cb0f6be587ce08848fe6d4484581326f095d0f26.svn-base
new file mode 100644
index 0000000..92652c2
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/cb/cb0f6be587ce08848fe6d4484581326f095d0f26.svn-base
@@ -0,0 +1,5 @@
+# You can create user.mak file in PJ root directory to specify
+# additional flags to compiler and linker. For example:
+export CFLAGS += -Wno-unused-label -Werror
+export LDFLAGS +=
+
diff --git a/jni/pjproject-android/.svn/pristine/cb/cb218cb193cc250c44c7c2ce268d0b386b2ecd9e.svn-base b/jni/pjproject-android/.svn/pristine/cb/cb218cb193cc250c44c7c2ce268d0b386b2ecd9e.svn-base
new file mode 100644
index 0000000..947eec1
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/cb/cb218cb193cc250c44c7c2ce268d0b386b2ecd9e.svn-base
@@ -0,0 +1,243 @@
+/* $Id$ */
+/*
+ * This is an implementation of CRC32. See ISO 3309 and ITU-T V.42
+ * for a formal specification
+ *
+ * This file is partly taken from Crypto++ library (http://www.cryptopp.com)
+ * and http://www.di-mgt.com.au/crypto.html#CRC.
+ *
+ * Since the original version of the code is put in public domain,
+ * this file is put on public domain as well.
+ */
+#include <pjlib-util/crc32.h>
+
+
+#define CRC32_NEGL 0xffffffffL
+
+#if defined(PJ_CRC32_HAS_TABLES) && PJ_CRC32_HAS_TABLES!=0
+// crc.cpp - written and placed in the public domain by Wei Dai
+
+/* Table of CRC-32's of all single byte values (made by makecrc.c) */
+#if defined(PJ_IS_LITTLE_ENDIAN) && PJ_IS_LITTLE_ENDIAN != 0
+
+#define CRC32_INDEX(c) (c & 0xff)
+#define CRC32_SHIFTED(c) (c >> 8)
+#define CRC32_SWAP(c) (c)
+
+static const pj_uint32_t crc_tab[] = {
+ 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
+ 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
+ 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
+ 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
+ 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
+ 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
+ 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
+ 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
+ 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
+ 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
+ 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
+ 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
+ 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
+ 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
+ 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
+ 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
+ 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
+ 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
+ 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
+ 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
+ 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
+ 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
+ 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
+ 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
+ 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
+ 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
+ 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
+ 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
+ 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
+ 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
+ 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
+ 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
+ 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
+ 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
+ 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
+ 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
+ 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
+ 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
+ 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
+ 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
+ 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
+ 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
+ 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
+ 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
+ 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
+ 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
+ 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
+ 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
+ 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
+ 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
+ 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
+ 0x2d02ef8dL
+};
+
+
+#elif defined(PJ_IS_BIG_ENDIAN) && PJ_IS_BIG_ENDIAN != 0
+#define CRC32_INDEX(c) (c >> 24)
+#define CRC32_SHIFTED(c) (c << 8)
+#define CRC32_SWAP(c) ((((c) & 0xff000000) >> 24) | \
+ (((c) & 0x00ff0000) >> 8) | \
+ (((c) & 0x0000ff00) << 8) | \
+ (((c) & 0x000000ff) << 24))
+
+static const pj_uint32_t crc_tab[] = {
+ 0x00000000L, 0x96300777L, 0x2c610eeeL, 0xba510999L, 0x19c46d07L,
+ 0x8ff46a70L, 0x35a563e9L, 0xa395649eL, 0x3288db0eL, 0xa4b8dc79L,
+ 0x1ee9d5e0L, 0x88d9d297L, 0x2b4cb609L, 0xbd7cb17eL, 0x072db8e7L,
+ 0x911dbf90L, 0x6410b71dL, 0xf220b06aL, 0x4871b9f3L, 0xde41be84L,
+ 0x7dd4da1aL, 0xebe4dd6dL, 0x51b5d4f4L, 0xc785d383L, 0x56986c13L,
+ 0xc0a86b64L, 0x7af962fdL, 0xecc9658aL, 0x4f5c0114L, 0xd96c0663L,
+ 0x633d0ffaL, 0xf50d088dL, 0xc8206e3bL, 0x5e10694cL, 0xe44160d5L,
+ 0x727167a2L, 0xd1e4033cL, 0x47d4044bL, 0xfd850dd2L, 0x6bb50aa5L,
+ 0xfaa8b535L, 0x6c98b242L, 0xd6c9bbdbL, 0x40f9bcacL, 0xe36cd832L,
+ 0x755cdf45L, 0xcf0dd6dcL, 0x593dd1abL, 0xac30d926L, 0x3a00de51L,
+ 0x8051d7c8L, 0x1661d0bfL, 0xb5f4b421L, 0x23c4b356L, 0x9995bacfL,
+ 0x0fa5bdb8L, 0x9eb80228L, 0x0888055fL, 0xb2d90cc6L, 0x24e90bb1L,
+ 0x877c6f2fL, 0x114c6858L, 0xab1d61c1L, 0x3d2d66b6L, 0x9041dc76L,
+ 0x0671db01L, 0xbc20d298L, 0x2a10d5efL, 0x8985b171L, 0x1fb5b606L,
+ 0xa5e4bf9fL, 0x33d4b8e8L, 0xa2c90778L, 0x34f9000fL, 0x8ea80996L,
+ 0x18980ee1L, 0xbb0d6a7fL, 0x2d3d6d08L, 0x976c6491L, 0x015c63e6L,
+ 0xf4516b6bL, 0x62616c1cL, 0xd8306585L, 0x4e0062f2L, 0xed95066cL,
+ 0x7ba5011bL, 0xc1f40882L, 0x57c40ff5L, 0xc6d9b065L, 0x50e9b712L,
+ 0xeab8be8bL, 0x7c88b9fcL, 0xdf1ddd62L, 0x492dda15L, 0xf37cd38cL,
+ 0x654cd4fbL, 0x5861b24dL, 0xce51b53aL, 0x7400bca3L, 0xe230bbd4L,
+ 0x41a5df4aL, 0xd795d83dL, 0x6dc4d1a4L, 0xfbf4d6d3L, 0x6ae96943L,
+ 0xfcd96e34L, 0x468867adL, 0xd0b860daL, 0x732d0444L, 0xe51d0333L,
+ 0x5f4c0aaaL, 0xc97c0dddL, 0x3c710550L, 0xaa410227L, 0x10100bbeL,
+ 0x86200cc9L, 0x25b56857L, 0xb3856f20L, 0x09d466b9L, 0x9fe461ceL,
+ 0x0ef9de5eL, 0x98c9d929L, 0x2298d0b0L, 0xb4a8d7c7L, 0x173db359L,
+ 0x810db42eL, 0x3b5cbdb7L, 0xad6cbac0L, 0x2083b8edL, 0xb6b3bf9aL,
+ 0x0ce2b603L, 0x9ad2b174L, 0x3947d5eaL, 0xaf77d29dL, 0x1526db04L,
+ 0x8316dc73L, 0x120b63e3L, 0x843b6494L, 0x3e6a6d0dL, 0xa85a6a7aL,
+ 0x0bcf0ee4L, 0x9dff0993L, 0x27ae000aL, 0xb19e077dL, 0x44930ff0L,
+ 0xd2a30887L, 0x68f2011eL, 0xfec20669L, 0x5d5762f7L, 0xcb676580L,
+ 0x71366c19L, 0xe7066b6eL, 0x761bd4feL, 0xe02bd389L, 0x5a7ada10L,
+ 0xcc4add67L, 0x6fdfb9f9L, 0xf9efbe8eL, 0x43beb717L, 0xd58eb060L,
+ 0xe8a3d6d6L, 0x7e93d1a1L, 0xc4c2d838L, 0x52f2df4fL, 0xf167bbd1L,
+ 0x6757bca6L, 0xdd06b53fL, 0x4b36b248L, 0xda2b0dd8L, 0x4c1b0aafL,
+ 0xf64a0336L, 0x607a0441L, 0xc3ef60dfL, 0x55df67a8L, 0xef8e6e31L,
+ 0x79be6946L, 0x8cb361cbL, 0x1a8366bcL, 0xa0d26f25L, 0x36e26852L,
+ 0x95770cccL, 0x03470bbbL, 0xb9160222L, 0x2f260555L, 0xbe3bbac5L,
+ 0x280bbdb2L, 0x925ab42bL, 0x046ab35cL, 0xa7ffd7c2L, 0x31cfd0b5L,
+ 0x8b9ed92cL, 0x1daede5bL, 0xb0c2649bL, 0x26f263ecL, 0x9ca36a75L,
+ 0x0a936d02L, 0xa906099cL, 0x3f360eebL, 0x85670772L, 0x13570005L,
+ 0x824abf95L, 0x147ab8e2L, 0xae2bb17bL, 0x381bb60cL, 0x9b8ed292L,
+ 0x0dbed5e5L, 0xb7efdc7cL, 0x21dfdb0bL, 0xd4d2d386L, 0x42e2d4f1L,
+ 0xf8b3dd68L, 0x6e83da1fL, 0xcd16be81L, 0x5b26b9f6L, 0xe177b06fL,
+ 0x7747b718L, 0xe65a0888L, 0x706a0fffL, 0xca3b0666L, 0x5c0b0111L,
+ 0xff9e658fL, 0x69ae62f8L, 0xd3ff6b61L, 0x45cf6c16L, 0x78e20aa0L,
+ 0xeed20dd7L, 0x5483044eL, 0xc2b30339L, 0x612667a7L, 0xf71660d0L,
+ 0x4d476949L, 0xdb776e3eL, 0x4a6ad1aeL, 0xdc5ad6d9L, 0x660bdf40L,
+ 0xf03bd837L, 0x53aebca9L, 0xc59ebbdeL, 0x7fcfb247L, 0xe9ffb530L,
+ 0x1cf2bdbdL, 0x8ac2bacaL, 0x3093b353L, 0xa6a3b424L, 0x0536d0baL,
+ 0x9306d7cdL, 0x2957de54L, 0xbf67d923L, 0x2e7a66b3L, 0xb84a61c4L,
+ 0x021b685dL, 0x942b6f2aL, 0x37be0bb4L, 0xa18e0cc3L, 0x1bdf055aL,
+ 0x8def022dL
+};
+
+#else
+# error "Endianness not defined"
+#endif
+
+
+PJ_DEF(void) pj_crc32_init(pj_crc32_context *ctx)
+{
+ ctx->crc_state = 0;
+}
+
+PJ_DEF(pj_uint32_t) pj_crc32_update(pj_crc32_context *ctx,
+ const pj_uint8_t *data,
+ pj_size_t nbytes)
+{
+ pj_uint32_t crc = ctx->crc_state ^ CRC32_NEGL;
+
+ for( ; (((unsigned long)(pj_ssize_t)data) & 0x03) && nbytes > 0; --nbytes) {
+ crc = crc_tab[CRC32_INDEX(crc) ^ *data++] ^ CRC32_SHIFTED(crc);
+ }
+
+ while (nbytes >= 4) {
+ crc ^= *(const pj_uint32_t *)data;
+ crc = crc_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc);
+ crc = crc_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc);
+ crc = crc_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc);
+ crc = crc_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc);
+ nbytes -= 4;
+ data += 4;
+ }
+
+ while (nbytes--) {
+ crc = crc_tab[CRC32_INDEX(crc) ^ *data++] ^ CRC32_SHIFTED(crc);
+ }
+
+ ctx->crc_state = crc ^ CRC32_NEGL;
+
+ return ctx->crc_state;
+}
+
+PJ_DEF(pj_uint32_t) pj_crc32_final(pj_crc32_context *ctx)
+{
+ return CRC32_SWAP(ctx->crc_state);
+}
+
+
+#else
+
+PJ_DEF(void) pj_crc32_init(pj_crc32_context *ctx)
+{
+ ctx->crc_state = CRC32_NEGL;
+}
+
+
+PJ_DEF(pj_uint32_t) pj_crc32_update(pj_crc32_context *ctx,
+ const pj_uint8_t *octets,
+ pj_size_t len)
+
+{
+ pj_uint32_t crc = ctx->crc_state;
+
+ while (len--) {
+ pj_uint32_t temp;
+ int j;
+
+ temp = (pj_uint32_t)((crc & 0xFF) ^ *octets++);
+ for (j = 0; j < 8; j++)
+ {
+ if (temp & 0x1)
+ temp = (temp >> 1) ^ 0xEDB88320;
+ else
+ temp >>= 1;
+ }
+ crc = (crc >> 8) ^ temp;
+ }
+ ctx->crc_state = crc;
+
+ return crc ^ CRC32_NEGL;
+}
+
+PJ_DEF(pj_uint32_t) pj_crc32_final(pj_crc32_context *ctx)
+{
+ ctx->crc_state ^= CRC32_NEGL;
+ return ctx->crc_state;
+}
+
+#endif
+
+
+PJ_DEF(pj_uint32_t) pj_crc32_calc( const pj_uint8_t *data,
+ pj_size_t nbytes)
+{
+ pj_crc32_context ctx;
+
+ pj_crc32_init(&ctx);
+ pj_crc32_update(&ctx, data, nbytes);
+ return pj_crc32_final(&ctx);
+}
+
diff --git a/jni/pjproject-android/.svn/pristine/cb/cb2e45a1aa7471dd9bd1755233b5b82fb8aff76e.svn-base b/jni/pjproject-android/.svn/pristine/cb/cb2e45a1aa7471dd9bd1755233b5b82fb8aff76e.svn-base
new file mode 100644
index 0000000..28bfbcd
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/cb/cb2e45a1aa7471dd9bd1755233b5b82fb8aff76e.svn-base
@@ -0,0 +1,126 @@
+/* speex_types.h taken from libogg */
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
+ * *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
+ * by the Xiph.Org Foundation http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: #ifdef jail to whip a few platforms into the UNIX ideal.
+ last mod: $Id$
+
+ ********************************************************************/
+/**
+ @file speex_types.h
+ @brief Speex types
+*/
+#ifndef _SPEEX_TYPES_H
+#define _SPEEX_TYPES_H
+
+#if defined(_WIN32)
+
+# if defined(__CYGWIN__)
+# include <_G_config.h>
+ typedef _G_int32_t spx_int32_t;
+ typedef _G_uint32_t spx_uint32_t;
+ typedef _G_int16_t spx_int16_t;
+ typedef _G_uint16_t spx_uint16_t;
+# elif defined(__MINGW32__)
+ typedef short spx_int16_t;
+ typedef unsigned short spx_uint16_t;
+ typedef int spx_int32_t;
+ typedef unsigned int spx_uint32_t;
+# elif defined(__MWERKS__)
+ typedef int spx_int32_t;
+ typedef unsigned int spx_uint32_t;
+ typedef short spx_int16_t;
+ typedef unsigned short spx_uint16_t;
+# else
+ /* MSVC/Borland */
+ typedef __int32 spx_int32_t;
+ typedef unsigned __int32 spx_uint32_t;
+ typedef __int16 spx_int16_t;
+ typedef unsigned __int16 spx_uint16_t;
+# endif
+
+#elif defined(__MACOS__)
+
+# include <sys/types.h>
+ typedef SInt16 spx_int16_t;
+ typedef UInt16 spx_uint16_t;
+ typedef SInt32 spx_int32_t;
+ typedef UInt32 spx_uint32_t;
+
+#elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */
+
+# include <sys/types.h>
+ typedef int16_t spx_int16_t;
+ typedef u_int16_t spx_uint16_t;
+ typedef int32_t spx_int32_t;
+ typedef u_int32_t spx_uint32_t;
+
+#elif defined(__BEOS__)
+
+ /* Be */
+# include <inttypes.h>
+ typedef int16_t spx_int16_t;
+ typedef u_int16_t spx_uint16_t;
+ typedef int32_t spx_int32_t;
+ typedef u_int32_t spx_uint32_t;
+
+#elif defined (__EMX__)
+
+ /* OS/2 GCC */
+ typedef short spx_int16_t;
+ typedef unsigned short spx_uint16_t;
+ typedef int spx_int32_t;
+ typedef unsigned int spx_uint32_t;
+
+#elif defined (DJGPP)
+
+ /* DJGPP */
+ typedef short spx_int16_t;
+ typedef int spx_int32_t;
+ typedef unsigned int spx_uint32_t;
+
+#elif defined(R5900)
+
+ /* PS2 EE */
+ typedef int spx_int32_t;
+ typedef unsigned spx_uint32_t;
+ typedef short spx_int16_t;
+
+#elif defined(__SYMBIAN32__)
+
+ /* Symbian GCC */
+ typedef signed short spx_int16_t;
+ typedef unsigned short spx_uint16_t;
+ typedef signed int spx_int32_t;
+ typedef unsigned int spx_uint32_t;
+
+#elif defined(CONFIG_TI_C54X) || defined (CONFIG_TI_C55X)
+
+ typedef short spx_int16_t;
+ typedef unsigned short spx_uint16_t;
+ typedef long spx_int32_t;
+ typedef unsigned long spx_uint32_t;
+
+#elif defined(CONFIG_TI_C6X)
+
+ typedef short spx_int16_t;
+ typedef unsigned short spx_uint16_t;
+ typedef int spx_int32_t;
+ typedef unsigned int spx_uint32_t;
+
+#else
+
+# include <speex/speex_config_types.h>
+
+#endif
+
+#endif /* _SPEEX_TYPES_H */
diff --git a/jni/pjproject-android/.svn/pristine/cb/cb2e5d35248e404e54eb22fb4b8d90d66e739797.svn-base b/jni/pjproject-android/.svn/pristine/cb/cb2e5d35248e404e54eb22fb4b8d90d66e739797.svn-base
new file mode 100644
index 0000000..642f7bf
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/cb/cb2e5d35248e404e54eb22fb4b8d90d66e739797.svn-base
@@ -0,0 +1,10 @@
+#include <appinfo.rh>
+
+UID2 KUidAppRegistrationResourceFile
+UID3 0xA000000E
+
+RESOURCE APP_REGISTRATION_INFO
+{
+ app_file="symsndtest";
+}
+
diff --git a/jni/pjproject-android/.svn/pristine/cb/cb3da6fdb93dc4e8a6531ca4c0594a71c080b259.svn-base b/jni/pjproject-android/.svn/pristine/cb/cb3da6fdb93dc4e8a6531ca4c0594a71c080b259.svn-base
new file mode 100644
index 0000000..0096aca
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/cb/cb3da6fdb93dc4e8a6531ca4c0594a71c080b259.svn-base
@@ -0,0 +1,2179 @@
+/* $Id$ */
+/*
+ * Copyright (C) 2011-2011 Teluu Inc. (http://www.teluu.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include <pjsua-lib/pjsua.h>
+#include <pjsua-lib/pjsua_internal.h>
+
+#if defined(PJSUA_MEDIA_HAS_PJMEDIA) && PJSUA_MEDIA_HAS_PJMEDIA != 0
+
+#define THIS_FILE "pjsua_vid.c"
+
+#if PJSUA_HAS_VIDEO
+
+#define ENABLE_EVENT 1
+#define VID_TEE_MAX_PORT (PJSUA_MAX_CALLS + 1)
+
+#define PJSUA_SHOW_WINDOW 1
+#define PJSUA_HIDE_WINDOW 0
+
+
+static void free_vid_win(pjsua_vid_win_id wid);
+
+/*****************************************************************************
+ * pjsua video subsystem.
+ */
+pj_status_t pjsua_vid_subsys_init(void)
+{
+ unsigned i;
+ pj_status_t status;
+
+ PJ_LOG(4,(THIS_FILE, "Initializing video subsystem.."));
+ pj_log_push_indent();
+
+ status = pjmedia_video_format_mgr_create(pjsua_var.pool, 64, 0, NULL);
+ if (status != PJ_SUCCESS) {
+ PJ_PERROR(1,(THIS_FILE, status,
+ "Error creating PJMEDIA video format manager"));
+ goto on_error;
+ }
+
+ status = pjmedia_converter_mgr_create(pjsua_var.pool, NULL);
+ if (status != PJ_SUCCESS) {
+ PJ_PERROR(1,(THIS_FILE, status,
+ "Error creating PJMEDIA converter manager"));
+ goto on_error;
+ }
+
+ status = pjmedia_event_mgr_create(pjsua_var.pool, 0, NULL);
+ if (status != PJ_SUCCESS) {
+ PJ_PERROR(1,(THIS_FILE, status,
+ "Error creating PJMEDIA event manager"));
+ goto on_error;
+ }
+
+ status = pjmedia_vid_codec_mgr_create(pjsua_var.pool, NULL);
+ if (status != PJ_SUCCESS) {
+ PJ_PERROR(1,(THIS_FILE, status,
+ "Error creating PJMEDIA video codec manager"));
+ goto on_error;
+ }
+
+#if PJMEDIA_HAS_VIDEO && PJMEDIA_HAS_FFMPEG_VID_CODEC
+ status = pjmedia_codec_ffmpeg_vid_init(NULL, &pjsua_var.cp.factory);
+ if (status != PJ_SUCCESS) {
+ PJ_PERROR(1,(THIS_FILE, status,
+ "Error initializing ffmpeg library"));
+ goto on_error;
+ }
+#endif
+
+ status = pjmedia_vid_dev_subsys_init(&pjsua_var.cp.factory);
+ if (status != PJ_SUCCESS) {
+ PJ_PERROR(1,(THIS_FILE, status,
+ "Error creating PJMEDIA video subsystem"));
+ goto on_error;
+ }
+
+ for (i=0; i<PJSUA_MAX_VID_WINS; ++i) {
+ if (pjsua_var.win[i].pool == NULL) {
+ pjsua_var.win[i].pool = pjsua_pool_create("win%p", 512, 512);
+ if (pjsua_var.win[i].pool == NULL) {
+ status = PJ_ENOMEM;
+ goto on_error;
+ }
+ }
+ }
+
+ pj_log_pop_indent();
+ return PJ_SUCCESS;
+
+on_error:
+ pj_log_pop_indent();
+ return status;
+}
+
+pj_status_t pjsua_vid_subsys_start(void)
+{
+ return PJ_SUCCESS;
+}
+
+pj_status_t pjsua_vid_subsys_destroy(void)
+{
+ unsigned i;
+
+ PJ_LOG(4,(THIS_FILE, "Destroying video subsystem.."));
+ pj_log_push_indent();
+
+ for (i=0; i<PJSUA_MAX_VID_WINS; ++i) {
+ if (pjsua_var.win[i].pool) {
+ free_vid_win(i);
+ pj_pool_release(pjsua_var.win[i].pool);
+ pjsua_var.win[i].pool = NULL;
+ }
+ }
+
+ pjmedia_vid_dev_subsys_shutdown();
+
+#if PJMEDIA_HAS_FFMPEG_VID_CODEC
+ pjmedia_codec_ffmpeg_vid_deinit();
+#endif
+
+ if (pjmedia_vid_codec_mgr_instance())
+ pjmedia_vid_codec_mgr_destroy(NULL);
+
+ if (pjmedia_converter_mgr_instance())
+ pjmedia_converter_mgr_destroy(NULL);
+
+ if (pjmedia_event_mgr_instance())
+ pjmedia_event_mgr_destroy(NULL);
+
+ if (pjmedia_video_format_mgr_instance())
+ pjmedia_video_format_mgr_destroy(NULL);
+
+ pj_log_pop_indent();
+ return PJ_SUCCESS;
+}
+
+PJ_DEF(const char*) pjsua_vid_win_type_name(pjsua_vid_win_type wt)
+{
+ const char *win_type_names[] = {
+ "none",
+ "preview",
+ "stream"
+ };
+
+ return (wt < PJ_ARRAY_SIZE(win_type_names)) ? win_type_names[wt] : "??";
+}
+
+PJ_DEF(void)
+pjsua_call_vid_strm_op_param_default(pjsua_call_vid_strm_op_param *param)
+{
+ pj_bzero(param, sizeof(*param));
+ param->med_idx = -1;
+ param->dir = PJMEDIA_DIR_ENCODING_DECODING;
+ param->cap_dev = PJMEDIA_VID_DEFAULT_CAPTURE_DEV;
+}
+
+PJ_DEF(void) pjsua_vid_preview_param_default(pjsua_vid_preview_param *p)
+{
+ p->rend_id = PJMEDIA_VID_DEFAULT_RENDER_DEV;
+ p->show = PJ_TRUE;
+ p->wnd_flags = 0;
+}
+
+
+/*****************************************************************************
+ * Devices.
+ */
+
+/*
+ * Get the number of video devices installed in the system.
+ */
+PJ_DEF(unsigned) pjsua_vid_dev_count(void)
+{
+ return pjmedia_vid_dev_count();
+}
+
+/*
+ * Retrieve the video device info for the specified device index.
+ */
+PJ_DEF(pj_status_t) pjsua_vid_dev_get_info(pjmedia_vid_dev_index id,
+ pjmedia_vid_dev_info *vdi)
+{
+ return pjmedia_vid_dev_get_info(id, vdi);
+}
+
+/*
+ * Enum all video devices installed in the system.
+ */
+PJ_DEF(pj_status_t) pjsua_vid_enum_devs(pjmedia_vid_dev_info info[],
+ unsigned *count)
+{
+ unsigned i, dev_count;
+
+ dev_count = pjmedia_vid_dev_count();
+
+ if (dev_count > *count) dev_count = *count;
+
+ for (i=0; i<dev_count; ++i) {
+ pj_status_t status;
+
+ status = pjmedia_vid_dev_get_info(i, &info[i]);
+ if (status != PJ_SUCCESS)
+ return status;
+ }
+
+ *count = dev_count;
+
+ return PJ_SUCCESS;
+}
+
+
+/*****************************************************************************
+ * Codecs.
+ */
+
+static pj_status_t find_codecs_with_rtp_packing(
+ const pj_str_t *codec_id,
+ unsigned *count,
+ const pjmedia_vid_codec_info *p_info[])
+{
+ const pjmedia_vid_codec_info *info[32];
+ unsigned i, j, count_ = PJ_ARRAY_SIZE(info);
+ pj_status_t status;
+
+ status = pjmedia_vid_codec_mgr_find_codecs_by_id(NULL, codec_id,
+ &count_, info, NULL);
+ if (status != PJ_SUCCESS)
+ return status;
+
+ for (i = 0, j = 0; i < count_ && j<*count; ++i) {
+ if ((info[i]->packings & PJMEDIA_VID_PACKING_PACKETS) == 0)
+ continue;
+ p_info[j++] = info[i];
+ }
+ *count = j;
+ return PJ_SUCCESS;
+}
+
+/*
+ * Enum all supported video codecs in the system.
+ */
+PJ_DEF(pj_status_t) pjsua_vid_enum_codecs( pjsua_codec_info id[],
+ unsigned *p_count )
+{
+ pjmedia_vid_codec_info info[32];
+ unsigned i, j, count, prio[32];
+ pj_status_t status;
+
+ count = PJ_ARRAY_SIZE(info);
+ status = pjmedia_vid_codec_mgr_enum_codecs(NULL, &count, info, prio);
+ if (status != PJ_SUCCESS) {
+ *p_count = 0;
+ return status;
+ }
+
+ for (i=0, j=0; i<count && j<*p_count; ++i) {
+ if (info[i].packings & PJMEDIA_VID_PACKING_PACKETS) {
+ pj_bzero(&id[j], sizeof(pjsua_codec_info));
+
+ pjmedia_vid_codec_info_to_id(&info[i], id[j].buf_, sizeof(id[j].buf_));
+ id[j].codec_id = pj_str(id[j].buf_);
+ id[j].priority = (pj_uint8_t) prio[i];
+
+ if (id[j].codec_id.slen < sizeof(id[j].buf_)) {
+ id[j].desc.ptr = id[j].codec_id.ptr + id[j].codec_id.slen + 1;
+ pj_strncpy(&id[j].desc, &info[i].encoding_desc,
+ sizeof(id[j].buf_) - id[j].codec_id.slen - 1);
+ }
+
+ ++j;
+ }
+ }
+
+ *p_count = j;
+
+ return PJ_SUCCESS;
+}
+
+
+/*
+ * Change video codec priority.
+ */
+PJ_DEF(pj_status_t) pjsua_vid_codec_set_priority( const pj_str_t *codec_id,
+ pj_uint8_t priority )
+{
+ const pj_str_t all = { NULL, 0 };
+
+ if (codec_id->slen==1 && *codec_id->ptr=='*')
+ codec_id = &all;
+
+ return pjmedia_vid_codec_mgr_set_codec_priority(NULL, codec_id,
+ priority);
+}
+
+
+/*
+ * Get video codec parameters.
+ */
+PJ_DEF(pj_status_t) pjsua_vid_codec_get_param(
+ const pj_str_t *codec_id,
+ pjmedia_vid_codec_param *param)
+{
+ const pjmedia_vid_codec_info *info[2];
+ unsigned count = 2;
+ pj_status_t status;
+
+ status = find_codecs_with_rtp_packing(codec_id, &count, info);
+ if (status != PJ_SUCCESS)
+ return status;
+
+ if (count != 1)
+ return (count > 1? PJ_ETOOMANY : PJ_ENOTFOUND);
+
+ status = pjmedia_vid_codec_mgr_get_default_param(NULL, info[0], param);
+ return status;
+}
+
+
+/*
+ * Set video codec parameters.
+ */
+PJ_DEF(pj_status_t) pjsua_vid_codec_set_param(
+ const pj_str_t *codec_id,
+ const pjmedia_vid_codec_param *param)
+{
+ const pjmedia_vid_codec_info *info[2];
+ unsigned count = 2;
+ pj_status_t status;
+
+ status = find_codecs_with_rtp_packing(codec_id, &count, info);
+ if (status != PJ_SUCCESS)
+ return status;
+
+ if (count != 1)
+ return (count > 1? PJ_ETOOMANY : PJ_ENOTFOUND);
+
+ status = pjmedia_vid_codec_mgr_set_default_param(NULL, info[0], param);
+ return status;
+}
+
+
+/*****************************************************************************
+ * Preview
+ */
+
+static pjsua_vid_win_id vid_preview_get_win(pjmedia_vid_dev_index id,
+ pj_bool_t running_only)
+{
+ pjsua_vid_win_id wid = PJSUA_INVALID_ID;
+ unsigned i;
+
+ PJSUA_LOCK();
+
+ /* Get real capture ID, if set to PJMEDIA_VID_DEFAULT_CAPTURE_DEV */
+ if (id == PJMEDIA_VID_DEFAULT_CAPTURE_DEV) {
+ pjmedia_vid_dev_info info;
+ pjmedia_vid_dev_get_info(id, &info);
+ id = info.id;
+ }
+
+ for (i=0; i<PJSUA_MAX_VID_WINS; ++i) {
+ pjsua_vid_win *w = &pjsua_var.win[i];
+ if (w->type == PJSUA_WND_TYPE_PREVIEW && w->preview_cap_id == id) {
+ wid = i;
+ break;
+ }
+ }
+
+ if (wid != PJSUA_INVALID_ID && running_only) {
+ pjsua_vid_win *w = &pjsua_var.win[wid];
+ wid = w->preview_running ? wid : PJSUA_INVALID_ID;
+ }
+
+ PJSUA_UNLOCK();
+
+ return wid;
+}
+
+/*
+ * NOTE: internal function don't use this!!! Use vid_preview_get_win()
+ * instead. This is because this function will only return window ID
+ * if preview is currently running.
+ */
+PJ_DEF(pjsua_vid_win_id) pjsua_vid_preview_get_win(pjmedia_vid_dev_index id)
+{
+ return vid_preview_get_win(id, PJ_TRUE);
+}
+
+PJ_DEF(void) pjsua_vid_win_reset(pjsua_vid_win_id wid)
+{
+ pjsua_vid_win *w = &pjsua_var.win[wid];
+ pj_pool_t *pool = w->pool;
+
+ pj_bzero(w, sizeof(*w));
+ if (pool) pj_pool_reset(pool);
+ w->ref_cnt = 0;
+ w->pool = pool;
+ w->preview_cap_id = PJMEDIA_VID_INVALID_DEV;
+}
+
+/* Allocate and initialize pjsua video window:
+ * - If the type is preview, video capture, tee, and render
+ * will be instantiated.
+ * - If the type is stream, only renderer will be created.
+ */
+static pj_status_t create_vid_win(pjsua_vid_win_type type,
+ const pjmedia_format *fmt,
+ pjmedia_vid_dev_index rend_id,
+ pjmedia_vid_dev_index cap_id,
+ pj_bool_t show,
+ unsigned wnd_flags,
+ pjsua_vid_win_id *id)
+{
+ pj_bool_t enable_native_preview;
+ pjsua_vid_win_id wid = PJSUA_INVALID_ID;
+ pjsua_vid_win *w = NULL;
+ pjmedia_vid_port_param vp_param;
+ pjmedia_format fmt_;
+ pj_status_t status;
+ unsigned i;
+
+ enable_native_preview = pjsua_var.media_cfg.vid_preview_enable_native;
+
+ PJ_LOG(4,(THIS_FILE,
+ "Creating video window: type=%s, cap_id=%d, rend_id=%d",
+ pjsua_vid_win_type_name(type), cap_id, rend_id));
+ pj_log_push_indent();
+
+ /* If type is preview, check if it exists already */
+ if (type == PJSUA_WND_TYPE_PREVIEW) {
+ wid = vid_preview_get_win(cap_id, PJ_FALSE);
+ if (wid != PJSUA_INVALID_ID) {
+ /* Yes, it exists */
+ /* Show/hide window */
+ pjmedia_vid_dev_stream *strm;
+ pj_bool_t hide = !show;
+
+ w = &pjsua_var.win[wid];
+
+ PJ_LOG(4,(THIS_FILE,
+ "Window already exists for cap_dev=%d, returning wid=%d",
+ cap_id, wid));
+
+
+ if (w->is_native) {
+ strm = pjmedia_vid_port_get_stream(w->vp_cap);
+ } else {
+ strm = pjmedia_vid_port_get_stream(w->vp_rend);
+ }
+
+ pj_assert(strm);
+ status = pjmedia_vid_dev_stream_set_cap(
+ strm, PJMEDIA_VID_DEV_CAP_OUTPUT_HIDE,
+ &hide);
+
+ pjmedia_vid_dev_stream_set_cap(
+ strm, PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS,
+ &wnd_flags);
+
+ /* Done */
+ *id = wid;
+ pj_log_pop_indent();
+
+ return status;
+ }
+ }
+
+ /* Allocate window */
+ for (i=0; i<PJSUA_MAX_VID_WINS; ++i) {
+ w = &pjsua_var.win[i];
+ if (w->type == PJSUA_WND_TYPE_NONE) {
+ wid = i;
+ w->type = type;
+ break;
+ }
+ }
+ if (i == PJSUA_MAX_VID_WINS) {
+ pj_log_pop_indent();
+ return PJ_ETOOMANY;
+ }
+
+ /* Initialize window */
+ pjmedia_vid_port_param_default(&vp_param);
+
+ if (w->type == PJSUA_WND_TYPE_PREVIEW) {
+ pjmedia_vid_dev_info vdi;
+
+ /*
+ * Determine if the device supports native preview.
+ */
+ status = pjmedia_vid_dev_get_info(cap_id, &vdi);
+ if (status != PJ_SUCCESS)
+ goto on_error;
+
+ if (enable_native_preview &&
+ (vdi.caps & PJMEDIA_VID_DEV_CAP_INPUT_PREVIEW))
+ {
+ /* Device supports native preview! */
+ w->is_native = PJ_TRUE;
+ }
+
+ status = pjmedia_vid_dev_default_param(w->pool, cap_id,
+ &vp_param.vidparam);
+ if (status != PJ_SUCCESS)
+ goto on_error;
+
+ if (w->is_native) {
+ vp_param.vidparam.flags |= PJMEDIA_VID_DEV_CAP_OUTPUT_HIDE;
+ vp_param.vidparam.window_hide = !show;
+ vp_param.vidparam.flags |= PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS;
+ vp_param.vidparam.window_flags = wnd_flags;
+ }
+
+ /* Normalize capture ID, in case it was set to
+ * PJMEDIA_VID_DEFAULT_CAPTURE_DEV
+ */
+ cap_id = vp_param.vidparam.cap_id;
+
+ /* Assign preview capture device ID */
+ w->preview_cap_id = cap_id;
+
+ /* Create capture video port */
+ vp_param.active = PJ_TRUE;
+ vp_param.vidparam.dir = PJMEDIA_DIR_CAPTURE;
+ if (fmt)
+ vp_param.vidparam.fmt = *fmt;
+
+ status = pjmedia_vid_port_create(w->pool, &vp_param, &w->vp_cap);
+ if (status != PJ_SUCCESS)
+ goto on_error;
+
+ /* Update format info */
+ fmt_ = vp_param.vidparam.fmt;
+ fmt = &fmt_;
+
+ /* Create video tee */
+ status = pjmedia_vid_tee_create(w->pool, fmt, VID_TEE_MAX_PORT,
+ &w->tee);
+ if (status != PJ_SUCCESS)
+ goto on_error;
+
+ /* Connect capturer to the video tee */
+ status = pjmedia_vid_port_connect(w->vp_cap, w->tee, PJ_FALSE);
+ if (status != PJ_SUCCESS)
+ goto on_error;
+
+ /* If device supports native preview, enable it */
+ if (w->is_native) {
+ pjmedia_vid_dev_stream *cap_dev;
+ pj_bool_t enabled = PJ_TRUE;
+
+ cap_dev = pjmedia_vid_port_get_stream(w->vp_cap);
+ status = pjmedia_vid_dev_stream_set_cap(
+ cap_dev, PJMEDIA_VID_DEV_CAP_INPUT_PREVIEW,
+ &enabled);
+ if (status != PJ_SUCCESS) {
+ PJ_PERROR(1,(THIS_FILE, status,
+ "Error activating native preview, falling back "
+ "to software preview.."));
+ w->is_native = PJ_FALSE;
+ }
+ }
+ }
+
+ /* Create renderer video port, only if it's not a native preview */
+ if (!w->is_native) {
+ status = pjmedia_vid_dev_default_param(w->pool, rend_id,
+ &vp_param.vidparam);
+ if (status != PJ_SUCCESS)
+ goto on_error;
+
+ vp_param.active = (w->type == PJSUA_WND_TYPE_STREAM);
+ vp_param.vidparam.dir = PJMEDIA_DIR_RENDER;
+ vp_param.vidparam.fmt = *fmt;
+ vp_param.vidparam.disp_size = fmt->det.vid.size;
+ vp_param.vidparam.flags |= PJMEDIA_VID_DEV_CAP_OUTPUT_HIDE;
+ vp_param.vidparam.window_hide = !show;
+ vp_param.vidparam.flags |= PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS;
+ vp_param.vidparam.window_flags = wnd_flags;
+
+ status = pjmedia_vid_port_create(w->pool, &vp_param, &w->vp_rend);
+ if (status != PJ_SUCCESS)
+ goto on_error;
+
+ /* For preview window, connect capturer & renderer (via tee) */
+ if (w->type == PJSUA_WND_TYPE_PREVIEW) {
+ pjmedia_port *rend_port;
+
+ rend_port = pjmedia_vid_port_get_passive_port(w->vp_rend);
+ status = pjmedia_vid_tee_add_dst_port2(w->tee, 0, rend_port);
+ if (status != PJ_SUCCESS)
+ goto on_error;
+ }
+
+ PJ_LOG(4,(THIS_FILE,
+ "%s window id %d created for cap_dev=%d rend_dev=%d",
+ pjsua_vid_win_type_name(type), wid, cap_id, rend_id));
+ } else {
+ PJ_LOG(4,(THIS_FILE,
+ "Preview window id %d created for cap_dev %d, "
+ "using built-in preview!",
+ wid, cap_id));
+ }
+
+
+ /* Done */
+ *id = wid;
+
+ PJ_LOG(4,(THIS_FILE, "Window %d created", wid));
+ pj_log_pop_indent();
+ return PJ_SUCCESS;
+
+on_error:
+ free_vid_win(wid);
+ pj_log_pop_indent();
+ return status;
+}
+
+
+static void free_vid_win(pjsua_vid_win_id wid)
+{
+ pjsua_vid_win *w = &pjsua_var.win[wid];
+
+ PJ_LOG(4,(THIS_FILE, "Window %d: destroying..", wid));
+ pj_log_push_indent();
+
+ if (w->vp_cap) {
+ pjmedia_event_unsubscribe(NULL, &call_media_on_event, NULL,
+ w->vp_cap);
+ pjmedia_vid_port_stop(w->vp_cap);
+ pjmedia_vid_port_disconnect(w->vp_cap);
+ pjmedia_vid_port_destroy(w->vp_cap);
+ }
+ if (w->vp_rend) {
+ pjmedia_event_unsubscribe(NULL, &call_media_on_event, NULL,
+ w->vp_rend);
+ pjmedia_vid_port_stop(w->vp_rend);
+ pjmedia_vid_port_destroy(w->vp_rend);
+ }
+ if (w->tee) {
+ pjmedia_port_destroy(w->tee);
+ }
+ pjsua_vid_win_reset(wid);
+
+ pj_log_pop_indent();
+}
+
+
+static void inc_vid_win(pjsua_vid_win_id wid)
+{
+ pjsua_vid_win *w;
+
+ pj_assert(wid >= 0 && wid < PJSUA_MAX_VID_WINS);
+
+ w = &pjsua_var.win[wid];
+ pj_assert(w->type != PJSUA_WND_TYPE_NONE);
+ ++w->ref_cnt;
+}
+
+static void dec_vid_win(pjsua_vid_win_id wid)
+{
+ pjsua_vid_win *w;
+
+ pj_assert(wid >= 0 && wid < PJSUA_MAX_VID_WINS);
+
+ w = &pjsua_var.win[wid];
+ pj_assert(w->type != PJSUA_WND_TYPE_NONE);
+ if (--w->ref_cnt == 0)
+ free_vid_win(wid);
+}
+
+/* Initialize video call media */
+pj_status_t pjsua_vid_channel_init(pjsua_call_media *call_med)
+{
+ pjsua_acc *acc = &pjsua_var.acc[call_med->call->acc_id];
+
+ call_med->strm.v.rdr_dev = acc->cfg.vid_rend_dev;
+ call_med->strm.v.cap_dev = acc->cfg.vid_cap_dev;
+ if (call_med->strm.v.rdr_dev == PJMEDIA_VID_DEFAULT_RENDER_DEV) {
+ pjmedia_vid_dev_info info;
+ pjmedia_vid_dev_get_info(call_med->strm.v.rdr_dev, &info);
+ call_med->strm.v.rdr_dev = info.id;
+ }
+ if (call_med->strm.v.cap_dev == PJMEDIA_VID_DEFAULT_CAPTURE_DEV) {
+ pjmedia_vid_dev_info info;
+ pjmedia_vid_dev_get_info(call_med->strm.v.cap_dev, &info);
+ call_med->strm.v.cap_dev = info.id;
+ }
+
+ return PJ_SUCCESS;
+}
+
+/* Internal function: update video channel after SDP negotiation.
+ * Warning: do not use temporary/flip-flop pool, e.g: inv->pool_prov,
+ * for creating stream, etc, as after SDP negotiation and when
+ * the SDP media is not changed, the stream should remain running
+ * while the temporary/flip-flop pool may be released.
+ */
+pj_status_t pjsua_vid_channel_update(pjsua_call_media *call_med,
+ pj_pool_t *tmp_pool,
+ pjmedia_vid_stream_info *si,
+ const pjmedia_sdp_session *local_sdp,
+ const pjmedia_sdp_session *remote_sdp)
+{
+ pjsua_call *call = call_med->call;
+ pjsua_acc *acc = &pjsua_var.acc[call->acc_id];
+ pjmedia_port *media_port;
+ pj_status_t status;
+
+ PJ_UNUSED_ARG(tmp_pool);
+ PJ_UNUSED_ARG(local_sdp);
+ PJ_UNUSED_ARG(remote_sdp);
+
+ PJ_LOG(4,(THIS_FILE, "Video channel update.."));
+ pj_log_push_indent();
+
+ si->rtcp_sdes_bye_disabled = pjsua_var.media_cfg.no_rtcp_sdes_bye;;
+
+ /* Check if no media is active */
+ if (si->dir != PJMEDIA_DIR_NONE) {
+ /* Optionally, application may modify other stream settings here
+ * (such as jitter buffer parameters, codec ptime, etc.)
+ */
+ si->jb_init = pjsua_var.media_cfg.jb_init;
+ si->jb_min_pre = pjsua_var.media_cfg.jb_min_pre;
+ si->jb_max_pre = pjsua_var.media_cfg.jb_max_pre;
+ si->jb_max = pjsua_var.media_cfg.jb_max;
+
+ /* Set SSRC */
+ si->ssrc = call_med->ssrc;
+
+ /* Set RTP timestamp & sequence, normally these value are intialized
+ * automatically when stream session created, but for some cases (e.g:
+ * call reinvite, call update) timestamp and sequence need to be kept
+ * contigue.
+ */
+ si->rtp_ts = call_med->rtp_tx_ts;
+ si->rtp_seq = call_med->rtp_tx_seq;
+ si->rtp_seq_ts_set = call_med->rtp_tx_seq_ts_set;
+
+ /* Set rate control config from account setting */
+ si->rc_cfg = acc->cfg.vid_stream_rc_cfg;
+
+#if defined(PJMEDIA_STREAM_ENABLE_KA) && PJMEDIA_STREAM_ENABLE_KA!=0
+ /* Enable/disable stream keep-alive and NAT hole punch. */
+ si->use_ka = pjsua_var.acc[call->acc_id].cfg.use_stream_ka;
+#endif
+
+ /* Try to get shared format ID between the capture device and
+ * the encoder to avoid format conversion in the capture device.
+ */
+ if (si->dir & PJMEDIA_DIR_ENCODING) {
+ pjmedia_vid_dev_info dev_info;
+ pjmedia_vid_codec_info *codec_info = &si->codec_info;
+ unsigned i, j;
+
+ status = pjmedia_vid_dev_get_info(call_med->strm.v.cap_dev,
+ &dev_info);
+ if (status != PJ_SUCCESS)
+ goto on_error;
+
+ /* Find matched format ID */
+ for (i = 0; i < codec_info->dec_fmt_id_cnt; ++i) {
+ for (j = 0; j < dev_info.fmt_cnt; ++j) {
+ if (codec_info->dec_fmt_id[i] ==
+ (pjmedia_format_id)dev_info.fmt[j].id)
+ {
+ /* Apply the matched format ID to the codec */
+ si->codec_param->dec_fmt.id =
+ codec_info->dec_fmt_id[i];
+
+ /* Force outer loop to break */
+ i = codec_info->dec_fmt_id_cnt;
+ break;
+ }
+ }
+ }
+ }
+
+ /* Create session based on session info. */
+ status = pjmedia_vid_stream_create(pjsua_var.med_endpt, NULL, si,
+ call_med->tp, NULL,
+ &call_med->strm.v.stream);
+ if (status != PJ_SUCCESS)
+ goto on_error;
+
+ /* Start stream */
+ status = pjmedia_vid_stream_start(call_med->strm.v.stream);
+ if (status != PJ_SUCCESS)
+ goto on_error;
+
+ if (call_med->prev_state == PJSUA_CALL_MEDIA_NONE)
+ pjmedia_vid_stream_send_rtcp_sdes(call_med->strm.v.stream);
+
+ /* Setup decoding direction */
+ if (si->dir & PJMEDIA_DIR_DECODING)
+ {
+ pjsua_vid_win_id wid;
+ pjsua_vid_win *w;
+
+ PJ_LOG(4,(THIS_FILE, "Setting up RX.."));
+ pj_log_push_indent();
+
+ status = pjmedia_vid_stream_get_port(call_med->strm.v.stream,
+ PJMEDIA_DIR_DECODING,
+ &media_port);
+ if (status != PJ_SUCCESS) {
+ pj_log_pop_indent();
+ goto on_error;
+ }
+
+ /* Create stream video window */
+ status = create_vid_win(PJSUA_WND_TYPE_STREAM,
+ &media_port->info.fmt,
+ call_med->strm.v.rdr_dev,
+ //acc->cfg.vid_rend_dev,
+ PJSUA_INVALID_ID,
+ acc->cfg.vid_in_auto_show,
+ acc->cfg.vid_wnd_flags,
+ &wid);
+ if (status != PJ_SUCCESS) {
+ pj_log_pop_indent();
+ goto on_error;
+ }
+
+ w = &pjsua_var.win[wid];
+
+#if ENABLE_EVENT
+ /* Register to video events */
+ pjmedia_event_subscribe(NULL, &call_media_on_event,
+ call_med, w->vp_rend);
+#endif
+
+ /* Connect renderer to stream */
+ status = pjmedia_vid_port_connect(w->vp_rend, media_port,
+ PJ_FALSE);
+ if (status != PJ_SUCCESS) {
+ pj_log_pop_indent();
+ goto on_error;
+ }
+
+ /* Start renderer */
+ status = pjmedia_vid_port_start(w->vp_rend);
+ if (status != PJ_SUCCESS) {
+ pj_log_pop_indent();
+ goto on_error;
+ }
+
+ /* Done */
+ inc_vid_win(wid);
+ call_med->strm.v.rdr_win_id = wid;
+ pj_log_pop_indent();
+ }
+
+ /* Setup encoding direction */
+ if (si->dir & PJMEDIA_DIR_ENCODING && !call->local_hold)
+ {
+ pjsua_acc *acc = &pjsua_var.acc[call_med->call->acc_id];
+ pjsua_vid_win *w;
+ pjsua_vid_win_id wid;
+ pj_bool_t just_created = PJ_FALSE;
+
+ PJ_LOG(4,(THIS_FILE, "Setting up TX.."));
+ pj_log_push_indent();
+
+ status = pjmedia_vid_stream_get_port(call_med->strm.v.stream,
+ PJMEDIA_DIR_ENCODING,
+ &media_port);
+ if (status != PJ_SUCCESS) {
+ pj_log_pop_indent();
+ goto on_error;
+ }
+
+ /* Note: calling pjsua_vid_preview_get_win() even though
+ * create_vid_win() will automatically create the window
+ * if it doesn't exist, because create_vid_win() will modify
+ * existing window SHOW/HIDE value.
+ */
+ wid = vid_preview_get_win(call_med->strm.v.cap_dev, PJ_FALSE);
+ if (wid == PJSUA_INVALID_ID) {
+ /* Create preview video window */
+ status = create_vid_win(PJSUA_WND_TYPE_PREVIEW,
+ &media_port->info.fmt,
+ call_med->strm.v.rdr_dev,
+ call_med->strm.v.cap_dev,
+ //acc->cfg.vid_rend_dev,
+ //acc->cfg.vid_cap_dev,
+ PJSUA_HIDE_WINDOW,
+ acc->cfg.vid_wnd_flags,
+ &wid);
+ if (status != PJ_SUCCESS) {
+ pj_log_pop_indent();
+ return status;
+ }
+ just_created = PJ_TRUE;
+ }
+
+ w = &pjsua_var.win[wid];
+#if ENABLE_EVENT
+ pjmedia_event_subscribe(NULL, &call_media_on_event,
+ call_med, w->vp_cap);
+#endif
+
+ /* Connect stream to capturer (via video window tee) */
+ status = pjmedia_vid_tee_add_dst_port2(w->tee, 0, media_port);
+ if (status != PJ_SUCCESS) {
+ pj_log_pop_indent();
+ goto on_error;
+ }
+
+ /* Start capturer */
+ if (just_created) {
+ status = pjmedia_vid_port_start(w->vp_cap);
+ if (status != PJ_SUCCESS) {
+ pj_log_pop_indent();
+ goto on_error;
+ }
+ }
+
+ /* Done */
+ inc_vid_win(wid);
+ call_med->strm.v.cap_win_id = wid;
+ pj_log_pop_indent();
+ }
+
+ }
+
+ if (!acc->cfg.vid_out_auto_transmit && call_med->strm.v.stream) {
+ status = pjmedia_vid_stream_pause(call_med->strm.v.stream,
+ PJMEDIA_DIR_ENCODING);
+ if (status != PJ_SUCCESS)
+ goto on_error;
+ }
+
+ pj_log_pop_indent();
+ return PJ_SUCCESS;
+
+on_error:
+ pj_log_pop_indent();
+ return status;
+}
+
+
+/* Internal function to stop video stream */
+void pjsua_vid_stop_stream(pjsua_call_media *call_med)
+{
+ pjmedia_vid_stream *strm = call_med->strm.v.stream;
+ pjmedia_rtcp_stat stat;
+
+ pj_assert(call_med->type == PJMEDIA_TYPE_VIDEO);
+
+ if (!strm)
+ return;
+
+ PJ_LOG(4,(THIS_FILE, "Stopping video stream.."));
+ pj_log_push_indent();
+
+ pjmedia_vid_stream_send_rtcp_bye(strm);
+
+ if (call_med->strm.v.cap_win_id != PJSUA_INVALID_ID) {
+ pjmedia_port *media_port;
+ pjsua_vid_win *w = &pjsua_var.win[call_med->strm.v.cap_win_id];
+ pj_status_t status;
+
+ /* Stop the capture before detaching stream and unsubscribing event */
+ pjmedia_vid_port_stop(w->vp_cap);
+
+ /* Disconnect video stream from capture device */
+ status = pjmedia_vid_stream_get_port(call_med->strm.v.stream,
+ PJMEDIA_DIR_ENCODING,
+ &media_port);
+ if (status == PJ_SUCCESS) {
+ pjmedia_vid_tee_remove_dst_port(w->tee, media_port);
+ }
+
+ /* Unsubscribe event */
+ pjmedia_event_unsubscribe(NULL, &call_media_on_event, call_med,
+ w->vp_cap);
+
+ /* Re-start capture again, if it is used by other stream */
+ if (w->ref_cnt > 1)
+ pjmedia_vid_port_start(w->vp_cap);
+
+ dec_vid_win(call_med->strm.v.cap_win_id);
+ call_med->strm.v.cap_win_id = PJSUA_INVALID_ID;
+ }
+
+ if (call_med->strm.v.rdr_win_id != PJSUA_INVALID_ID) {
+ pjsua_vid_win *w = &pjsua_var.win[call_med->strm.v.rdr_win_id];
+
+ /* Stop the render before unsubscribing event */
+ pjmedia_vid_port_stop(w->vp_rend);
+ pjmedia_event_unsubscribe(NULL, &call_media_on_event, call_med,
+ w->vp_rend);
+
+ dec_vid_win(call_med->strm.v.rdr_win_id);
+ call_med->strm.v.rdr_win_id = PJSUA_INVALID_ID;
+ }
+
+ if ((call_med->dir & PJMEDIA_DIR_ENCODING) &&
+ (pjmedia_vid_stream_get_stat(strm, &stat) == PJ_SUCCESS))
+ {
+ /* Save RTP timestamp & sequence, so when media session is
+ * restarted, those values will be restored as the initial
+ * RTP timestamp & sequence of the new media session. So in
+ * the same call session, RTP timestamp and sequence are
+ * guaranteed to be contigue.
+ */
+ call_med->rtp_tx_seq_ts_set = 1 | (1 << 1);
+ call_med->rtp_tx_seq = stat.rtp_tx_last_seq;
+ call_med->rtp_tx_ts = stat.rtp_tx_last_ts;
+ }
+
+ pjmedia_vid_stream_destroy(strm);
+ call_med->strm.v.stream = NULL;
+
+ pj_log_pop_indent();
+}
+
+/*
+ * Does it have built-in preview support.
+ */
+PJ_DEF(pj_bool_t) pjsua_vid_preview_has_native(pjmedia_vid_dev_index id)
+{
+ pjmedia_vid_dev_info vdi;
+
+ return (pjmedia_vid_dev_get_info(id, &vdi)==PJ_SUCCESS) ?
+ ((vdi.caps & PJMEDIA_VID_DEV_CAP_INPUT_PREVIEW)!=0) : PJ_FALSE;
+}
+
+/*
+ * Start video preview window for the specified capture device.
+ */
+PJ_DEF(pj_status_t) pjsua_vid_preview_start(pjmedia_vid_dev_index id,
+ const pjsua_vid_preview_param *prm)
+{
+ pjsua_vid_win_id wid;
+ pjsua_vid_win *w;
+ pjmedia_vid_dev_index rend_id;
+ pjsua_vid_preview_param default_param;
+ pj_status_t status;
+
+ if (!prm) {
+ pjsua_vid_preview_param_default(&default_param);
+ prm = &default_param;
+ }
+
+ PJ_LOG(4,(THIS_FILE, "Starting preview for cap_dev=%d, show=%d",
+ id, prm->show));
+ pj_log_push_indent();
+
+ PJSUA_LOCK();
+
+ rend_id = prm->rend_id;
+
+ status = create_vid_win(PJSUA_WND_TYPE_PREVIEW, NULL, rend_id, id,
+ prm->show, prm->wnd_flags, &wid);
+ if (status != PJ_SUCCESS) {
+ PJSUA_UNLOCK();
+ pj_log_pop_indent();
+ return status;
+ }
+
+ w = &pjsua_var.win[wid];
+ if (w->preview_running) {
+ PJSUA_UNLOCK();
+ pj_log_pop_indent();
+ return PJ_SUCCESS;
+ }
+
+ /* Start renderer, unless it's native preview */
+ if (w->is_native && !pjmedia_vid_port_is_running(w->vp_cap)) {
+ pjmedia_vid_dev_stream *cap_dev;
+ pj_bool_t enabled = PJ_TRUE;
+
+ cap_dev = pjmedia_vid_port_get_stream(w->vp_cap);
+ status = pjmedia_vid_dev_stream_set_cap(
+ cap_dev, PJMEDIA_VID_DEV_CAP_INPUT_PREVIEW,
+ &enabled);
+ if (status != PJ_SUCCESS) {
+ PJ_PERROR(1,(THIS_FILE, status,
+ "Error activating native preview, falling back "
+ "to software preview.."));
+ w->is_native = PJ_FALSE;
+ }
+ }
+
+ if (!w->is_native && !pjmedia_vid_port_is_running(w->vp_rend)) {
+ status = pjmedia_vid_port_start(w->vp_rend);
+ if (status != PJ_SUCCESS) {
+ PJSUA_UNLOCK();
+ pj_log_pop_indent();
+ return status;
+ }
+ }
+
+ /* Start capturer */
+ if (!pjmedia_vid_port_is_running(w->vp_cap)) {
+ status = pjmedia_vid_port_start(w->vp_cap);
+ if (status != PJ_SUCCESS) {
+ PJSUA_UNLOCK();
+ pj_log_pop_indent();
+ return status;
+ }
+ }
+
+ inc_vid_win(wid);
+ w->preview_running = PJ_TRUE;
+
+ PJSUA_UNLOCK();
+ pj_log_pop_indent();
+ return PJ_SUCCESS;
+}
+
+/*
+ * Stop video preview.
+ */
+PJ_DEF(pj_status_t) pjsua_vid_preview_stop(pjmedia_vid_dev_index id)
+{
+ pjsua_vid_win_id wid = PJSUA_INVALID_ID;
+ pjsua_vid_win *w;
+ pj_status_t status;
+
+ PJSUA_LOCK();
+ wid = pjsua_vid_preview_get_win(id);
+ if (wid == PJSUA_INVALID_ID) {
+ PJSUA_UNLOCK();
+ pj_log_pop_indent();
+ return PJ_ENOTFOUND;
+ }
+
+ PJ_LOG(4,(THIS_FILE, "Stopping preview for cap_dev=%d", id));
+ pj_log_push_indent();
+
+ w = &pjsua_var.win[wid];
+ if (w->preview_running) {
+ if (w->is_native) {
+ pjmedia_vid_dev_stream *cap_dev;
+ pj_bool_t enabled = PJ_FALSE;
+
+ cap_dev = pjmedia_vid_port_get_stream(w->vp_cap);
+ status = pjmedia_vid_dev_stream_set_cap(
+ cap_dev, PJMEDIA_VID_DEV_CAP_INPUT_PREVIEW,
+ &enabled);
+ } else {
+ status = pjmedia_vid_port_stop(w->vp_rend);
+ }
+
+ if (status != PJ_SUCCESS) {
+ PJ_PERROR(1,(THIS_FILE, status, "Error stopping %spreview",
+ (w->is_native ? "native " : "")));
+ PJSUA_UNLOCK();
+ pj_log_pop_indent();
+ return status;
+ }
+
+ dec_vid_win(wid);
+ w->preview_running = PJ_FALSE;
+ }
+
+ PJSUA_UNLOCK();
+ pj_log_pop_indent();
+
+ return PJ_SUCCESS;
+}
+
+
+/*****************************************************************************
+ * Window
+ */
+
+
+/*
+ * Enumerates all video windows.
+ */
+PJ_DEF(pj_status_t) pjsua_vid_enum_wins( pjsua_vid_win_id wids[],
+ unsigned *count)
+{
+ unsigned i, cnt;
+
+ cnt = 0;
+
+ for (i=0; i<PJSUA_MAX_VID_WINS && cnt <*count; ++i) {
+ pjsua_vid_win *w = &pjsua_var.win[i];
+ if (w->type != PJSUA_WND_TYPE_NONE)
+ wids[cnt++] = i;
+ }
+
+ *count = cnt;
+
+ return PJ_SUCCESS;
+}
+
+
+/*
+ * Get window info.
+ */
+PJ_DEF(pj_status_t) pjsua_vid_win_get_info( pjsua_vid_win_id wid,
+ pjsua_vid_win_info *wi)
+{
+ pjsua_vid_win *w;
+ pjmedia_vid_dev_stream *s;
+ pjmedia_vid_dev_param vparam;
+ pj_status_t status;
+
+ PJ_ASSERT_RETURN(wid >= 0 && wid < PJSUA_MAX_VID_WINS && wi, PJ_EINVAL);
+
+ pj_bzero(wi, sizeof(*wi));
+
+ PJSUA_LOCK();
+ w = &pjsua_var.win[wid];
+
+ wi->is_native = w->is_native;
+
+ if (w->is_native) {
+ pjmedia_vid_dev_stream *cap_strm;
+ pjmedia_vid_dev_cap cap = PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW;
+
+ cap_strm = pjmedia_vid_port_get_stream(w->vp_cap);
+ if (!cap_strm) {
+ status = PJ_EINVAL;
+ } else {
+ status = pjmedia_vid_dev_stream_get_cap(cap_strm, cap, &wi->hwnd);
+ }
+
+ PJSUA_UNLOCK();
+ return status;
+ }
+
+ if (w->vp_rend == NULL) {
+ PJSUA_UNLOCK();
+ return PJ_EINVAL;
+ }
+
+ s = pjmedia_vid_port_get_stream(w->vp_rend);
+ if (s == NULL) {
+ PJSUA_UNLOCK();
+ return PJ_EINVAL;
+ }
+
+ status = pjmedia_vid_dev_stream_get_param(s, &vparam);
+ if (status != PJ_SUCCESS) {
+ PJSUA_UNLOCK();
+ return status;
+ }
+
+ wi->rdr_dev = vparam.rend_id;
+ wi->hwnd = vparam.window;
+ wi->show = !vparam.window_hide;
+ wi->pos = vparam.window_pos;
+ wi->size = vparam.disp_size;
+
+ PJSUA_UNLOCK();
+
+ return PJ_SUCCESS;
+}
+
+/*
+ * Show or hide window.
+ */
+PJ_DEF(pj_status_t) pjsua_vid_win_set_show( pjsua_vid_win_id wid,
+ pj_bool_t show)
+{
+ pjsua_vid_win *w;
+ pjmedia_vid_dev_stream *s;
+ pj_bool_t hide;
+ pj_status_t status;
+
+ PJ_ASSERT_RETURN(wid >= 0 && wid < PJSUA_MAX_VID_WINS, PJ_EINVAL);
+
+ PJSUA_LOCK();
+ w = &pjsua_var.win[wid];
+ if (w->vp_rend == NULL) {
+ /* Native window */
+ PJSUA_UNLOCK();
+ return PJ_EINVAL;
+ }
+
+ s = pjmedia_vid_port_get_stream(w->vp_rend);
+ if (s == NULL) {
+ PJSUA_UNLOCK();
+ return PJ_EINVAL;
+ }
+
+ /* Make sure that renderer gets started before shown up */
+ if (show && !pjmedia_vid_port_is_running(w->vp_rend))
+ status = pjmedia_vid_port_start(w->vp_rend);
+
+ hide = !show;
+ status = pjmedia_vid_dev_stream_set_cap(s,
+ PJMEDIA_VID_DEV_CAP_OUTPUT_HIDE, &hide);
+
+ PJSUA_UNLOCK();
+
+ return status;
+}
+
+/*
+ * Set video window position.
+ */
+PJ_DEF(pj_status_t) pjsua_vid_win_set_pos( pjsua_vid_win_id wid,
+ const pjmedia_coord *pos)
+{
+ pjsua_vid_win *w;
+ pjmedia_vid_dev_stream *s;
+ pj_status_t status;
+
+ PJ_ASSERT_RETURN(wid >= 0 && wid < PJSUA_MAX_VID_WINS && pos, PJ_EINVAL);
+
+ PJSUA_LOCK();
+ w = &pjsua_var.win[wid];
+ if (w->vp_rend == NULL) {
+ /* Native window */
+ PJSUA_UNLOCK();
+ return PJ_EINVAL;
+ }
+
+ s = pjmedia_vid_port_get_stream(w->vp_rend);
+ if (s == NULL) {
+ PJSUA_UNLOCK();
+ return PJ_EINVAL;
+ }
+
+ status = pjmedia_vid_dev_stream_set_cap(s,
+ PJMEDIA_VID_DEV_CAP_OUTPUT_POSITION, pos);
+
+ PJSUA_UNLOCK();
+
+ return status;
+}
+
+/*
+ * Resize window.
+ */
+PJ_DEF(pj_status_t) pjsua_vid_win_set_size( pjsua_vid_win_id wid,
+ const pjmedia_rect_size *size)
+{
+ pjsua_vid_win *w;
+ pjmedia_vid_dev_stream *s;
+ pj_status_t status;
+
+ PJ_ASSERT_RETURN(wid >= 0 && wid < PJSUA_MAX_VID_WINS && size, PJ_EINVAL);
+
+ PJSUA_LOCK();
+ w = &pjsua_var.win[wid];
+ if (w->vp_rend == NULL) {
+ /* Native window */
+ PJSUA_UNLOCK();
+ return PJ_EINVAL;
+ }
+
+ s = pjmedia_vid_port_get_stream(w->vp_rend);
+ if (s == NULL) {
+ PJSUA_UNLOCK();
+ return PJ_EINVAL;
+ }
+
+ status = pjmedia_vid_dev_stream_set_cap(s,
+ PJMEDIA_VID_DEV_CAP_OUTPUT_RESIZE, size);
+
+ PJSUA_UNLOCK();
+
+ return status;
+}
+
+/*
+ * Set video orientation.
+ */
+PJ_DEF(pj_status_t) pjsua_vid_win_rotate( pjsua_vid_win_id wid,
+ int angle)
+{
+ pjsua_vid_win *w;
+ pjmedia_vid_dev_stream *s;
+ pjmedia_orient orient;
+ pj_status_t status;
+
+ PJ_ASSERT_RETURN(wid >= 0 && wid < PJSUA_MAX_VID_WINS, PJ_EINVAL);
+ PJ_ASSERT_RETURN((angle % 90) == 0, PJ_EINVAL);
+
+ /* Normalize angle, so it must be 0, 90, 180, or 270. */
+ angle %= 360;
+ if (angle < 0)
+ angle += 360;
+
+ /* Convert angle to pjmedia_orient */
+ switch(angle) {
+ case 0:
+ /* No rotation */
+ return PJ_SUCCESS;
+ case 90:
+ orient = PJMEDIA_ORIENT_ROTATE_90DEG;
+ break;
+ case 180:
+ orient = PJMEDIA_ORIENT_ROTATE_180DEG;
+ break;
+ case 270:
+ orient = PJMEDIA_ORIENT_ROTATE_270DEG;
+ break;
+ default:
+ pj_assert(!"Angle must have been validated");
+ return PJ_EBUG;
+ }
+
+ PJSUA_LOCK();
+ w = &pjsua_var.win[wid];
+ if (w->vp_rend == NULL) {
+ /* Native window */
+ PJSUA_UNLOCK();
+ return PJ_EINVAL;
+ }
+
+ s = pjmedia_vid_port_get_stream(w->vp_rend);
+ if (s == NULL) {
+ PJSUA_UNLOCK();
+ return PJ_EINVAL;
+ }
+
+ status = pjmedia_vid_dev_stream_set_cap(s,
+ PJMEDIA_VID_DEV_CAP_ORIENTATION, &orient);
+
+ PJSUA_UNLOCK();
+
+ return status;
+}
+
+
+static void call_get_vid_strm_info(pjsua_call *call,
+ int *first_active,
+ int *first_inactive,
+ unsigned *active_cnt,
+ unsigned *cnt)
+{
+ unsigned i, var_cnt = 0;
+
+ if (first_active && ++var_cnt)
+ *first_active = -1;
+ if (first_inactive && ++var_cnt)
+ *first_inactive = -1;
+ if (active_cnt && ++var_cnt)
+ *active_cnt = 0;
+ if (cnt && ++var_cnt)
+ *cnt = 0;
+
+ for (i = 0; i < call->med_cnt && var_cnt; ++i) {
+ if (call->media[i].type == PJMEDIA_TYPE_VIDEO) {
+ if (call->media[i].dir != PJMEDIA_DIR_NONE)
+ {
+ if (first_active && *first_active == -1) {
+ *first_active = i;
+ --var_cnt;
+ }
+ if (active_cnt)
+ ++(*active_cnt);
+ } else if (first_inactive && *first_inactive == -1) {
+ *first_inactive = i;
+ --var_cnt;
+ }
+ if (cnt)
+ ++(*cnt);
+ }
+ }
+}
+
+
+/* Send SDP reoffer. */
+static pj_status_t call_reoffer_sdp(pjsua_call_id call_id,
+ const pjmedia_sdp_session *sdp)
+{
+ pjsua_call *call;
+ pjsip_tx_data *tdata;
+ pjsip_dialog *dlg;
+ pj_status_t status;
+
+ status = acquire_call("call_reoffer_sdp()", call_id, &call, &dlg);
+ if (status != PJ_SUCCESS)
+ return status;
+
+ if (call->inv->state != PJSIP_INV_STATE_CONFIRMED) {
+ PJ_LOG(3,(THIS_FILE, "Can not re-INVITE call that is not confirmed"));
+ pjsip_dlg_dec_lock(dlg);
+ return PJSIP_ESESSIONSTATE;
+ }
+
+ /* Create re-INVITE with new offer */
+ status = pjsip_inv_reinvite( call->inv, NULL, sdp, &tdata);
+ if (status != PJ_SUCCESS) {
+ pjsua_perror(THIS_FILE, "Unable to create re-INVITE", status);
+ pjsip_dlg_dec_lock(dlg);
+ return status;
+ }
+
+ /* Send the request */
+ status = pjsip_inv_send_msg( call->inv, tdata);
+ if (status != PJ_SUCCESS) {
+ pjsua_perror(THIS_FILE, "Unable to send re-INVITE", status);
+ pjsip_dlg_dec_lock(dlg);
+ return status;
+ }
+
+ pjsip_dlg_dec_lock(dlg);
+
+ return PJ_SUCCESS;
+}
+
+/* Add a new video stream into a call */
+static pj_status_t call_add_video(pjsua_call *call,
+ pjmedia_vid_dev_index cap_dev,
+ pjmedia_dir dir)
+{
+ pj_pool_t *pool = call->inv->pool_prov;
+ pjsua_acc_config *acc_cfg = &pjsua_var.acc[call->acc_id].cfg;
+ pjsua_call_media *call_med;
+ const pjmedia_sdp_session *current_sdp;
+ pjmedia_sdp_session *sdp;
+ pjmedia_sdp_media *sdp_m;
+ pjmedia_transport_info tpinfo;
+ pj_status_t status;
+
+ /* Verify media slot availability */
+ if (call->med_cnt == PJSUA_MAX_CALL_MEDIA)
+ return PJ_ETOOMANY;
+
+ /* Get active local SDP and clone it */
+ status = pjmedia_sdp_neg_get_active_local(call->inv->neg, ¤t_sdp);
+ if (status != PJ_SUCCESS)
+ return status;
+
+ sdp = pjmedia_sdp_session_clone(call->inv->pool_prov, current_sdp);
+
+ /* Clean up provisional media before using it */
+ pjsua_media_prov_clean_up(call->index);
+
+ /* Update provisional media from call media */
+ call->med_prov_cnt = call->med_cnt;
+ pj_memcpy(call->media_prov, call->media,
+ sizeof(call->media[0]) * call->med_cnt);
+
+ /* Initialize call media */
+ call_med = &call->media_prov[call->med_prov_cnt++];
+ status = pjsua_call_media_init(call_med, PJMEDIA_TYPE_VIDEO,
+ &acc_cfg->rtp_cfg, call->secure_level,
+ NULL, PJ_FALSE, NULL);
+ if (status != PJ_SUCCESS)
+ goto on_error;
+
+ /* Override default capture device setting */
+ call_med->strm.v.cap_dev = cap_dev;
+
+ /* Init transport media */
+ status = pjmedia_transport_media_create(call_med->tp, pool, 0,
+ NULL, call_med->idx);
+ if (status != PJ_SUCCESS)
+ goto on_error;
+
+ pjsua_set_media_tp_state(call_med, PJSUA_MED_TP_INIT);
+
+ /* Get transport address info */
+ pjmedia_transport_info_init(&tpinfo);
+ pjmedia_transport_get_info(call_med->tp, &tpinfo);
+
+ /* Create SDP media line */
+ status = pjmedia_endpt_create_video_sdp(pjsua_var.med_endpt, pool,
+ &tpinfo.sock_info, 0, &sdp_m);
+ if (status != PJ_SUCCESS)
+ goto on_error;
+
+ sdp->media[sdp->media_count++] = sdp_m;
+
+ /* Update media direction, if it is not 'sendrecv' */
+ if (dir != PJMEDIA_DIR_ENCODING_DECODING) {
+ pjmedia_sdp_attr *a;
+
+ /* Remove sendrecv direction attribute, if any */
+ pjmedia_sdp_media_remove_all_attr(sdp_m, "sendrecv");
+
+ if (dir == PJMEDIA_DIR_ENCODING)
+ a = pjmedia_sdp_attr_create(pool, "sendonly", NULL);
+ else if (dir == PJMEDIA_DIR_DECODING)
+ a = pjmedia_sdp_attr_create(pool, "recvonly", NULL);
+ else
+ a = pjmedia_sdp_attr_create(pool, "inactive", NULL);
+
+ pjmedia_sdp_media_add_attr(sdp_m, a);
+ }
+
+ /* Update SDP media line by media transport */
+ status = pjmedia_transport_encode_sdp(call_med->tp, pool,
+ sdp, NULL, call_med->idx);
+ if (status != PJ_SUCCESS)
+ goto on_error;
+
+ status = call_reoffer_sdp(call->index, sdp);
+ if (status != PJ_SUCCESS)
+ goto on_error;
+
+ call->opt.vid_cnt++;
+
+ return PJ_SUCCESS;
+
+on_error:
+ if (call_med->tp) {
+ pjsua_set_media_tp_state(call_med, PJSUA_MED_TP_NULL);
+ pjmedia_transport_close(call_med->tp);
+ call_med->tp = call_med->tp_orig = NULL;
+ }
+
+ return status;
+}
+
+
+/* Modify a video stream from a call, i.e: update direction,
+ * remove/disable.
+ */
+static pj_status_t call_modify_video(pjsua_call *call,
+ int med_idx,
+ pjmedia_dir dir,
+ pj_bool_t remove)
+{
+ pjsua_call_media *call_med;
+ const pjmedia_sdp_session *current_sdp;
+ pjmedia_sdp_session *sdp;
+ pj_status_t status;
+
+ /* Verify and normalize media index */
+ if (med_idx == -1) {
+ int first_active;
+
+ call_get_vid_strm_info(call, &first_active, NULL, NULL, NULL);
+ if (first_active == -1)
+ return PJ_ENOTFOUND;
+
+ med_idx = first_active;
+ }
+
+ /* Clean up provisional media before using it */
+ pjsua_media_prov_clean_up(call->index);
+
+ /* Update provisional media from call media */
+ call->med_prov_cnt = call->med_cnt;
+ pj_memcpy(call->media_prov, call->media,
+ sizeof(call->media[0]) * call->med_cnt);
+
+ call_med = &call->media_prov[med_idx];
+
+ /* Verify if the stream media type is video */
+ if (call_med->type != PJMEDIA_TYPE_VIDEO)
+ return PJ_EINVAL;
+
+ /* Verify if the stream dir is not changed */
+ if ((!remove && call_med->dir == dir) ||
+ ( remove && (call_med->tp_st == PJSUA_MED_TP_DISABLED ||
+ call_med->tp == NULL)))
+ {
+ return PJ_SUCCESS;
+ }
+
+ /* Get active local SDP and clone it */
+ status = pjmedia_sdp_neg_get_active_local(call->inv->neg, ¤t_sdp);
+ if (status != PJ_SUCCESS)
+ return status;
+
+ sdp = pjmedia_sdp_session_clone(call->inv->pool_prov, current_sdp);
+
+ pj_assert(med_idx < (int)sdp->media_count);
+
+ if (!remove) {
+ pjsua_acc_config *acc_cfg = &pjsua_var.acc[call->acc_id].cfg;
+ pj_pool_t *pool = call->inv->pool_prov;
+ pjmedia_sdp_media *sdp_m;
+
+ /* Enabling video */
+ if (call_med->dir == PJMEDIA_DIR_NONE) {
+ unsigned i, vid_cnt = 0;
+
+ /* Check if vid_cnt in call option needs to be increased */
+ for (i = 0; i < call->med_cnt; ++i) {
+ if (call->media[i].type == PJMEDIA_TYPE_VIDEO &&
+ call->media[i].dir != PJMEDIA_DIR_NONE)
+ {
+ ++vid_cnt;
+ }
+ }
+ if (call->opt.vid_cnt <= vid_cnt)
+ call->opt.vid_cnt++;
+ }
+
+ status = pjsua_call_media_init(call_med, PJMEDIA_TYPE_VIDEO,
+ &acc_cfg->rtp_cfg, call->secure_level,
+ NULL, PJ_FALSE, NULL);
+ if (status != PJ_SUCCESS)
+ goto on_error;
+
+ /* Init transport media */
+ if (call_med->tp && call_med->tp_st == PJSUA_MED_TP_IDLE) {
+ status = pjmedia_transport_media_create(call_med->tp, pool, 0,
+ NULL, call_med->idx);
+ if (status != PJ_SUCCESS)
+ goto on_error;
+ }
+
+ sdp_m = sdp->media[med_idx];
+
+ /* Create new SDP media line if the stream is disabled */
+ if (sdp->media[med_idx]->desc.port == 0) {
+ pjmedia_transport_info tpinfo;
+
+ /* Get transport address info */
+ pjmedia_transport_info_init(&tpinfo);
+ pjmedia_transport_get_info(call_med->tp, &tpinfo);
+
+ status = pjmedia_endpt_create_video_sdp(pjsua_var.med_endpt, pool,
+ &tpinfo.sock_info, 0, &sdp_m);
+ if (status != PJ_SUCCESS)
+ goto on_error;
+ }
+
+ {
+ pjmedia_sdp_attr *a;
+
+ /* Remove any direction attributes */
+ pjmedia_sdp_media_remove_all_attr(sdp_m, "sendrecv");
+ pjmedia_sdp_media_remove_all_attr(sdp_m, "sendonly");
+ pjmedia_sdp_media_remove_all_attr(sdp_m, "recvonly");
+ pjmedia_sdp_media_remove_all_attr(sdp_m, "inactive");
+
+ /* Update media direction */
+ if (dir == PJMEDIA_DIR_ENCODING_DECODING)
+ a = pjmedia_sdp_attr_create(pool, "sendrecv", NULL);
+ else if (dir == PJMEDIA_DIR_ENCODING)
+ a = pjmedia_sdp_attr_create(pool, "sendonly", NULL);
+ else if (dir == PJMEDIA_DIR_DECODING)
+ a = pjmedia_sdp_attr_create(pool, "recvonly", NULL);
+ else
+ a = pjmedia_sdp_attr_create(pool, "inactive", NULL);
+
+ pjmedia_sdp_media_add_attr(sdp_m, a);
+ }
+
+ sdp->media[med_idx] = sdp_m;
+
+ if (call_med->dir == PJMEDIA_DIR_NONE) {
+ /* Update SDP media line by media transport */
+ status = pjmedia_transport_encode_sdp(call_med->tp, pool,
+ sdp, NULL, call_med->idx);
+ if (status != PJ_SUCCESS)
+ goto on_error;
+ }
+
+on_error:
+ if (status != PJ_SUCCESS) {
+ pjsua_media_prov_clean_up(call->index);
+ return status;
+ }
+
+ } else {
+
+ pj_pool_t *pool = call->inv->pool_prov;
+
+ /* Mark media transport to disabled */
+ // Don't close this here, as SDP negotiation has not been
+ // done and stream may be still active.
+ pjsua_set_media_tp_state(call_med, PJSUA_MED_TP_DISABLED);
+
+ /* Deactivate the stream */
+ pjmedia_sdp_media_deactivate(pool, sdp->media[med_idx]);
+
+ call->opt.vid_cnt--;
+ }
+
+ status = call_reoffer_sdp(call->index, sdp);
+ if (status != PJ_SUCCESS)
+ return status;
+
+ return PJ_SUCCESS;
+}
+
+
+/* Change capture device of a video stream in a call */
+static pj_status_t call_change_cap_dev(pjsua_call *call,
+ int med_idx,
+ pjmedia_vid_dev_index cap_dev)
+{
+ pjsua_call_media *call_med;
+ pjmedia_vid_dev_stream *old_dev;
+ pjmedia_vid_dev_switch_param switch_prm;
+ pjmedia_vid_dev_info info;
+ pjsua_vid_win *w, *new_w = NULL;
+ pjsua_vid_win_id wid, new_wid;
+ pjmedia_port *media_port;
+ pj_status_t status;
+
+ /* Verify and normalize media index */
+ if (med_idx == -1) {
+ int first_active;
+
+ call_get_vid_strm_info(call, &first_active, NULL, NULL, NULL);
+ if (first_active == -1)
+ return PJ_ENOTFOUND;
+
+ med_idx = first_active;
+ }
+
+ call_med = &call->media[med_idx];
+
+ /* Verify if the stream media type is video */
+ if (call_med->type != PJMEDIA_TYPE_VIDEO)
+ return PJ_EINVAL;
+
+ /* Verify the capture device */
+ status = pjmedia_vid_dev_get_info(cap_dev, &info);
+ if (status != PJ_SUCCESS || info.dir != PJMEDIA_DIR_CAPTURE)
+ return PJ_EINVAL;
+
+ /* The specified capture device is being used already */
+ if (call_med->strm.v.cap_dev == cap_dev)
+ return PJ_SUCCESS;
+
+ /* == Apply the new capture device == */
+
+ wid = call_med->strm.v.cap_win_id;
+ w = &pjsua_var.win[wid];
+ pj_assert(w->type == PJSUA_WND_TYPE_PREVIEW && w->vp_cap);
+
+ /* If the old device supports fast switching, then that's excellent! */
+ old_dev = pjmedia_vid_port_get_stream(w->vp_cap);
+ pjmedia_vid_dev_switch_param_default(&switch_prm);
+ switch_prm.target_id = cap_dev;
+ status = pjmedia_vid_dev_stream_set_cap(old_dev,
+ PJMEDIA_VID_DEV_CAP_SWITCH,
+ &switch_prm);
+ if (status == PJ_SUCCESS) {
+ w->preview_cap_id = cap_dev;
+ call_med->strm.v.cap_dev = cap_dev;
+ return PJ_SUCCESS;
+ }
+
+ /* No it doesn't support fast switching. Do slow switching then.. */
+ status = pjmedia_vid_stream_get_port(call_med->strm.v.stream,
+ PJMEDIA_DIR_ENCODING, &media_port);
+ if (status != PJ_SUCCESS)
+ return status;
+
+ pjmedia_event_unsubscribe(NULL, &call_media_on_event, call_med,
+ w->vp_cap);
+
+ /* temporarily disconnect while we operate on the tee. */
+ pjmedia_vid_port_disconnect(w->vp_cap);
+
+ /* = Detach stream port from the old capture device's tee = */
+ status = pjmedia_vid_tee_remove_dst_port(w->tee, media_port);
+ if (status != PJ_SUCCESS) {
+ /* Something wrong, assume that media_port has been removed
+ * and continue.
+ */
+ PJ_PERROR(4,(THIS_FILE, status,
+ "Warning: call %d: unable to remove video from tee",
+ call->index));
+ }
+
+ /* Reconnect again immediately. We're done with w->tee */
+ pjmedia_vid_port_connect(w->vp_cap, w->tee, PJ_FALSE);
+
+ /* = Attach stream port to the new capture device = */
+
+ /* Note: calling pjsua_vid_preview_get_win() even though
+ * create_vid_win() will automatically create the window
+ * if it doesn't exist, because create_vid_win() will modify
+ * existing window SHOW/HIDE value.
+ */
+ new_wid = vid_preview_get_win(cap_dev, PJ_FALSE);
+ if (new_wid == PJSUA_INVALID_ID) {
+ pjsua_acc *acc = &pjsua_var.acc[call_med->call->acc_id];
+
+ /* Create preview video window */
+ status = create_vid_win(PJSUA_WND_TYPE_PREVIEW,
+ &media_port->info.fmt,
+ call_med->strm.v.rdr_dev,
+ cap_dev,
+ PJSUA_HIDE_WINDOW,
+ acc->cfg.vid_wnd_flags,
+ &new_wid);
+ if (status != PJ_SUCCESS)
+ goto on_error;
+ }
+
+ inc_vid_win(new_wid);
+ new_w = &pjsua_var.win[new_wid];
+
+ /* Connect stream to capturer (via video window tee) */
+ status = pjmedia_vid_tee_add_dst_port2(new_w->tee, 0, media_port);
+ if (status != PJ_SUCCESS)
+ goto on_error;
+
+ if (w->vp_rend) {
+ /* Start renderer */
+ status = pjmedia_vid_port_start(new_w->vp_rend);
+ if (status != PJ_SUCCESS)
+ goto on_error;
+ }
+
+#if ENABLE_EVENT
+ pjmedia_event_subscribe(NULL, &call_media_on_event,
+ call_med, new_w->vp_cap);
+#endif
+
+ /* Start capturer */
+ if (!pjmedia_vid_port_is_running(new_w->vp_cap)) {
+ status = pjmedia_vid_port_start(new_w->vp_cap);
+ if (status != PJ_SUCCESS)
+ goto on_error;
+ }
+
+ /* Finally */
+ call_med->strm.v.cap_dev = cap_dev;
+ call_med->strm.v.cap_win_id = new_wid;
+ dec_vid_win(wid);
+
+ return PJ_SUCCESS;
+
+on_error:
+ PJ_PERROR(4,(THIS_FILE, status,
+ "Call %d: error changing capture device to %d",
+ call->index, cap_dev));
+
+ if (new_w) {
+ /* Unsubscribe, just in case */
+ pjmedia_event_unsubscribe(NULL, &call_media_on_event, call_med,
+ new_w->vp_cap);
+ /* Disconnect media port from the new capturer */
+ pjmedia_vid_tee_remove_dst_port(new_w->tee, media_port);
+ /* Release the new capturer */
+ dec_vid_win(new_wid);
+ }
+
+ /* Revert back to the old capturer */
+ pjmedia_vid_port_disconnect(w->vp_cap);
+ status = pjmedia_vid_tee_add_dst_port2(w->tee, 0, media_port);
+ pjmedia_vid_port_connect(w->vp_cap, w->tee, PJ_FALSE);
+ if (status != PJ_SUCCESS)
+ return status;
+
+#if ENABLE_EVENT
+ /* Resubscribe */
+ pjmedia_event_subscribe(NULL, &call_media_on_event,
+ call_med, w->vp_cap);
+#endif
+
+ return status;
+}
+
+
+/* Start/stop transmitting video stream in a call */
+static pj_status_t call_set_tx_video(pjsua_call *call,
+ int med_idx,
+ pj_bool_t enable)
+{
+ pjsua_call_media *call_med;
+ pj_status_t status;
+
+ /* Verify and normalize media index */
+ if (med_idx == -1) {
+ int first_active;
+
+ call_get_vid_strm_info(call, &first_active, NULL, NULL, NULL);
+ if (first_active == -1)
+ return PJ_ENOTFOUND;
+
+ med_idx = first_active;
+ }
+
+ call_med = &call->media[med_idx];
+
+ /* Verify if the stream is transmitting video */
+ if (call_med->type != PJMEDIA_TYPE_VIDEO ||
+ (enable && (call_med->dir & PJMEDIA_DIR_ENCODING) == 0))
+ {
+ return PJ_EINVAL;
+ }
+
+ if (enable) {
+ /* Start stream in encoding direction */
+ status = pjmedia_vid_stream_resume(call_med->strm.v.stream,
+ PJMEDIA_DIR_ENCODING);
+ } else {
+ /* Pause stream in encoding direction */
+ status = pjmedia_vid_stream_pause( call_med->strm.v.stream,
+ PJMEDIA_DIR_ENCODING);
+ }
+
+ return status;
+}
+
+
+static pj_status_t call_send_vid_keyframe(pjsua_call *call,
+ int med_idx)
+{
+ pjsua_call_media *call_med;
+
+ /* Verify and normalize media index */
+ if (med_idx == -1) {
+ int first_active;
+
+ call_get_vid_strm_info(call, &first_active, NULL, NULL, NULL);
+ if (first_active == -1)
+ return PJ_ENOTFOUND;
+
+ med_idx = first_active;
+ }
+
+ call_med = &call->media[med_idx];
+
+ /* Verify media type and stream instance. */
+ if (call_med->type != PJMEDIA_TYPE_VIDEO || !call_med->strm.v.stream)
+ return PJ_EINVAL;
+
+ return pjmedia_vid_stream_send_keyframe(call_med->strm.v.stream);
+}
+
+
+/*
+ * Start, stop, and/or manipulate video transmission for the specified call.
+ */
+PJ_DEF(pj_status_t) pjsua_call_set_vid_strm (
+ pjsua_call_id call_id,
+ pjsua_call_vid_strm_op op,
+ const pjsua_call_vid_strm_op_param *param)
+{
+ pjsua_call *call;
+ pjsip_dialog *dlg = NULL;
+ pjsua_call_vid_strm_op_param param_;
+ pj_status_t status;
+
+ PJ_ASSERT_RETURN(call_id>=0 && call_id<(int)pjsua_var.ua_cfg.max_calls,
+ PJ_EINVAL);
+ PJ_ASSERT_RETURN(op != PJSUA_CALL_VID_STRM_NO_OP, PJ_EINVAL);
+
+ PJ_LOG(4,(THIS_FILE, "Call %d: set video stream, op=%d",
+ call_id, op));
+ pj_log_push_indent();
+
+ status = acquire_call("pjsua_call_set_vid_strm()", call_id, &call, &dlg);
+ if (status != PJ_SUCCESS)
+ goto on_return;
+
+ if (param) {
+ param_ = *param;
+ } else {
+ pjsua_call_vid_strm_op_param_default(¶m_);
+ }
+
+ /* If set to PJMEDIA_VID_DEFAULT_CAPTURE_DEV, replace it with
+ * account default video capture device.
+ */
+ if (param_.cap_dev == PJMEDIA_VID_DEFAULT_CAPTURE_DEV) {
+ pjsua_acc_config *acc_cfg = &pjsua_var.acc[call->acc_id].cfg;
+ param_.cap_dev = acc_cfg->vid_cap_dev;
+
+ /* If the account default video capture device is
+ * PJMEDIA_VID_DEFAULT_CAPTURE_DEV, replace it with
+ * global default video capture device.
+ */
+ if (param_.cap_dev == PJMEDIA_VID_DEFAULT_CAPTURE_DEV) {
+ pjmedia_vid_dev_info info;
+ pjmedia_vid_dev_get_info(param_.cap_dev, &info);
+ pj_assert(info.dir == PJMEDIA_DIR_CAPTURE);
+ param_.cap_dev = info.id;
+ }
+ }
+
+ switch (op) {
+ case PJSUA_CALL_VID_STRM_ADD:
+ status = call_add_video(call, param_.cap_dev, param_.dir);
+ break;
+ case PJSUA_CALL_VID_STRM_REMOVE:
+ status = call_modify_video(call, param_.med_idx, PJMEDIA_DIR_NONE,
+ PJ_TRUE);
+ break;
+ case PJSUA_CALL_VID_STRM_CHANGE_DIR:
+ status = call_modify_video(call, param_.med_idx, param_.dir, PJ_FALSE);
+ break;
+ case PJSUA_CALL_VID_STRM_CHANGE_CAP_DEV:
+ status = call_change_cap_dev(call, param_.med_idx, param_.cap_dev);
+ break;
+ case PJSUA_CALL_VID_STRM_START_TRANSMIT:
+ status = call_set_tx_video(call, param_.med_idx, PJ_TRUE);
+ break;
+ case PJSUA_CALL_VID_STRM_STOP_TRANSMIT:
+ status = call_set_tx_video(call, param_.med_idx, PJ_FALSE);
+ break;
+ case PJSUA_CALL_VID_STRM_SEND_KEYFRAME:
+ status = call_send_vid_keyframe(call, param_.med_idx);
+ break;
+ default:
+ status = PJ_EINVALIDOP;
+ break;
+ }
+
+on_return:
+ if (dlg) pjsip_dlg_dec_lock(dlg);
+ pj_log_pop_indent();
+ return status;
+}
+
+
+/*
+ * Get the media stream index of the default video stream in the call.
+ */
+PJ_DEF(int) pjsua_call_get_vid_stream_idx(pjsua_call_id call_id)
+{
+ pjsua_call *call;
+ int first_active, first_inactive;
+
+ PJ_ASSERT_RETURN(call_id>=0 && call_id<(int)pjsua_var.ua_cfg.max_calls,
+ PJ_EINVAL);
+
+ PJSUA_LOCK();
+ call = &pjsua_var.calls[call_id];
+ call_get_vid_strm_info(call, &first_active, &first_inactive, NULL, NULL);
+ PJSUA_UNLOCK();
+
+ if (first_active == -1)
+ return first_inactive;
+
+ return first_active;
+}
+
+
+/*
+ * Determine if video stream for the specified call is currently running
+ * for the specified direction.
+ */
+PJ_DEF(pj_bool_t) pjsua_call_vid_stream_is_running( pjsua_call_id call_id,
+ int med_idx,
+ pjmedia_dir dir)
+{
+ pjsua_call *call;
+ pjsua_call_media *call_med;
+
+ PJ_ASSERT_RETURN(call_id>=0 && call_id<(int)pjsua_var.ua_cfg.max_calls,
+ PJ_EINVAL);
+
+ /* Verify and normalize media index */
+ if (med_idx == -1) {
+ med_idx = pjsua_call_get_vid_stream_idx(call_id);
+ }
+
+ call = &pjsua_var.calls[call_id];
+ PJ_ASSERT_RETURN(med_idx >= 0 && med_idx < (int)call->med_cnt, PJ_EINVAL);
+
+ call_med = &call->media[med_idx];
+
+ /* Verify if the stream is transmitting video */
+ if (call_med->type != PJMEDIA_TYPE_VIDEO || (call_med->dir & dir) == 0 ||
+ !call_med->strm.v.stream)
+ {
+ return PJ_FALSE;
+ }
+
+ return pjmedia_vid_stream_is_running(call_med->strm.v.stream, dir);
+}
+
+#endif /* PJSUA_HAS_VIDEO */
+
+#endif /* PJSUA_MEDIA_HAS_PJMEDIA */
diff --git a/jni/pjproject-android/.svn/pristine/cb/cb4521d06bd4f397854ef12b1941873241e56541.svn-base b/jni/pjproject-android/.svn/pristine/cb/cb4521d06bd4f397854ef12b1941873241e56541.svn-base
new file mode 100644
index 0000000..2f5da2e
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/cb/cb4521d06bd4f397854ef12b1941873241e56541.svn-base
@@ -0,0 +1,32 @@
+/* $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_UA_H__
+#define __PJSIP_UA_H__
+
+#include <pjsip-ua/sip_inv.h>
+#include <pjsip-ua/sip_regc.h>
+#include <pjsip-ua/sip_replaces.h>
+#include <pjsip-ua/sip_xfer.h>
+#include <pjsip-ua/sip_100rel.h>
+#include <pjsip-ua/sip_timer.h>
+
+
+#endif /* __PJSIP_UA_H__ */
+
diff --git a/jni/pjproject-android/.svn/pristine/cb/cb4b07769a0aeb4c169208ed605d504f4be00142.svn-base b/jni/pjproject-android/.svn/pristine/cb/cb4b07769a0aeb4c169208ed605d504f4be00142.svn-base
new file mode 100644
index 0000000..6bdda92
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/cb/cb4b07769a0aeb4c169208ed605d504f4be00142.svn-base
@@ -0,0 +1,28 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+# In this case the video codec uses dynamic payload type
+sdp = \
+"""
+v=0
+o=- 0 0 IN IP4 127.0.0.1
+s=-
+c=IN IP4 127.0.0.1
+t=0 0
+m=video 4000 RTP/AVP 100
+a=rtpmap:100 myvideo/96000
+m=audio 5000 RTP/AVP 0
+"""
+
+pjsua_args = "--null-audio --auto-answer 200"
+extra_headers = ""
+include = ["Content-Type: application/sdp", # response must include SDP
+ "m=video 0 RTP[\\s\\S]+m=audio [1-9]+[0-9]* RTP/AVP"
+ ]
+exclude = []
+
+sendto_cfg = sip.SendtoCfg("Mixed audio and video", pjsua_args, sdp, 200,
+ extra_headers=extra_headers,
+ resp_inc=include, resp_exc=exclude)
+
diff --git a/jni/pjproject-android/.svn/pristine/cb/cb6042f75ebaf2213fb2a44ff73d5c5c7cd23d4d.svn-base b/jni/pjproject-android/.svn/pristine/cb/cb6042f75ebaf2213fb2a44ff73d5c5c7cd23d4d.svn-base
new file mode 100644
index 0000000..345dd66
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/cb/cb6042f75ebaf2213fb2a44ff73d5c5c7cd23d4d.svn-base
@@ -0,0 +1,154 @@
+README file for resample-1.x.tgz from the
+Digital Audio Resampling Home Page located at
+http://ccrma.stanford.edu/~jos/resample/.
+
+SOFTWARE FOR SAMPLING-RATE CONVERSION AND FIR DIGITAL FILTER DESIGN
+
+For installation instructions, read the INSTALL file in this directory.
+
+The resample program "resamples" a soundfile to change its sampling
+rate. For example, it can be used to convert the sampling rate from
+48 kHz (used by DAT machines) to 44.1 kHz (the standard sampling rate
+for Compact Discs). The command line for this operation would look
+something like
+
+ resample -by 0.91875 dat.snd cd.snd
+
+or, more simply,
+
+ resample -to 44100 dat.snd cd.snd
+
+Any reasonable sampling rate can be converted to any other.
+
+The windowfilter program designs Finite-Impulse-Response (FIR) digital
+filters by the so-called "window method." In this method, the ideal
+impulse response (a sinc function) is "windowed" by a Kaiser window (a
+popular window used in spectrum analysis).
+
+The resample program uses 32-bit fixed-point arithmetic: 16-bits data
+and 16-bits coefficients. The input soundfile must be 16-bit mono or
+stereo (interleaved) audio data.
+
+SNDLIB
+
+The program uses elements of Bill Schottstaedt's sndlib sound file
+library. This means resample can read many different kinds of sound
+file header (AIFF, WAV, NeXT, IRCAM, etc.).
+
+The sndlib files used by resample are included in this directory to
+ensure stability. The latest version of sndlib should be available as
+
+ ftp://ccrma-ftp.stanford.edu/pub/Lisp/sndlib.tar.gz
+
+See sndlib.html in the sndlib distribution for documentation of SNDLIB.
+
+CONTENTS of ./src directory
+
+resample.c Sampling-rate conversion program.
+resample.1 Manual page for resample. Try "nroff -man resample.1".
+resamplesubs.c Subroutines used by resample.
+resample.h Configuration constants for the sampling rate converter.
+stdefs.h Machine-dependent definitions, useful constants and macros.
+
+windowfilter.c Program for designing FIR digital filters used by resample.
+windowfilter.1 Manual page for windowfilter.
+filterkit.c Library for filter design, application, and file management.
+filterkit.h Declarations (procedure prototypes) for the filterkit library.
+
+README This file.
+README.deemph A word about deemphasis filtering.
+LGPL GNU Lesser General Public License (LGPL)
+
+SNDLIB files:
+ io.c
+ audio.c
+ headers.c
+ sound.c
+ sndlib.h
+ sndlib-strings.h
+
+COPYING
+
+SNDLIB files are Copyright 2000 by Bill Schottstaedt <bil@ccrma.stanford.edu>.
+
+The remaining files in this package, unless otherwise noted, are
+Copyright 1994-2006 by Julius O. Smith III <jos@ccrma.stanford.edu>,
+all rights reserved. Permission to use and copy is granted subject to
+the terms of the "GNU Lesser General Public License" (LGPL) as
+published by the Free Software Foundation; either version 2.1 of the
+License, or any later version. In addition, we request that a copy of
+any modified files be sent by email to jos@ccrma.stanford.edu so that
+we may incorporate them into the CCRMA version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+FILTERKIT CONTENTS
+
+ LpFilter() - Calculates the filter coeffs for a Kaiser-windowed
+ low-pass filter with a given roll-off frequency. These
+ coeffs are stored into a array of doubles.
+
+ writeFilter() - Writes a filter to a file.
+
+ makeFilter() - A section of the original SAIL program. Calls
+ LpFilter() to create a filter, then scales the double
+ coeffs into a array of half words.
+
+ readFilter() - Reads a filter from a file.
+
+ FilterUp() - Applies a filter to a given sample when up-converting.
+
+ FilterUD() - Applies a filter to a given sample when up- or down-
+ converting. Both are repoductions of the original SAIL
+ program.
+
+ initZerox() - Initialization routine for the zerox() function. Must
+ be called before zerox() is called. This routine loads
+ the correct filter so zerox() can use it.
+
+ zerox() - Given a pointer into a sample, finds a zero-crossing on the
+ interval [pointer-1:pointer+2] by iteration.
+
+ Query() - Ask the user for a yes/no question with prompt, default,
+ and optional help.
+
+ GetUShort() - Ask the user for a unsigned short with prompt, default,
+ and optional help.
+
+ GetDouble() - Ask the user for a double with prompt, default, and
+ optional help.
+
+ GetString() - Ask the user for a string with prompt, default, and
+ optional help.
+
+
+FILTER FILE FORMAT
+
+ File Name: "F" Nmult "T" Nhc ".filter"
+ example: "F13T8.filter" and "F27T8.filter"
+
+ Structure of File:
+ "ScaleFactor" LpScl
+ "Length" Nwing
+ "Coeffs:"
+ Imp[0]
+ Imp[1]
+ :
+ Imp[Nwing-1]
+ "Differences:"
+ ImpD[0]
+ ImpD[1]
+ :
+ ImpD[Nwing-1]
+ EOF
+
+ where: Something enclosed in "" indicates specific characters in the file.
+ Nmult, Nwing, Imp[], and ImpD[] are variables (HWORD)
+ Npc is a conversion constant.
+ EOF is the end of the file.
+
+ See writeFilter() and readFilter() in "filterkit.c" for more details.
+
diff --git a/jni/pjproject-android/.svn/pristine/cb/cb635fad36662bb12250518ef61d3ed7903b1bf9.svn-base b/jni/pjproject-android/.svn/pristine/cb/cb635fad36662bb12250518ef61d3ed7903b1bf9.svn-base
new file mode 100644
index 0000000..73e5ecd
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/cb/cb635fad36662bb12250518ef61d3ed7903b1bf9.svn-base
@@ -0,0 +1,61 @@
+/* $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_CODEC_AMR_SDP_MATCH_H__
+#define __PJMEDIA_CODEC_AMR_SDP_MATCH_H__
+
+
+/**
+ * @file g7221_sdp_match.h
+ * @brief Special SDP format match for AMR-NB and AMR-WB.
+ */
+
+#include <pjmedia/sdp_neg.h>
+
+PJ_BEGIN_DECL
+
+
+/* Match AMR-NB and AMR-WB format in the SDP media offer and answer. This
+ * function will match some AMR settings in the SDP format parameters, i.e:
+ * octet-align, crc, robust-sorting, interleaving. Note that, for answerer,
+ * if octet-align mode needs to be adaptable to offerer setting, application
+ * should set #PJMEDIA_SDP_NEG_FMT_MATCH_ALLOW_MODIFY_ANSWER in the option.
+ *
+ * @param pool The memory pool.
+ * @param offer The SDP media offer.
+ * @param o_fmt_idx Index of the AMR format in the SDP media offer.
+ * @param answer The SDP media answer.
+ * @param a_fmt_idx Index of the AMR format in the SDP media answer.
+ * @param option The format matching option, see
+ * #pjmedia_sdp_neg_fmt_match_flag.
+ *
+ * @return PJ_SUCCESS when the formats in offer and answer match.
+ */
+PJ_DECL(pj_status_t) pjmedia_codec_amr_match_sdp( pj_pool_t *pool,
+ pjmedia_sdp_media *offer,
+ unsigned o_fmt_idx,
+ pjmedia_sdp_media *answer,
+ unsigned a_fmt_idx,
+ unsigned option);
+
+
+PJ_END_DECL
+
+
+#endif /* __PJMEDIA_CODEC_AMR_SDP_MATCH_H__ */
diff --git a/jni/pjproject-android/.svn/pristine/cb/cb6b798909770afa430ef4e56f78e470c726db13.svn-base b/jni/pjproject-android/.svn/pristine/cb/cb6b798909770afa430ef4e56f78e470c726db13.svn-base
new file mode 100644
index 0000000..a9c740f
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/cb/cb6b798909770afa430ef4e56f78e470c726db13.svn-base
@@ -0,0 +1,7 @@
+DIRS += gsm
+DIRS += ilbc
+DIRS += speex
+DIRS += portaudio
+DIRS += g7221
+
+
diff --git a/jni/pjproject-android/.svn/pristine/cb/cb8357b03667a9cc805bd1f306fc52a4fd4195e5.svn-base b/jni/pjproject-android/.svn/pristine/cb/cb8357b03667a9cc805bd1f306fc52a4fd4195e5.svn-base
new file mode 100644
index 0000000..1d6da2a
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/cb/cb8357b03667a9cc805bd1f306fc52a4fd4195e5.svn-base
@@ -0,0 +1,24 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+sdp = \
+"""
+v=0
+o=- 0 0 IN IP4 127.0.0.1
+s=pjmedia
+c=IN IP4 127.0.0.1
+t=0 0
+m=video 4000 RTP/AVP 101
+a=rtpmap:101 my-proprietary-codec
+"""
+
+pjsua_args = "--null-audio --auto-answer 200"
+extra_headers = ""
+include = []
+exclude = []
+
+sendto_cfg = sip.SendtoCfg("Unsupported codec", pjsua_args, sdp, 488,
+ extra_headers=extra_headers,
+ resp_inc=include, resp_exc=exclude)
+
diff --git a/jni/pjproject-android/.svn/pristine/cb/cb8beaae6f163a984bce7deb947f517a1368912d.svn-base b/jni/pjproject-android/.svn/pristine/cb/cb8beaae6f163a984bce7deb947f517a1368912d.svn-base
new file mode 100644
index 0000000..c5baab7
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/cb/cb8beaae6f163a984bce7deb947f517a1368912d.svn-base
@@ -0,0 +1,24 @@
+/* $Id$ */
+/*
+ * Copyright (C) 2009-2011 Teluu Inc. (http://www.teluu.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * This file is a C++ wrapper, see ticket #886 for details.
+ */
+
+#include "test.c"
diff --git a/jni/pjproject-android/.svn/pristine/cb/cbabb362d4860a898a946ef676e2ffc744c0e8c6.svn-base b/jni/pjproject-android/.svn/pristine/cb/cbabb362d4860a898a946ef676e2ffc744c0e8c6.svn-base
new file mode 100644
index 0000000..cadfb34
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/cb/cbabb362d4860a898a946ef676e2ffc744c0e8c6.svn-base
@@ -0,0 +1,46 @@
+<?xml version="1.0" ?>
+<Scenario site="$(HOSTNAME)" url="http://my.cdash.org/submit.php?project=PJSIP" wdir="$(PJDIR)/tests/automated">
+
+ <Submit group="Experimental" build="Test-Preparation">
+ <Configure cmd="$(NOP)" />
+ <Build cmd="$(NOP)" />
+
+ <!-- GNU Makefile based scenario
+ Requirement:
+ - none
+ -->
+ <Test name="Configuring GNU scenario" cmd="python configure.py -t gnu -o gnu.xml gnu.xml.template" />
+
+ <!-- GNU Makefile with Intel IPP scenario.
+ Requirements:
+ - IPPROOT
+ - IPPSAMPLES
+ - IPPARCH (optional)
+
+ -->
+ <Test name="Configuring GNU IPP scenario" cmd="python configure.py -t gnu -o gnu-ipp.xml gnu-ipp.xml.template" />
+
+ <!-- iPhone target.
+ Requriement(s):
+ - valid SDK is installed
+
+ -->
+ <Test name="Configuring iPhone scenario" cmd="python configure.py -t gnu -o iphone.xml iphone.xml.template" />
+
+ <!-- MSVC target.
+ Requirements:
+ - Build from VS successfully
+ - VS paths are set
+
+ -->
+ <Test name="Configuring Visual Studio for Win32" cmd="python configure.py -t vs -vstarget Release -o msvc-win32.xml -nopjsuatest msvc.xml.template" />
+
+ <!-- Symbian target.
+ Requirement:
+ - EPOCROOT (modify below)
+ -->
+ <Test name="Configuring Symbian scenario" cmd='CMD /C SET EPOCROOT=\S60\devices\S60_5th_Edition_SDK_v1.0&& devices -setdefault @S60_5th_Edition_SDK_v1.0:com.nokia.s60&& python configure.py -t s60 -s60target "gcce urel" -o symbian.xml symbian.xml.template' />
+
+ </Submit>
+
+</Scenario>
diff --git a/jni/pjproject-android/.svn/pristine/cb/cbbf320c0496684d146292b28dcc13ebd84141f9.svn-base b/jni/pjproject-android/.svn/pristine/cb/cbbf320c0496684d146292b28dcc13ebd84141f9.svn-base
new file mode 100644
index 0000000..ba27f50
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/cb/cbbf320c0496684d146292b28dcc13ebd84141f9.svn-base
@@ -0,0 +1,12 @@
+/*
+========================================================================
+ Name : pjsua.hrh
+ Author : nanang
+ Copyright : Copyright (C) 2013 Teluu Inc. (http://www.teluu.com)
+ Description :
+========================================================================
+*/
+enum TpjsuaViewUids
+ {
+ EPjsuaContainerViewId = 1
+ };
diff --git a/jni/pjproject-android/.svn/pristine/cb/cbeff16f6bbce5978c266be9dad28f08dc2c5732.svn-base b/jni/pjproject-android/.svn/pristine/cb/cbeff16f6bbce5978c266be9dad28f08dc2c5732.svn-base
new file mode 100644
index 0000000..50dc0fe
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/cb/cbeff16f6bbce5978c266be9dad28f08dc2c5732.svn-base
@@ -0,0 +1,53 @@
+# $Id$
+import imp
+import sys
+import inc_sip as sip
+import inc_const as const
+import re
+from inc_cfg import *
+
+# Read configuration
+cfg_file = imp.load_source("cfg_file", ARGS[1])
+
+# Test body function
+def test_func(t):
+ pjsua = t.process[0]
+ # Create dialog
+ dlg = sip.Dialog("127.0.0.1", pjsua.inst_param.sip_port,
+ tcp=cfg_file.sendto_cfg.use_tcp)
+ #dlg = sip.Dialog("127.0.0.1", 5060, tcp=cfg_file.sendto_cfg.use_tcp)
+ cfg = cfg_file.sendto_cfg
+
+ if len(cfg.complete_msg) != 0:
+ req = dlg.update_fields(cfg.complete_msg)
+ else:
+ req = dlg.create_invite(cfg.sdp, cfg.extra_headers, cfg.body)
+ resp = dlg.send_request_wait(req, 10)
+ if resp=="":
+ raise TestError("Timed-out waiting for response")
+ # Check response code
+ code = int(sip.get_code(resp))
+ if code != cfg.resp_code:
+ dlg.hangup(code)
+ raise TestError("Expecting code " + str(cfg.resp_code) +
+ " got " + str(code))
+ # Check for patterns that must exist
+ for p in cfg.resp_include:
+ if re.search(p, resp, re.M | re.I)==None:
+ dlg.hangup(code)
+ raise TestError("Pattern " + p + " not found")
+ # Check for patterns that must not exist
+ for p in cfg.resp_exclude:
+ if re.search(p, resp, re.M | re.I)!=None:
+ dlg.hangup(code)
+ raise TestError("Excluded pattern " + p + " found")
+ pjsua.sync_stdout()
+ dlg.hangup(code)
+ pjsua.sync_stdout()
+
+# Here where it all comes together
+test = TestParam(cfg_file.sendto_cfg.name,
+ [cfg_file.sendto_cfg.inst_param],
+ test_func)
+
+
diff --git a/jni/pjproject-android/.svn/pristine/cb/cbf61972baebc402696413296d0c0a4f64d25075.svn-base b/jni/pjproject-android/.svn/pristine/cb/cbf61972baebc402696413296d0c0a4f64d25075.svn-base
new file mode 100644
index 0000000..40509ca
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/cb/cbf61972baebc402696413296d0c0a4f64d25075.svn-base
Binary files differ