Begin integration with OpenTelePresence

This commit is contained in:
bossiel 2011-08-25 01:07:28 +00:00
parent 23f934ea3d
commit 28413584fe
49 changed files with 604 additions and 187 deletions

View File

@ -30,13 +30,13 @@ class ActionConfig
public:
ActionConfig();
virtual ~ActionConfig();
bool addHeader(const char* name, const char* value);
ActionConfig* setResponseLine(short code, const char* phrase);
ActionConfig* setMediaString(twrap_media_type_t type, const char* key, const char* value);
ActionConfig* setMediaInt(twrap_media_type_t type, const char* key, int value);
private:
tsip_action_handle_t* m_pHandle;

View File

@ -32,11 +32,11 @@
typedef enum twrap_media_type_e
{
twrap_media_none,
twrap_media_audio,
twrap_media_video,
twrap_media_audiovideo,
twrap_media_msrp
twrap_media_none = 0x00,
twrap_media_audio = (0x01<<0),
twrap_media_video = (0x01<<1),
twrap_media_audiovideo = (twrap_media_audio | twrap_media_video),
twrap_media_msrp = (0x01<<2)
}
twrap_media_type_t;

View File

@ -30,9 +30,9 @@ static void *__droid_destroy_mgr(void *mgr){
#endif
MediaSessionMgr::MediaSessionMgr(tmedia_session_mgr_t* _mgr)
MediaSessionMgr::MediaSessionMgr(tmedia_session_mgr_t* pWrappedMgr)
{
this->mgr = (tmedia_session_mgr_t*)tsk_object_ref(_mgr);
m_pWrappedMgr = (tmedia_session_mgr_t*)tsk_object_ref(pWrappedMgr);
}
MediaSessionMgr::~MediaSessionMgr()
@ -41,14 +41,14 @@ MediaSessionMgr::~MediaSessionMgr()
// On Android, deleting the manager from the managed code will trigger OnPluginDestroyed() event
// for each plugin associated to this manager (audio,video,...consumers/producers)
void* tid[1] = { tsk_null };
if(tsk_thread_create(tid, __droid_destroy_mgr, this->mgr) == 0){
if(tsk_thread_create(tid, __droid_destroy_mgr, m_pWrappedMgr) == 0){
tsk_thread_join(tid);
}
else{
TSK_DEBUG_ERROR("Failed to start the thread");
}
#else
TSK_OBJECT_SAFE_FREE(this->mgr);
TSK_OBJECT_SAFE_FREE(m_pWrappedMgr);
#endif
}
@ -61,7 +61,7 @@ bool MediaSessionMgr::sessionSetInt32(twrap_media_type_t media, const char* key,
bool MediaSessionMgr::consumerSetInt32(twrap_media_type_t media, const char* key, int32_t value)
{
tmedia_type_t _media = _get_media_type(media);
return (tmedia_session_mgr_set(this->mgr,
return (tmedia_session_mgr_set(m_pWrappedMgr,
TMEDIA_SESSION_CONSUMER_SET_INT32(_media, key, value),
TMEDIA_SESSION_SET_NULL()) == 0);
}
@ -69,7 +69,7 @@ bool MediaSessionMgr::consumerSetInt32(twrap_media_type_t media, const char* key
bool MediaSessionMgr::consumerSetInt64(twrap_media_type_t media, const char* key, int64_t value)
{
tmedia_type_t _media = _get_media_type(media);
return (tmedia_session_mgr_set(this->mgr,
return (tmedia_session_mgr_set(m_pWrappedMgr,
TMEDIA_SESSION_CONSUMER_SET_INT64(_media, key, value),
TMEDIA_SESSION_SET_NULL()) == 0);
}
@ -77,7 +77,7 @@ bool MediaSessionMgr::consumerSetInt64(twrap_media_type_t media, const char* key
bool MediaSessionMgr::producerSetInt32(twrap_media_type_t media, const char* key, int32_t value)
{
tmedia_type_t _media = _get_media_type(media);
return (tmedia_session_mgr_set(this->mgr,
return (tmedia_session_mgr_set(m_pWrappedMgr,
TMEDIA_SESSION_PRODUCER_SET_INT32(_media, key, value),
TMEDIA_SESSION_SET_NULL()) == 0);
}
@ -85,7 +85,7 @@ bool MediaSessionMgr::producerSetInt32(twrap_media_type_t media, const char* key
bool MediaSessionMgr::producerSetInt64(twrap_media_type_t media, const char* key, int64_t value)
{
tmedia_type_t _media = _get_media_type(media);
return (tmedia_session_mgr_set(this->mgr,
return (tmedia_session_mgr_set(m_pWrappedMgr,
TMEDIA_SESSION_PRODUCER_SET_INT64(_media, key, value),
TMEDIA_SESSION_SET_NULL()) == 0);
}
@ -105,9 +105,9 @@ const ProxyPlugin* MediaSessionMgr::findProxyPlugin(twrap_media_type_t media, bo
return tsk_null;
}
if(manager && this->mgr){
if(manager && m_pWrappedMgr){
tmedia_type_t _media = _get_media_type(media);
tmedia_session_t* session = tmedia_session_mgr_find(this->mgr, _media);
tmedia_session_t* session = tmedia_session_mgr_find(m_pWrappedMgr, _media);
if(session){
if(session->plugin == tdav_session_audio_plugin_def_t){
if(consumer){
@ -135,6 +135,31 @@ const ProxyPlugin* MediaSessionMgr::findProxyPlugin(twrap_media_type_t media, bo
return plugin;
}
uint64_t MediaSessionMgr::getSessionId(twrap_media_type_t media)const
{
const ProxyPlugin* plugin = tsk_null;
ProxyPluginMgr* manager = ProxyPluginMgr::getInstance();
uint64_t id = 0;
if(media != twrap_media_audio && media != twrap_media_video){
TSK_DEBUG_ERROR("Invalid media type");
return tsk_null;
}
if(manager && m_pWrappedMgr){
tmedia_type_t _media = _get_media_type(media);
tmedia_session_t* session = tmedia_session_mgr_find(m_pWrappedMgr, _media);
if(session){
id = session->id;
}
tsk_object_unref(session);
}
else{
TSK_DEBUG_ERROR("Invalid state");
}
return id;
}
bool MediaSessionMgr::defaultsSetBandwidthLevel(tmedia_bandwidth_level_t bl)
{

View File

@ -31,7 +31,7 @@ class MediaSessionMgr
{
public:
#if !defined(SWIG)
MediaSessionMgr(tmedia_session_mgr_t* mgr);
MediaSessionMgr(tmedia_session_mgr_t* pWrappedMgr);
#endif
virtual ~MediaSessionMgr();
@ -54,6 +54,8 @@ public:
const ProxyPlugin* findProxyPluginProducer(twrap_media_type_t media)const{
return this->findProxyPlugin(media, false);
}
uint64_t getSessionId(twrap_media_type_t media)const;
// Defaults
static bool defaultsSetBandwidthLevel(tmedia_bandwidth_level_t bl);
@ -80,7 +82,7 @@ public:
private:
tmedia_session_mgr_t* mgr;
tmedia_session_mgr_t* m_pWrappedMgr;
};
#endif /* TINYWRAP_MEDIA_SESSIONMGR_H */

View File

@ -61,18 +61,29 @@ ProxyPluginMgr::~ProxyPluginMgr()
TSK_OBJECT_SAFE_FREE(this->plugins);
}
ProxyPluginMgr* ProxyPluginMgr::createInstance(ProxyPluginMgrCallback* _callback)
ProxyPluginMgr* ProxyPluginMgr::createInstance(ProxyPluginMgrCallback* pCallback)
{
if(!ProxyPluginMgr::instance){
ProxyPluginMgr::instance = new ProxyPluginMgr(_callback);
ProxyPluginMgr::instance = new ProxyPluginMgr(pCallback);
}
else{
TSK_DEBUG_WARN("Plugin instance already exist");
ProxyPluginMgr::instance->callback = _callback;
ProxyPluginMgr::instance->callback = pCallback;
}
return ProxyPluginMgr::instance;
}
void ProxyPluginMgr::destroyInstance(ProxyPluginMgr** ppInstance)
{
if(ppInstance && *ppInstance){
bool bMatch = ProxyPluginMgr::instance && (*ppInstance == ProxyPluginMgr::instance);
delete *ppInstance, *ppInstance = tsk_null;
if(bMatch){
ProxyPluginMgr::instance = tsk_null;
}
}
}
ProxyPluginMgr* ProxyPluginMgr::getInstance()
{
if(!ProxyPluginMgr::instance){

View File

@ -54,7 +54,10 @@ public:
virtual ~ProxyPluginMgr();
// SWIG %newobject
static ProxyPluginMgr* createInstance(ProxyPluginMgrCallback* callback);
static ProxyPluginMgr* createInstance(ProxyPluginMgrCallback* pCallback);
#if !defined(SWIG)
static void destroyInstance(ProxyPluginMgr** ppInstance);
#endif
static ProxyPluginMgr* getInstance();
#if !defined(SWIG)

View File

@ -316,7 +316,7 @@ SMSData* SMSEncoder::decode(const void* data, unsigned size, bool MobOrig)
if((tpdu = tsms_tpdu_message_deserialize(rp_data->udata->data, rp_data->udata->size, MobOrig))){
if(tpdu->mti == tsms_tpdu_mti_deliver_mt || tpdu->mti == tsms_tpdu_mti_submit_mo){ /* SMS-SUBMIT or SMS-DELIVER? */
ascii = tsms_tpdu_message_get_payload(tpdu);
decodedData = new SMSData(twrap_sms_type_rpdata, rp_message->mr, ascii, tsk_strlen(ascii));
decodedData = new SMSData(twrap_sms_type_rpdata, rp_message->mr, ascii, (tsk_size_t)tsk_strlen(ascii));
if(tpdu->mti == tsms_tpdu_mti_deliver_mt){
tsms_tpdu_deliver_t* tpdu_deliver = (tsms_tpdu_deliver_t*)tpdu;

View File

@ -176,6 +176,7 @@ bool SipSession::removeSigCompCompartment()
TSIP_SSESSION_SET_NULL()) == 0);
}
// FIXME: should be "uint64_t" instead of "unsigned"
unsigned SipSession::getId()const
{
return (unsigned)tsip_ssession_get_id(m_pHandle);

View File

@ -28,7 +28,7 @@
#include "Common.h"
unsigned SipStack::count = 0;
bool SipStack::g_bInitialized = false;
/* === ANSI-C functions (local use) === */
@ -50,10 +50,9 @@ SipStack::SipStack(SipCallback* pCallback, const char* realm_uri, const char* im
m_pDebugCallback = tsk_null;
m_pCallback = pCallback;
/* Initialize network layer */
if(SipStack::count == 0){
tdav_init();
tnet_startup();
/* Initialize network and media layers */
if(!SipStack::initialize()){
return;// isValid() will be false
}
/* Creates stack handle */
@ -61,8 +60,6 @@ SipStack::SipStack(SipCallback* pCallback, const char* realm_uri, const char* im
TSIP_STACK_SET_LOCAL_IP(DEFAULT_LOCAL_IP),
TSIP_STACK_SET_USERDATA(this), /* used as context (useful for server-initiated requests) */
TSIP_STACK_SET_NULL());
SipStack::count++;
}
SipStack::~SipStack()
@ -71,12 +68,6 @@ SipStack::~SipStack()
/* Destroy stack handle */
TSK_OBJECT_SAFE_FREE(m_pHandle);
/* DeInitialize the network layer (only if last stack) */
if(--SipStack::count == 0){
tdav_deinit();
tnet_cleanup();
}
}
bool SipStack::start()
@ -391,6 +382,35 @@ bool SipStack::stop()
return (ret == 0);
}
bool SipStack::initialize()
{
if(!g_bInitialized)
{
int ret;
if((ret = tnet_startup())){
TSK_DEBUG_ERROR("tnet_startup failed with error code=%d", ret);
return false;
}
if((ret = tdav_init())){
TSK_DEBUG_ERROR("tdav_init failed with error code=%d", ret);
return false;
}
g_bInitialized = true;
}
return true;
}
bool SipStack::deInitialize()
{
if(SipStack::g_bInitialized){
tdav_deinit();
tnet_cleanup();
SipStack::g_bInitialized = false;
}
return false;
}
void SipStack::setCodecs(tdav_codec_id_t codecs)
{
tdav_set_codecs(codecs);

View File

@ -81,6 +81,8 @@ public: /* API functions */
bool isValid();
bool stop();
static bool initialize();
static bool deInitialize();
static void setCodecs(tdav_codec_id_t codecs);
static void setCodecs_2(int codecs); // For stupid languages
static bool setCodecPriority(tdav_codec_id_t codec_id, int priority);
@ -105,7 +107,7 @@ private:
DDebugCallback* m_pDebugCallback;
tsip_stack_handle_t* m_pHandle;
static unsigned count;
static bool g_bInitialized;
};
#endif /* TINYWRAP_SIPSTACK_H */

View File

@ -23,7 +23,7 @@
SipUri::SipUri(const char* uriString, const char* displayName/*=tsk_null*/)
{
if((m_pUri = tsip_uri_parse(uriString, tsk_strlen(uriString))) && displayName){
if((m_pUri = tsip_uri_parse(uriString, (tsk_size_t)tsk_strlen(uriString))) && displayName){
m_pUri->display_name = tsk_strdup(displayName);
}
}
@ -38,7 +38,7 @@ bool SipUri::isValid(const char* uriString)
tsip_uri_t* uri;
bool ret = false;
if((uri = tsip_uri_parse(uriString, tsk_strlen(uriString)))){
if((uri = tsip_uri_parse(uriString, (tsk_size_t)tsk_strlen(uriString)))){
ret = (uri->type != uri_unknown)
&& (!tsk_strnullORempty(uri->host));
TSK_OBJECT_SAFE_FREE(uri);

View File

@ -215,7 +215,7 @@ char* XcapSelector::getString()
/* append the namespace */
if(_namespace){
tsk_buffer_append(buffer, _namespace, strlen(_namespace));
tsk_buffer_append(buffer, _namespace, (tsk_size_t)tsk_strlen(_namespace));
TSK_FREE(_namespace);
}

View File

@ -76,6 +76,11 @@ public class MediaSessionMgr : IDisposable {
return ret;
}
public ulong getSessionId(twrap_media_type_t media) {
ulong ret = tinyWRAPPINVOKE.MediaSessionMgr_getSessionId(swigCPtr, (int)media);
return ret;
}
public static bool defaultsSetBandwidthLevel(tmedia_bandwidth_level_t bl) {
bool ret = tinyWRAPPINVOKE.MediaSessionMgr_defaultsSetBandwidthLevel((int)bl);
return ret;

View File

@ -39,8 +39,8 @@ public class ProxyPluginMgr : IDisposable {
}
}
public static ProxyPluginMgr createInstance(ProxyPluginMgrCallback callback) {
IntPtr cPtr = tinyWRAPPINVOKE.ProxyPluginMgr_createInstance(ProxyPluginMgrCallback.getCPtr(callback));
public static ProxyPluginMgr createInstance(ProxyPluginMgrCallback pCallback) {
IntPtr cPtr = tinyWRAPPINVOKE.ProxyPluginMgr_createInstance(ProxyPluginMgrCallback.getCPtr(pCallback));
ProxyPluginMgr ret = (cPtr == IntPtr.Zero) ? null : new ProxyPluginMgr(cPtr, true);
return ret;
}

View File

@ -206,6 +206,16 @@ public class SipStack : SafeObject {
return ret;
}
public static bool initialize() {
bool ret = tinyWRAPPINVOKE.SipStack_initialize();
return ret;
}
public static bool deInitialize() {
bool ret = tinyWRAPPINVOKE.SipStack_deInitialize();
return ret;
}
public static void setCodecs(tdav_codec_id_t codecs) {
tinyWRAPPINVOKE.SipStack_setCodecs((int)codecs);
}

View File

@ -278,6 +278,9 @@ class tinyWRAPPINVOKE {
[DllImport("tinyWRAP", EntryPoint="CSharp_MediaSessionMgr_findProxyPluginProducer")]
public static extern IntPtr MediaSessionMgr_findProxyPluginProducer(HandleRef jarg1, int jarg2);
[DllImport("tinyWRAP", EntryPoint="CSharp_MediaSessionMgr_getSessionId")]
public static extern ulong MediaSessionMgr_getSessionId(HandleRef jarg1, int jarg2);
[DllImport("tinyWRAP", EntryPoint="CSharp_MediaSessionMgr_defaultsSetBandwidthLevel")]
public static extern bool MediaSessionMgr_defaultsSetBandwidthLevel(int jarg1);
@ -1346,6 +1349,12 @@ class tinyWRAPPINVOKE {
[DllImport("tinyWRAP", EntryPoint="CSharp_SipStack_stop")]
public static extern bool SipStack_stop(HandleRef jarg1);
[DllImport("tinyWRAP", EntryPoint="CSharp_SipStack_initialize")]
public static extern bool SipStack_initialize();
[DllImport("tinyWRAP", EntryPoint="CSharp_SipStack_deInitialize")]
public static extern bool SipStack_deInitialize();
[DllImport("tinyWRAP", EntryPoint="CSharp_SipStack_setCodecs")]
public static extern void SipStack_setCodecs(int jarg1);

View File

@ -1522,6 +1522,20 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_MediaSessionMgr_findProxyPluginProducer(voi
}
SWIGEXPORT unsigned long long SWIGSTDCALL CSharp_MediaSessionMgr_getSessionId(void * jarg1, int jarg2) {
unsigned long long jresult ;
MediaSessionMgr *arg1 = (MediaSessionMgr *) 0 ;
twrap_media_type_t arg2 ;
uint64_t result;
arg1 = (MediaSessionMgr *)jarg1;
arg2 = (twrap_media_type_t)jarg2;
result = (uint64_t)((MediaSessionMgr const *)arg1)->getSessionId(arg2);
jresult = result;
return jresult;
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_MediaSessionMgr_defaultsSetBandwidthLevel(int jarg1) {
unsigned int jresult ;
tmedia_bandwidth_level_t arg1 ;
@ -6068,6 +6082,26 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_SipStack_stop(void * jarg1) {
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_SipStack_initialize() {
unsigned int jresult ;
bool result;
result = (bool)SipStack::initialize();
jresult = result;
return jresult;
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_SipStack_deInitialize() {
unsigned int jresult ;
bool result;
result = (bool)SipStack::deInitialize();
jresult = result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_SipStack_setCodecs(int jarg1) {
tdav_codec_id_t arg1 ;

View File

@ -9,11 +9,11 @@
namespace org.doubango.tinyWRAP {
public enum twrap_media_type_t {
twrap_media_none,
twrap_media_audio,
twrap_media_video,
twrap_media_audiovideo,
twrap_media_msrp
twrap_media_none = 0x00,
twrap_media_audio = (0x01 << 0),
twrap_media_video = (0x01 << 1),
twrap_media_audiovideo = (twrap_media_audio|twrap_media_video),
twrap_media_msrp = (0x01 << 2)
}
}

View File

@ -63,6 +63,10 @@ public class MediaSessionMgr {
return (cPtr == 0) ? null : new ProxyPlugin(cPtr, false);
}
public java.math.BigInteger getSessionId(twrap_media_type_t media) {
return tinyWRAPJNI.MediaSessionMgr_getSessionId(swigCPtr, this, media.swigValue());
}
public static boolean defaultsSetBandwidthLevel(tmedia_bandwidth_level_t bl) {
return tinyWRAPJNI.MediaSessionMgr_defaultsSetBandwidthLevel(bl.swigValue());
}

View File

@ -33,8 +33,8 @@ public class ProxyPluginMgr {
swigCPtr = 0;
}
public static ProxyPluginMgr createInstance(ProxyPluginMgrCallback callback) {
long cPtr = tinyWRAPJNI.ProxyPluginMgr_createInstance(ProxyPluginMgrCallback.getCPtr(callback), callback);
public static ProxyPluginMgr createInstance(ProxyPluginMgrCallback pCallback) {
long cPtr = tinyWRAPJNI.ProxyPluginMgr_createInstance(ProxyPluginMgrCallback.getCPtr(pCallback), pCallback);
return (cPtr == 0) ? null : new ProxyPluginMgr(cPtr, true);
}

View File

@ -169,6 +169,14 @@ public class SipStack extends SafeObject {
return tinyWRAPJNI.SipStack_stop(swigCPtr, this);
}
public static boolean initialize() {
return tinyWRAPJNI.SipStack_initialize();
}
public static boolean deInitialize() {
return tinyWRAPJNI.SipStack_deInitialize();
}
public static void setCodecs(tdav_codec_id_t codecs) {
tinyWRAPJNI.SipStack_setCodecs(codecs.swigValue());
}

View File

@ -63,6 +63,10 @@ public class MediaSessionMgr {
return (cPtr == 0) ? null : new ProxyPlugin(cPtr, false);
}
public java.math.BigInteger getSessionId(twrap_media_type_t media) {
return tinyWRAPJNI.MediaSessionMgr_getSessionId(swigCPtr, this, media.swigValue());
}
public static boolean defaultsSetBandwidthLevel(tmedia_bandwidth_level_t bl) {
return tinyWRAPJNI.MediaSessionMgr_defaultsSetBandwidthLevel(bl.swigValue());
}

View File

@ -33,8 +33,8 @@ public class ProxyPluginMgr {
swigCPtr = 0;
}
public static ProxyPluginMgr createInstance(ProxyPluginMgrCallback callback) {
long cPtr = tinyWRAPJNI.ProxyPluginMgr_createInstance(ProxyPluginMgrCallback.getCPtr(callback), callback);
public static ProxyPluginMgr createInstance(ProxyPluginMgrCallback pCallback) {
long cPtr = tinyWRAPJNI.ProxyPluginMgr_createInstance(ProxyPluginMgrCallback.getCPtr(pCallback), pCallback);
return (cPtr == 0) ? null : new ProxyPluginMgr(cPtr, true);
}

View File

@ -169,6 +169,14 @@ public class SipStack extends SafeObject {
return tinyWRAPJNI.SipStack_stop(swigCPtr, this);
}
public static boolean initialize() {
return tinyWRAPJNI.SipStack_initialize();
}
public static boolean deInitialize() {
return tinyWRAPJNI.SipStack_deInitialize();
}
public static void setCodecs(tdav_codec_id_t codecs) {
tinyWRAPJNI.SipStack_setCodecs(codecs.swigValue());
}

View File

@ -41,6 +41,7 @@ class tinyWRAPJNI {
public final static native boolean MediaSessionMgr_producerSetInt64(long jarg1, MediaSessionMgr jarg1_, int jarg2, String jarg3, long jarg4);
public final static native long MediaSessionMgr_findProxyPluginConsumer(long jarg1, MediaSessionMgr jarg1_, int jarg2);
public final static native long MediaSessionMgr_findProxyPluginProducer(long jarg1, MediaSessionMgr jarg1_, int jarg2);
public final static native java.math.BigInteger MediaSessionMgr_getSessionId(long jarg1, MediaSessionMgr jarg1_, int jarg2);
public final static native boolean MediaSessionMgr_defaultsSetBandwidthLevel(int jarg1);
public final static native int MediaSessionMgr_defaultsGetBandwidthLevel();
public final static native boolean MediaSessionMgr_defaultsSetEchoTail(long jarg1);
@ -403,6 +404,8 @@ class tinyWRAPJNI {
public final static native String SipStack_getPreferredIdentity(long jarg1, SipStack jarg1_);
public final static native boolean SipStack_isValid(long jarg1, SipStack jarg1_);
public final static native boolean SipStack_stop(long jarg1, SipStack jarg1_);
public final static native boolean SipStack_initialize();
public final static native boolean SipStack_deInitialize();
public final static native void SipStack_setCodecs(int jarg1);
public final static native void SipStack_setCodecs_2(int jarg1);
public final static native boolean SipStack_setCodecPriority(int jarg1, int jarg2);

View File

@ -2412,6 +2412,39 @@ SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_
}
SWIGEXPORT jobject JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_1getSessionId(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
jobject jresult = 0 ;
MediaSessionMgr *arg1 = (MediaSessionMgr *) 0 ;
twrap_media_type_t arg2 ;
uint64_t result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(MediaSessionMgr **)&jarg1;
arg2 = (twrap_media_type_t)jarg2;
result = (uint64_t)((MediaSessionMgr const *)arg1)->getSessionId(arg2);
{
jbyteArray ba = jenv->NewByteArray(9);
jbyte* bae = jenv->GetByteArrayElements(ba, 0);
jclass clazz = jenv->FindClass("java/math/BigInteger");
jmethodID mid = jenv->GetMethodID(clazz, "<init>", "([B)V");
jobject bigint;
int i;
bae[0] = 0;
for(i=1; i<9; i++ ) {
bae[i] = (jbyte)(result>>8*(8-i));
}
jenv->ReleaseByteArrayElements(ba, bae, 0);
bigint = jenv->NewObject(clazz, mid, ba);
jresult = bigint;
}
return jresult;
}
SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_1defaultsSetBandwidthLevel(JNIEnv *jenv, jclass jcls, jint jarg1) {
jboolean jresult = 0 ;
tmedia_bandwidth_level_t arg1 ;
@ -8771,6 +8804,30 @@ SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipStack_1sto
}
SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipStack_1initialize(JNIEnv *jenv, jclass jcls) {
jboolean jresult = 0 ;
bool result;
(void)jenv;
(void)jcls;
result = (bool)SipStack::initialize();
jresult = (jboolean)result;
return jresult;
}
SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipStack_1deInitialize(JNIEnv *jenv, jclass jcls) {
jboolean jresult = 0 ;
bool result;
(void)jenv;
(void)jcls;
result = (bool)SipStack::deInitialize();
jresult = (jboolean)result;
return jresult;
}
SWIGEXPORT void JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipStack_1setCodecs(JNIEnv *jenv, jclass jcls, jint jarg1) {
tdav_codec_id_t arg1 ;

View File

@ -9,11 +9,11 @@
package org.doubango.tinyWRAP;
public enum twrap_media_type_t {
twrap_media_none,
twrap_media_audio,
twrap_media_video,
twrap_media_audiovideo,
twrap_media_msrp;
twrap_media_none(0x00),
twrap_media_audio((0x01 << 0)),
twrap_media_video((0x01 << 1)),
twrap_media_audiovideo((twrap_media_audio|twrap_media_video)),
twrap_media_msrp((0x01 << 2));
public final int swigValue() {
return swigValue;

View File

@ -41,6 +41,7 @@ class tinyWRAPJNI {
public final static native boolean MediaSessionMgr_producerSetInt64(long jarg1, MediaSessionMgr jarg1_, int jarg2, String jarg3, long jarg4);
public final static native long MediaSessionMgr_findProxyPluginConsumer(long jarg1, MediaSessionMgr jarg1_, int jarg2);
public final static native long MediaSessionMgr_findProxyPluginProducer(long jarg1, MediaSessionMgr jarg1_, int jarg2);
public final static native java.math.BigInteger MediaSessionMgr_getSessionId(long jarg1, MediaSessionMgr jarg1_, int jarg2);
public final static native boolean MediaSessionMgr_defaultsSetBandwidthLevel(int jarg1);
public final static native int MediaSessionMgr_defaultsGetBandwidthLevel();
public final static native boolean MediaSessionMgr_defaultsSetEchoTail(long jarg1);
@ -403,6 +404,8 @@ class tinyWRAPJNI {
public final static native String SipStack_getPreferredIdentity(long jarg1, SipStack jarg1_);
public final static native boolean SipStack_isValid(long jarg1, SipStack jarg1_);
public final static native boolean SipStack_stop(long jarg1, SipStack jarg1_);
public final static native boolean SipStack_initialize();
public final static native boolean SipStack_deInitialize();
public final static native void SipStack_setCodecs(int jarg1);
public final static native void SipStack_setCodecs_2(int jarg1);
public final static native boolean SipStack_setCodecPriority(int jarg1, int jarg2);

View File

@ -2412,6 +2412,39 @@ SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_
}
SWIGEXPORT jobject JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_1getSessionId(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
jobject jresult = 0 ;
MediaSessionMgr *arg1 = (MediaSessionMgr *) 0 ;
twrap_media_type_t arg2 ;
uint64_t result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(MediaSessionMgr **)&jarg1;
arg2 = (twrap_media_type_t)jarg2;
result = (uint64_t)((MediaSessionMgr const *)arg1)->getSessionId(arg2);
{
jbyteArray ba = jenv->NewByteArray(9);
jbyte* bae = jenv->GetByteArrayElements(ba, 0);
jclass clazz = jenv->FindClass("java/math/BigInteger");
jmethodID mid = jenv->GetMethodID(clazz, "<init>", "([B)V");
jobject bigint;
int i;
bae[0] = 0;
for(i=1; i<9; i++ ) {
bae[i] = (jbyte)(result>>8*(8-i));
}
jenv->ReleaseByteArrayElements(ba, bae, 0);
bigint = jenv->NewObject(clazz, mid, ba);
jresult = bigint;
}
return jresult;
}
SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_1defaultsSetBandwidthLevel(JNIEnv *jenv, jclass jcls, jint jarg1) {
jboolean jresult = 0 ;
tmedia_bandwidth_level_t arg1 ;
@ -8771,6 +8804,30 @@ SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipStack_1sto
}
SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipStack_1initialize(JNIEnv *jenv, jclass jcls) {
jboolean jresult = 0 ;
bool result;
(void)jenv;
(void)jcls;
result = (bool)SipStack::initialize();
jresult = (jboolean)result;
return jresult;
}
SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipStack_1deInitialize(JNIEnv *jenv, jclass jcls) {
jboolean jresult = 0 ;
bool result;
(void)jenv;
(void)jcls;
result = (bool)SipStack::deInitialize();
jresult = (jboolean)result;
return jresult;
}
SWIGEXPORT void JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipStack_1setCodecs(JNIEnv *jenv, jclass jcls, jint jarg1) {
tdav_codec_id_t arg1 ;

View File

@ -9,11 +9,11 @@
package org.doubango.tinyWRAP;
public enum twrap_media_type_t {
twrap_media_none,
twrap_media_audio,
twrap_media_video,
twrap_media_audiovideo,
twrap_media_msrp;
twrap_media_none(0x00),
twrap_media_audio((0x01 << 0)),
twrap_media_video((0x01 << 1)),
twrap_media_audiovideo((twrap_media_audio|twrap_media_video)),
twrap_media_msrp((0x01 << 2));
public final int swigValue() {
return swigValue;

View File

@ -198,6 +198,7 @@ sub DESTROY {
*producerSetInt64 = *tinyWRAPc::MediaSessionMgr_producerSetInt64;
*findProxyPluginConsumer = *tinyWRAPc::MediaSessionMgr_findProxyPluginConsumer;
*findProxyPluginProducer = *tinyWRAPc::MediaSessionMgr_findProxyPluginProducer;
*getSessionId = *tinyWRAPc::MediaSessionMgr_getSessionId;
*defaultsSetBandwidthLevel = *tinyWRAPc::MediaSessionMgr_defaultsSetBandwidthLevel;
*defaultsGetBandwidthLevel = *tinyWRAPc::MediaSessionMgr_defaultsGetBandwidthLevel;
*defaultsSetEchoTail = *tinyWRAPc::MediaSessionMgr_defaultsSetEchoTail;
@ -1718,6 +1719,8 @@ sub DESTROY {
*getPreferredIdentity = *tinyWRAPc::SipStack_getPreferredIdentity;
*isValid = *tinyWRAPc::SipStack_isValid;
*stop = *tinyWRAPc::SipStack_stop;
*initialize = *tinyWRAPc::SipStack_initialize;
*deInitialize = *tinyWRAPc::SipStack_deInitialize;
*setCodecs = *tinyWRAPc::SipStack_setCodecs;
*setCodecs_2 = *tinyWRAPc::SipStack_setCodecs_2;
*setCodecPriority = *tinyWRAPc::SipStack_setCodecPriority;

View File

@ -1995,6 +1995,44 @@ SWIG_AsVal_long_SS_long SWIG_PERL_DECL_ARGS_2(SV *obj, long long *val)
}
#include <stdio.h>
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM)
# ifndef snprintf
# define snprintf _snprintf
# endif
#endif
SWIGINTERNINLINE SV *
SWIG_From_long_SS_long SWIG_PERL_DECL_ARGS_1(long long value)
{
if (((long long) LONG_MIN <= value) && (value <= (long long) LONG_MAX)) {
return SWIG_From_long SWIG_PERL_CALL_ARGS_1(static_cast< long >(value));
} else {
char temp[256];
SV *obj = sv_newmortal();
sprintf(temp, "%lld", value);
sv_setpv(obj, temp);
return obj;
}
}
SWIGINTERNINLINE SV *
SWIG_From_unsigned_SS_long_SS_long SWIG_PERL_DECL_ARGS_1(unsigned long long value)
{
if (value < (unsigned long long) LONG_MAX) {
return SWIG_From_long_SS_long SWIG_PERL_CALL_ARGS_1(static_cast< long long >(value));
} else {
char temp[256];
SV *obj = sv_newmortal();
sprintf(temp, "%llu", value);
sv_setpv(obj, temp);
return obj;
}
}
SWIGINTERN int
SWIG_AsVal_bool SWIG_PERL_DECL_ARGS_2(SV *obj, bool* val)
{
@ -2167,44 +2205,6 @@ SWIG_AsVal_unsigned_SS_long_SS_long SWIG_PERL_DECL_ARGS_2(SV *obj, unsigned long
}
#include <stdio.h>
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM)
# ifndef snprintf
# define snprintf _snprintf
# endif
#endif
SWIGINTERNINLINE SV *
SWIG_From_long_SS_long SWIG_PERL_DECL_ARGS_1(long long value)
{
if (((long long) LONG_MIN <= value) && (value <= (long long) LONG_MAX)) {
return SWIG_From_long SWIG_PERL_CALL_ARGS_1(static_cast< long >(value));
} else {
char temp[256];
SV *obj = sv_newmortal();
sprintf(temp, "%lld", value);
sv_setpv(obj, temp);
return obj;
}
}
SWIGINTERNINLINE SV *
SWIG_From_unsigned_SS_long_SS_long SWIG_PERL_DECL_ARGS_1(unsigned long long value)
{
if (value < (unsigned long long) LONG_MAX) {
return SWIG_From_long_SS_long SWIG_PERL_CALL_ARGS_1(static_cast< long long >(value));
} else {
char temp[256];
SV *obj = sv_newmortal();
sprintf(temp, "%llu", value);
sv_setpv(obj, temp);
return obj;
}
}
SWIGINTERN int
SWIG_AsVal_unsigned_SS_short SWIG_PERL_DECL_ARGS_2(SV * obj, unsigned short *val)
{
@ -3363,6 +3363,44 @@ XS(_wrap_MediaSessionMgr_findProxyPluginProducer) {
}
XS(_wrap_MediaSessionMgr_getSessionId) {
{
MediaSessionMgr *arg1 = (MediaSessionMgr *) 0 ;
twrap_media_type_t arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
int val2 ;
int ecode2 = 0 ;
int argvi = 0;
uint64_t result;
dXSARGS;
if ((items < 2) || (items > 2)) {
SWIG_croak("Usage: MediaSessionMgr_getSessionId(self,media);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_MediaSessionMgr, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MediaSessionMgr_getSessionId" "', argument " "1"" of type '" "MediaSessionMgr const *""'");
}
arg1 = reinterpret_cast< MediaSessionMgr * >(argp1);
ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "MediaSessionMgr_getSessionId" "', argument " "2"" of type '" "twrap_media_type_t""'");
}
arg2 = static_cast< twrap_media_type_t >(val2);
result = (uint64_t)((MediaSessionMgr const *)arg1)->getSessionId(arg2);
ST(argvi) = SWIG_From_unsigned_SS_long_SS_long SWIG_PERL_CALL_ARGS_1(static_cast< unsigned long long >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_MediaSessionMgr_defaultsSetBandwidthLevel) {
{
tmedia_bandwidth_level_t arg1 ;
@ -12288,7 +12326,7 @@ XS(_wrap_ProxyPluginMgr_createInstance) {
dXSARGS;
if ((items < 1) || (items > 1)) {
SWIG_croak("Usage: ProxyPluginMgr_createInstance(callback);");
SWIG_croak("Usage: ProxyPluginMgr_createInstance(pCallback);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ProxyPluginMgrCallback, 0 | 0 );
if (!SWIG_IsOK(res1)) {
@ -17381,6 +17419,42 @@ XS(_wrap_SipStack_stop) {
}
XS(_wrap_SipStack_initialize) {
{
int argvi = 0;
bool result;
dXSARGS;
if ((items < 0) || (items > 0)) {
SWIG_croak("Usage: SipStack_initialize();");
}
result = (bool)SipStack::initialize();
ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_SipStack_deInitialize) {
{
int argvi = 0;
bool result;
dXSARGS;
if ((items < 0) || (items > 0)) {
SWIG_croak("Usage: SipStack_deInitialize();");
}
result = (bool)SipStack::deInitialize();
ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_SipStack_setCodecs) {
{
tdav_codec_id_t arg1 ;
@ -21407,6 +21481,7 @@ static swig_command_info swig_commands[] = {
{"tinyWRAPc::MediaSessionMgr_producerSetInt64", _wrap_MediaSessionMgr_producerSetInt64},
{"tinyWRAPc::MediaSessionMgr_findProxyPluginConsumer", _wrap_MediaSessionMgr_findProxyPluginConsumer},
{"tinyWRAPc::MediaSessionMgr_findProxyPluginProducer", _wrap_MediaSessionMgr_findProxyPluginProducer},
{"tinyWRAPc::MediaSessionMgr_getSessionId", _wrap_MediaSessionMgr_getSessionId},
{"tinyWRAPc::MediaSessionMgr_defaultsSetBandwidthLevel", _wrap_MediaSessionMgr_defaultsSetBandwidthLevel},
{"tinyWRAPc::MediaSessionMgr_defaultsGetBandwidthLevel", _wrap_MediaSessionMgr_defaultsGetBandwidthLevel},
{"tinyWRAPc::MediaSessionMgr_defaultsSetEchoTail", _wrap_MediaSessionMgr_defaultsSetEchoTail},
@ -21687,6 +21762,8 @@ static swig_command_info swig_commands[] = {
{"tinyWRAPc::SipStack_getPreferredIdentity", _wrap_SipStack_getPreferredIdentity},
{"tinyWRAPc::SipStack_isValid", _wrap_SipStack_isValid},
{"tinyWRAPc::SipStack_stop", _wrap_SipStack_stop},
{"tinyWRAPc::SipStack_initialize", _wrap_SipStack_initialize},
{"tinyWRAPc::SipStack_deInitialize", _wrap_SipStack_deInitialize},
{"tinyWRAPc::SipStack_setCodecs", _wrap_SipStack_setCodecs},
{"tinyWRAPc::SipStack_setCodecs_2", _wrap_SipStack_setCodecs_2},
{"tinyWRAPc::SipStack_setCodecPriority", _wrap_SipStack_setCodecPriority},

View File

@ -153,6 +153,7 @@ class MediaSessionMgr(_object):
def producerSetInt64(self, *args): return _tinyWRAP.MediaSessionMgr_producerSetInt64(self, *args)
def findProxyPluginConsumer(self, *args): return _tinyWRAP.MediaSessionMgr_findProxyPluginConsumer(self, *args)
def findProxyPluginProducer(self, *args): return _tinyWRAP.MediaSessionMgr_findProxyPluginProducer(self, *args)
def getSessionId(self, *args): return _tinyWRAP.MediaSessionMgr_getSessionId(self, *args)
__swig_getmethods__["defaultsSetBandwidthLevel"] = lambda x: _tinyWRAP.MediaSessionMgr_defaultsSetBandwidthLevel
if _newclass:defaultsSetBandwidthLevel = staticmethod(_tinyWRAP.MediaSessionMgr_defaultsSetBandwidthLevel)
__swig_getmethods__["defaultsGetBandwidthLevel"] = lambda x: _tinyWRAP.MediaSessionMgr_defaultsGetBandwidthLevel
@ -1142,6 +1143,10 @@ class SipStack(SafeObject):
def getPreferredIdentity(self): return _tinyWRAP.SipStack_getPreferredIdentity(self)
def isValid(self): return _tinyWRAP.SipStack_isValid(self)
def stop(self): return _tinyWRAP.SipStack_stop(self)
__swig_getmethods__["initialize"] = lambda x: _tinyWRAP.SipStack_initialize
if _newclass:initialize = staticmethod(_tinyWRAP.SipStack_initialize)
__swig_getmethods__["deInitialize"] = lambda x: _tinyWRAP.SipStack_deInitialize
if _newclass:deInitialize = staticmethod(_tinyWRAP.SipStack_deInitialize)
__swig_getmethods__["setCodecs"] = lambda x: _tinyWRAP.SipStack_setCodecs
if _newclass:setCodecs = staticmethod(_tinyWRAP.SipStack_setCodecs)
__swig_getmethods__["setCodecs_2"] = lambda x: _tinyWRAP.SipStack_setCodecs_2
@ -1155,6 +1160,14 @@ class SipStack(SafeObject):
SipStack_swigregister = _tinyWRAP.SipStack_swigregister
SipStack_swigregister(SipStack)
def SipStack_initialize():
return _tinyWRAP.SipStack_initialize()
SipStack_initialize = _tinyWRAP.SipStack_initialize
def SipStack_deInitialize():
return _tinyWRAP.SipStack_deInitialize()
SipStack_deInitialize = _tinyWRAP.SipStack_deInitialize
def SipStack_setCodecs(*args):
return _tinyWRAP.SipStack_setCodecs(*args)
SipStack_setCodecs = _tinyWRAP.SipStack_setCodecs

View File

@ -3721,6 +3721,22 @@ SWIG_AsVal_long_SS_long (PyObject *obj, long long *val)
}
SWIGINTERNINLINE PyObject*
SWIG_From_long_SS_long (long long value)
{
return ((value < LONG_MIN) || (value > LONG_MAX)) ?
PyLong_FromLongLong(value) : PyInt_FromLong(static_cast< long >(value));
}
SWIGINTERNINLINE PyObject*
SWIG_From_unsigned_SS_long_SS_long (unsigned long long value)
{
return (value > LONG_MAX) ?
PyLong_FromUnsignedLongLong(value) : PyInt_FromLong(static_cast< long >(value));
}
SWIGINTERN int
SWIG_AsVal_bool (PyObject *obj, bool *val)
{
@ -3851,22 +3867,6 @@ SWIG_AsVal_unsigned_SS_long_SS_long (PyObject *obj, unsigned long long *val)
}
SWIGINTERNINLINE PyObject*
SWIG_From_long_SS_long (long long value)
{
return ((value < LONG_MIN) || (value > LONG_MAX)) ?
PyLong_FromLongLong(value) : PyInt_FromLong(static_cast< long >(value));
}
SWIGINTERNINLINE PyObject*
SWIG_From_unsigned_SS_long_SS_long (unsigned long long value)
{
return (value > LONG_MAX) ?
PyLong_FromUnsignedLongLong(value) : PyInt_FromLong(static_cast< long >(value));
}
SWIGINTERN int
SWIG_AsVal_unsigned_SS_short (PyObject * obj, unsigned short *val)
{
@ -6089,6 +6089,37 @@ fail:
}
SWIGINTERN PyObject *_wrap_MediaSessionMgr_getSessionId(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
MediaSessionMgr *arg1 = (MediaSessionMgr *) 0 ;
twrap_media_type_t arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
int val2 ;
int ecode2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
uint64_t result;
if (!PyArg_ParseTuple(args,(char *)"OO:MediaSessionMgr_getSessionId",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_MediaSessionMgr, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MediaSessionMgr_getSessionId" "', argument " "1"" of type '" "MediaSessionMgr const *""'");
}
arg1 = reinterpret_cast< MediaSessionMgr * >(argp1);
ecode2 = SWIG_AsVal_int(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "MediaSessionMgr_getSessionId" "', argument " "2"" of type '" "twrap_media_type_t""'");
}
arg2 = static_cast< twrap_media_type_t >(val2);
result = (uint64_t)((MediaSessionMgr const *)arg1)->getSessionId(arg2);
resultobj = SWIG_From_unsigned_SS_long_SS_long(static_cast< unsigned long long >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_MediaSessionMgr_defaultsSetBandwidthLevel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
tmedia_bandwidth_level_t arg1 ;
@ -17691,6 +17722,32 @@ fail:
}
SWIGINTERN PyObject *_wrap_SipStack_initialize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
bool result;
if (!PyArg_ParseTuple(args,(char *)":SipStack_initialize")) SWIG_fail;
result = (bool)SipStack::initialize();
resultobj = SWIG_From_bool(static_cast< bool >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_SipStack_deInitialize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
bool result;
if (!PyArg_ParseTuple(args,(char *)":SipStack_deInitialize")) SWIG_fail;
result = (bool)SipStack::deInitialize();
resultobj = SWIG_From_bool(static_cast< bool >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_SipStack_setCodecs(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
tdav_codec_id_t arg1 ;
@ -20874,6 +20931,7 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"MediaSessionMgr_producerSetInt64", _wrap_MediaSessionMgr_producerSetInt64, METH_VARARGS, NULL},
{ (char *)"MediaSessionMgr_findProxyPluginConsumer", _wrap_MediaSessionMgr_findProxyPluginConsumer, METH_VARARGS, NULL},
{ (char *)"MediaSessionMgr_findProxyPluginProducer", _wrap_MediaSessionMgr_findProxyPluginProducer, METH_VARARGS, NULL},
{ (char *)"MediaSessionMgr_getSessionId", _wrap_MediaSessionMgr_getSessionId, METH_VARARGS, NULL},
{ (char *)"MediaSessionMgr_defaultsSetBandwidthLevel", _wrap_MediaSessionMgr_defaultsSetBandwidthLevel, METH_VARARGS, NULL},
{ (char *)"MediaSessionMgr_defaultsGetBandwidthLevel", _wrap_MediaSessionMgr_defaultsGetBandwidthLevel, METH_VARARGS, NULL},
{ (char *)"MediaSessionMgr_defaultsSetEchoTail", _wrap_MediaSessionMgr_defaultsSetEchoTail, METH_VARARGS, NULL},
@ -21198,6 +21256,8 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"SipStack_getPreferredIdentity", _wrap_SipStack_getPreferredIdentity, METH_VARARGS, NULL},
{ (char *)"SipStack_isValid", _wrap_SipStack_isValid, METH_VARARGS, NULL},
{ (char *)"SipStack_stop", _wrap_SipStack_stop, METH_VARARGS, NULL},
{ (char *)"SipStack_initialize", _wrap_SipStack_initialize, METH_VARARGS, NULL},
{ (char *)"SipStack_deInitialize", _wrap_SipStack_deInitialize, METH_VARARGS, NULL},
{ (char *)"SipStack_setCodecs", _wrap_SipStack_setCodecs, METH_VARARGS, NULL},
{ (char *)"SipStack_setCodecs_2", _wrap_SipStack_setCodecs_2, METH_VARARGS, NULL},
{ (char *)"SipStack_setCodecPriority", _wrap_SipStack_setCodecPriority, METH_VARARGS, NULL},

View File

@ -87,12 +87,12 @@ int tdav_speakup_jitterbuffer_put(tmedia_jitterbuffer_t* self, void* data, tsk_s
/* synchronize the reference timestamp */
if(!jitterbuffer->ref_timestamp){
uint64_t epoch = tsk_time_epoch();
uint64_t now = tsk_time_now();
struct timeval tv;
long ts = (rtp_hdr->timestamp/(jitterbuffer->rate/1000));
//=> Do not use (see clock_gettime() on linux): tsk_gettimeofday(&tv, tsk_null);
tv.tv_sec = (long)(epoch)/1000;
tv.tv_usec = (long)(epoch - (tv.tv_sec*1000))*1000;
tv.tv_sec = (long)(now)/1000;
tv.tv_usec = (long)(now - (tv.tv_sec*1000))*1000;
tv.tv_sec -= (ts / jitterbuffer->rate);
tv.tv_usec -= (ts % jitterbuffer->rate) * 125;

View File

@ -35,7 +35,7 @@
#include "tsk_debug.h"
int tdav_speex_jitterbuffer_open(tmedia_jitterbuffer_t* self, uint32_t frame_duration, uint32_t rate)
static int tdav_speex_jitterbuffer_open(tmedia_jitterbuffer_t* self, uint32_t frame_duration, uint32_t rate)
{
tdav_speex_jitterbuffer_t *jitterbuffer = (tdav_speex_jitterbuffer_t *)self;
if(!(jitterbuffer->state = jitter_buffer_init((int)frame_duration))){
@ -48,7 +48,7 @@ int tdav_speex_jitterbuffer_open(tmedia_jitterbuffer_t* self, uint32_t frame_dur
return 0;
}
int tdav_speex_jitterbuffer_tick(tmedia_jitterbuffer_t* self)
static int tdav_speex_jitterbuffer_tick(tmedia_jitterbuffer_t* self)
{
tdav_speex_jitterbuffer_t *jitterbuffer = (tdav_speex_jitterbuffer_t *)self;
if(!jitterbuffer->state){
@ -59,7 +59,7 @@ int tdav_speex_jitterbuffer_tick(tmedia_jitterbuffer_t* self)
return 0;
}
int tdav_speex_jitterbuffer_put(tmedia_jitterbuffer_t* self, void* data, tsk_size_t data_size, const tsk_object_t* proto_hdr)
static int tdav_speex_jitterbuffer_put(tmedia_jitterbuffer_t* self, void* data, tsk_size_t data_size, const tsk_object_t* proto_hdr)
{
tdav_speex_jitterbuffer_t *jitterbuffer = (tdav_speex_jitterbuffer_t *)self;
const trtp_rtp_header_t* rtp_hdr;
@ -88,7 +88,7 @@ int tdav_speex_jitterbuffer_put(tmedia_jitterbuffer_t* self, void* data, tsk_siz
return 0;
}
tsk_size_t tdav_speex_jitterbuffer_get(tmedia_jitterbuffer_t* self, void* out_data, tsk_size_t out_size)
static tsk_size_t tdav_speex_jitterbuffer_get(tmedia_jitterbuffer_t* self, void* out_data, tsk_size_t out_size)
{
tdav_speex_jitterbuffer_t *jitterbuffer = (tdav_speex_jitterbuffer_t *)self;
JitterBufferPacket jb_packet;
@ -120,7 +120,7 @@ tsk_size_t tdav_speex_jitterbuffer_get(tmedia_jitterbuffer_t* self, void* out_da
return out_size;
}
int tdav_speex_jitterbuffer_reset(tmedia_jitterbuffer_t* self)
static int tdav_speex_jitterbuffer_reset(tmedia_jitterbuffer_t* self)
{
tdav_speex_jitterbuffer_t *jitterbuffer = (tdav_speex_jitterbuffer_t *)self;
if(jitterbuffer->state){
@ -129,7 +129,7 @@ int tdav_speex_jitterbuffer_reset(tmedia_jitterbuffer_t* self)
return 0;
}
int tdav_speex_jitterbuffer_close(tmedia_jitterbuffer_t* self)
static int tdav_speex_jitterbuffer_close(tmedia_jitterbuffer_t* self)
{
tdav_speex_jitterbuffer_t *jitterbuffer = (tdav_speex_jitterbuffer_t *)self;
if(jitterbuffer->state){

View File

@ -267,7 +267,7 @@ tsk_size_t tdav_codec_theora_encode(tmedia_codec_t* self, const void* in_data, t
}
// Encode data
//theora->encoder.picture->pts = tsk_time_epoch();
//theora->encoder.picture->pts = tsk_time_now();
theora->encoder.picture->pts = AV_NOPTS_VALUE;
//theora->encoder.picture->pict_type = FF_I_TYPE;
ret = avcodec_encode_video(theora->encoder.context, theora->encoder.buffer, size, theora->encoder.picture);
@ -607,7 +607,7 @@ const tmedia_codec_plugin_def_t *tdav_codec_theora_plugin_def_t = &tdav_codec_th
static void tdav_codec_theora_encap(tdav_codec_theora_t* theora, const uint8_t* pdata, tsk_size_t size)
{
if((theora->encoder.conf_count < THEORA_CONF_SEND_COUNT) && theora->encoder.context && theora->encoder.context->extradata){
if((theora->encoder.conf_last + (250 *theora->encoder.conf_count)) < tsk_time_epoch()){
if((theora->encoder.conf_last + (250 *theora->encoder.conf_count)) < tsk_time_now()){
int hdr_size, i, exd_size = theora->encoder.context->extradata_size, conf_pkt_size = 0;
uint8_t *conf_pkt_ptr = tsk_null, *exd_ptr = theora->encoder.context->extradata;
for(i=0; i<3 && exd_size; i++){
@ -637,7 +637,7 @@ static void tdav_codec_theora_encap(tdav_codec_theora_t* theora, const uint8_t*
TSK_FREE(conf_pkt_ptr);
}
theora->encoder.conf_last = tsk_time_epoch();
theora->encoder.conf_last = tsk_time_now();
theora->encoder.conf_count++;
}
}

View File

@ -35,6 +35,14 @@
int tdav_win32_init()
{
MMRESULT result;
// Timers accuracy
result = timeBeginPeriod(1);
if(result){
TSK_DEBUG_ERROR("timeBeginPeriod(1) returned result=%u", result);
}
return 0;
}
@ -62,6 +70,13 @@ void tdav_win32_print_error(const char* func, HRESULT hr)
int tdav_win32_deinit()
{
MMRESULT result;
// Timers accuracy
result = timeEndPeriod(1);
if(result){
TSK_DEBUG_ERROR("timeEndPeriod(1) returned result=%u", result);
}
return 0;
}

View File

@ -148,7 +148,7 @@ void *run(void* self)
tsk_size_t end;
tsk_size_t total;
tsk_istr_t tid;
int64_t __now = (int64_t)tsk_time_epoch();
int64_t __now = (int64_t)tsk_time_now();
tsk_bool_t error = tsk_false;
TSK_DEBUG_INFO("MSRP SENDER::run -- START");

View File

@ -115,7 +115,7 @@ tnet_dhcp_reply_t* tnet_dhcp_send_request(tnet_dhcp_ctx_t* ctx, tnet_dhcp_reques
}
/* Set timeout */
timeout = tsk_time_epoch() + ctx->timeout;
timeout = tsk_time_now() + ctx->timeout;
do
{

View File

@ -516,6 +516,8 @@ void *tnet_transport_mainthread(void *param)
transport_socket_t* active_socket;
int index;
SetPriorityClass(GetCurrentThread(), REALTIME_PRIORITY_CLASS);
TSK_DEBUG_INFO("Starting [%s] server with IP {%s} on port {%d}...", transport->description, transport->master->ip, transport->master->port);
while(TSK_RUNNABLE(transport)->running || TSK_RUNNABLE(transport)->started)

View File

@ -527,7 +527,7 @@ long tsk_atox(const char* str)
void tsk_strrandom(tsk_istr_t *result)
{
static uint64_t __counter = 1;
tsk_itoa((tsk_time_epoch() ^ (rand())) ^ ++__counter, result);
tsk_itoa((tsk_time_now() ^ (rand())) ^ ++__counter, result);
}
/**@ingroup tsk_string_group

View File

@ -144,18 +144,26 @@ uint64_t tsk_time_get_ms(struct timeval* tv)
* @retval The number of milliseconds since EPOCH.
*/
uint64_t tsk_time_epoch()
{
struct timeval tv;
gettimeofday(&tv, 0);
return (((uint64_t)tv.tv_sec)*(uint64_t)1000) + (((uint64_t)tv.tv_usec)/(uint64_t)1000);
}
uint64_t tsk_time_now()
{
#if TSK_UNDER_WINDOWS
return (uint64_t)timeGetTime();
static LARGE_INTEGER __liFrequency = {0};
LARGE_INTEGER liPerformanceCount;
if(!__liFrequency.QuadPart){
QueryPerformanceFrequency(&__liFrequency);
}
QueryPerformanceCounter(&liPerformanceCount);
return (uint64_t)(((double)liPerformanceCount.QuadPart/(double)__liFrequency.QuadPart)*1000.0);
#elif HAVE_CLOCK_GETTIME || _POSIX_TIMERS > 0
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return (((uint64_t)ts.tv_sec)*(uint64_t)1000) + (((uint64_t)ts.tv_nsec)/(uint64_t)1000000);
#elif defined(__APPLE__) && 0
if(__apple_timebase_info.denom == 0){
(void) mach_timebase_info(&__apple_timebase_info);
}
return (mach_absolute_time() * __apple_timebase_info.numer / __apple_timebase_info.denom)*1e-6;
#else
struct timeval tv;
gettimeofday(&tv, 0);
@ -163,23 +171,3 @@ uint64_t tsk_time_epoch()
#endif
}
//int tsk_time_epoch_2(struct timespec *ts)
//{
//#if HAVE_CLOCK_GETTIME || _POSIX_TIMERS > 0
// clock_gettime(CLOCK_MONOTONIC, ts);
//#elif defined(__APPLE__) && 0
// if(__apple_timebase_info.denom == 0){
// (void) mach_timebase_info(&__apple_timebase_info);
// }
// uint64_t nano = mach_absolute_time() * __apple_timebase_info.numer / __apple_timebase_info.denom;
// ts->tv_sec = nano * 1e-9;
// ts->tv_nsec = nano - (ts->tv_sec * 1e9);
//#else
// struct timeval tv;
// gettimeofday(&tv, tsk_null);
// ts->tv_sec = tv.tv_sec;
// ts->tv_nsec = tv.tv_usec * 1000;
//#endif
// return 0;
//}

View File

@ -48,27 +48,9 @@ struct timespec;
TINYSAK_API int tsk_gettimeofday(struct timeval *tv, struct timezone *tz);
TINYSAK_API uint64_t tsk_time_get_ms(struct timeval *tv);
TINYSAK_API uint64_t tsk_time_epoch();
TINYSAK_API uint64_t tsk_time_now();
/**@ingroup tsk_time_group
* Gets the number of milliseconds since the EPOCH.
*/
#define tsk_time_now() tsk_time_epoch()
//#ifdef _WIN32_WCE
//
//#ifndef TIMEVAL
///* On wince timeval struct is defined in "Winsock2.h" but I don't want to add it */
//struct timeval
//{
// long tv_sec;
// long tv_usec;
//};
//#define TIMEVAL
//#endif TIMEVAL
//
//#endif
TSK_END_DECLS
#endif /* _TINYSAK_TIME_H_ */

View File

@ -141,7 +141,7 @@ void tsk_timer_manager_debug(tsk_timer_manager_handle_t *self)
tsk_list_foreach(item, manager->timers){
tsk_timer_t* timer = item->data;
TSK_DEBUG_INFO("timer [%llu]- %llu, %llu", timer->id, timer->timeout, tsk_time_epoch());
TSK_DEBUG_INFO("timer [%llu]- %llu, %llu", timer->id, timer->timeout, tsk_time_now());
}
tsk_mutex_unlock(manager->mutex);
@ -241,6 +241,16 @@ int tsk_timer_manager_cancel(tsk_timer_manager_handle_t *self, tsk_timer_id_t id
return ret;
}
int tsk_timer_manager_destroy(tsk_timer_manager_handle_t **self)
{
if(!self || !*self){
TSK_DEBUG_ERROR("Invalid parameter");
return -1;
}
TSK_OBJECT_SAFE_FREE(*self);
return 0;
}
static void *run(void* self)
{
int ret;
@ -248,7 +258,7 @@ static void *run(void* self)
tsk_timer_manager_t *manager = self;
TSK_RUNNABLE(manager)->running = tsk_true; // VERY IMPORTANT --> needed by the main thread
/* create main thread */
if((ret = tsk_thread_create(&(manager->mainThreadId[0]), __tsk_timer_manager_mainthread, manager))){
TSK_DEBUG_FATAL("Failed to create mainthread: %d\n", ret);
@ -259,7 +269,7 @@ static void *run(void* self)
TSK_RUNNABLE_RUN_BEGIN(manager);
if(curr = TSK_RUNNABLE_POP_FIRST(manager)){
if(curr = TSK_RUNNABLE_POP_FIRST_SAFE(TSK_RUNNABLE(manager))){
tsk_timer_t *timer = (tsk_timer_t *)curr->data;
if(timer->callback){
timer->callback(timer->arg, timer->id);
@ -292,7 +302,7 @@ static void *__tsk_timer_manager_mainthread(void *param)
tsk_timer_manager_t *manager = param;
TSK_DEBUG_INFO("TIMER MANAGER -- START");
while(TSK_RUNNABLE(manager)->running){
tsk_semaphore_decrement(manager->sem);
@ -306,13 +316,13 @@ peek_first:
tsk_mutex_unlock(manager->mutex);
if(curr && !curr->canceled) {
epoch = tsk_time_epoch();
epoch = tsk_time_now();
if(epoch >= curr->timeout){
tsk_timer_t *timer = tsk_object_ref(curr);
//TSK_DEBUG_INFO("Timer raise %llu", timer->id);
tsk_mutex_lock(manager->mutex);
TSK_RUNNABLE_ENQUEUE_OBJECT(TSK_RUNNABLE(manager), timer);
TSK_RUNNABLE_ENQUEUE_OBJECT_SAFE(TSK_RUNNABLE(manager), timer);
tsk_list_remove_item_by_data(manager->timers, curr);
tsk_mutex_unlock(manager->mutex);
}
@ -493,7 +503,7 @@ static tsk_object_t* tsk_timer_ctor(tsk_object_t * self, va_list * app)
timer->callback = va_arg(*app, tsk_timer_callback_f);
timer->arg = va_arg(*app, const void *);
timer->timeout += tsk_time_epoch();
timer->timeout += tsk_time_now();
}
return self;
}

View File

@ -74,6 +74,7 @@ TINYSAK_API void tsk_timer_manager_debug(tsk_timer_manager_handle_t *self);
TINYSAK_API tsk_timer_id_t tsk_timer_manager_schedule(tsk_timer_manager_handle_t *self, uint64_t timeout, tsk_timer_callback_f callback, const void *arg);
TINYSAK_API int tsk_timer_manager_cancel(tsk_timer_manager_handle_t *self, tsk_timer_id_t id);
TINYSAK_API int tsk_timer_manager_destroy(tsk_timer_manager_handle_t **self);
// Global Timer manager

View File

@ -50,12 +50,12 @@ int tsk_uuidgenerate(tsk_uuidstring_t *result)
* Note that the 160 bit SHA-1 hash is truncated to 128 bits to make the length work out.
*/
tsk_sha1string_t sha1result;
tsk_istr_t epoch;
tsk_istr_t now;
unsigned i, k;
static char HEX[] = "0123456789abcdef";
tsk_itoa(tsk_time_epoch(), &epoch);
tsk_sha1compute(epoch, sizeof(epoch), &sha1result);
tsk_itoa(tsk_time_now(), &now);
tsk_sha1compute(now, sizeof(now), &sha1result);
/* XOR the SHA-1 result with random numbers. */
for(i=0; i<(TSK_UUID_DIGEST_SIZE*2); i+=4){