Apply patches provided by Laurent Etiemble to fix crashes on 64-bit systems.

Begin implementing G.711 codecs.
This commit is contained in:
bossiel 2010-06-09 17:24:50 +00:00
parent dcdb3dd3ac
commit 6d20f94fb4
40 changed files with 282 additions and 91 deletions

View File

@ -68,7 +68,7 @@ int tdav_consumer_audio_cmp(const tsk_object_t* consumer1, const tsk_object_t* c
#define tdav_consumer_audio_pause(self) tmedia_consumer_pause(TDAV_CONSUMER_AUDIO(self))
#define tdav_consumer_audio_stop(self) tmedia_consumer_stop(TDAV_CONSUMER_AUDIO(self))
int tdav_consumer_audio_put(tdav_consumer_audio_t* self, void** data);
int tdav_consumer_audio_get(tdav_consumer_audio_t* self);
void* tdav_consumer_audio_get(tdav_consumer_audio_t* self);
int tdav_consumer_audio_deinit(tdav_consumer_audio_t* self);
#define TDAV_DECLARE_CONSUMER_AUDIO tdav_consumer_audio_t __consumer_audio__

View File

@ -61,7 +61,7 @@ int tdav_consumer_audio_init(tdav_consumer_audio_t* self)
/* self:jitterbuffer */
if(!self->jb.jbuffer){
self->jb.jbuffer = jb_new();
self->jb.jcodec = JB_CODEC_OTHER;
self->jb.jcodec = JB_CODEC_OTHER; // FIXME: e.g. JB_CODEC_G711x
}
tsk_safeobj_init(self);
@ -94,7 +94,7 @@ int tdav_consumer_audio_put(tdav_consumer_audio_t* self, void** data)
}
tsk_safeobj_lock(self);
ts += (self->ptime * self->rate)/1000;
ts += /*(self->ptime * self->rate)/1000*/self->ptime;
jb_put(self->jb.jbuffer, *data, JB_TYPE_VOICE, self->ptime, ts, (long)tsk_time_now(), self->jb.jcodec);
*data = tsk_null;
tsk_safeobj_unlock(self);
@ -103,14 +103,14 @@ int tdav_consumer_audio_put(tdav_consumer_audio_t* self, void** data)
}
/* get data drom the jitter buffer */
int tdav_consumer_audio_get(tdav_consumer_audio_t* self)
void* tdav_consumer_audio_get(tdav_consumer_audio_t* self)
{
void* data = tsk_null;
int jret;
if(!self || !self->jb.jbuffer){
TSK_DEBUG_ERROR("Invalid parameter");
return -1;
return tsk_null;
}
tsk_safeobj_lock(self);
@ -131,10 +131,8 @@ int tdav_consumer_audio_get(tdav_consumer_audio_t* self)
default:
break;
}
TSK_FREE(data);
return 0;
return data;
}
/* tsk_safeobj_lock(self); */

View File

@ -40,7 +40,7 @@
extern const tmedia_codec_t* _tmedia_session_match_codec(tmedia_session_t* self, const tsdp_header_M_t* M, char** format);
static int tdav_session_audio_rtp_cb(const void* callback_data, struct trtp_rtp_packet_s* packet)
static int tdav_session_audio_rtp_cb(const void* callback_data, const struct trtp_rtp_packet_s* packet)
{
tdav_session_audio_t* audio = (tdav_session_audio_t*)callback_data;
@ -50,7 +50,16 @@ static int tdav_session_audio_rtp_cb(const void* callback_data, struct trtp_rtp_
}
if(audio->consumer){
return tmedia_consumer_consume(audio->consumer, packet->payload.data, packet->payload.size);
/* decode data--> FIXME:we should lock negociated codec */
if(TMEDIA_SESSION(audio)->negociated_codec && TMEDIA_SESSION(audio)->negociated_codec->plugin && TMEDIA_SESSION(audio)->negociated_codec->plugin->decode){
void* out_data = tsk_null;
tsk_size_t out_size;
out_size = TMEDIA_SESSION(audio)->negociated_codec->plugin->decode(TMEDIA_SESSION(audio)->negociated_codec, packet->payload.data, packet->payload.size, &out_data);
if(out_size){
tmedia_consumer_consume(audio->consumer, &out_data, out_size);
}
TSK_FREE(out_data);
}
}
return 0;
}

View File

@ -104,7 +104,7 @@ static int write_wavehdr(tdav_consumer_waveapi_t* consumer, tsk_size_t index)
static int play_wavehdr(tdav_consumer_waveapi_t* consumer, LPWAVEHDR lpHdr)
{
MMRESULT result;
tsk_size_t i;
void* data;
if(!consumer || !lpHdr || !consumer->hWaveOut){
TSK_DEBUG_ERROR("Invalid parameter");
@ -122,9 +122,13 @@ static int play_wavehdr(tdav_consumer_waveapi_t* consumer, LPWAVEHDR lpHdr)
// Fill lpHdr->Data with decoded data
//
//
tdav_consumer_audio_get(TDAV_CONSUMER_AUDIO(consumer)); /* FIXXXXXXXXXXXME */
for(i = 0; i<lpHdr->dwBufferLength; i++){
lpHdr->lpData[i] = rand();
if((data = tdav_consumer_audio_get(TDAV_CONSUMER_AUDIO(consumer)))){
memcpy(lpHdr->lpData, data, lpHdr->dwBufferLength);
TSK_FREE(data);
}
else{
/* Put silence */
memset(lpHdr->lpData, 0, lpHdr->dwBufferLength);
}
if(!consumer->started){
@ -250,7 +254,7 @@ int tdav_consumer_waveapi_start(tmedia_consumer_t* self)
}
/* open */
result = waveOutOpen((HWAVEOUT *)&consumer->hWaveOut, WAVE_MAPPER, &consumer->wfx, (DWORD)consumer->events[0], tsk_null, CALLBACK_EVENT);
result = waveOutOpen((HWAVEOUT *)&consumer->hWaveOut, WAVE_MAPPER, &consumer->wfx, (DWORD)consumer->events[0], (DWORD_PTR)consumer, CALLBACK_EVENT);
if(result != MMSYSERR_NOERROR){
print_last_error(result, "waveOutOpen");
return -2;
@ -269,24 +273,18 @@ int tdav_consumer_waveapi_start(tmedia_consumer_t* self)
return 0;
}
int tdav_consumer_waveapi_consume(tmedia_consumer_t* self, const void* buffer, tsk_size_t size)
int tdav_consumer_waveapi_consume(tmedia_consumer_t* self, void** buffer, tsk_size_t size)
{
tdav_consumer_waveapi_t* consumer = (tdav_consumer_waveapi_t*)self;
void* data;
TSK_DEBUG_INFO("tdav_consumer_waveapi_consume");
if(!consumer || !buffer || !size){
if(!consumer || !buffer || !*buffer || !size){
TSK_DEBUG_ERROR("Invalid parameter");
return -1;
}
/* buffer is already decoded */
/* FIXME: should own the buffer */
data = tsk_calloc(size, sizeof(uint8_t));
memcpy(data, buffer, size);
return tdav_consumer_audio_put(TDAV_CONSUMER_AUDIO(consumer), &data);
return tdav_consumer_audio_put(TDAV_CONSUMER_AUDIO(consumer), buffer);
}
int tdav_consumer_waveapi_pause(tmedia_consumer_t* self)

View File

@ -29,18 +29,33 @@
*/
#include "tinydav/codecs/g711/tdav_codec_g711.h"
#include "tinydav/codecs/g711/g711.h" /* alforithms */
#include "tsk_memory.h"
#include "tsk_debug.h"
/* ============ G.711u Plugin interface ================= */
#define tdav_codec_g711u_fmtp_get tsk_null
#define tdav_codec_g711u_fmtp_set tsk_null
tsk_size_t tdav_codec_g711u_fmtp_encode(tmedia_codec_t* self, const void* in_data, tsk_size_t in_size, void** out_data)
{
return 0;
}
tsk_size_t tdav_codec_g711u_fmtp_decode(tmedia_codec_t* self, const void* in_data, tsk_size_t in_size, void** out_data)
{
return 0;
}
tsk_bool_t tdav_codec_g711u_fmtp_match(const tmedia_codec_t* codec, const char* fmtp)
{ /* always match */
return tsk_true;
}
//=======================================================
//
// G.711u Plugin definition
//
@ -93,6 +108,8 @@ static const tmedia_codec_plugin_def_t tdav_codec_g711u_plugin_def_s =
/* video */
{0},
tdav_codec_g711u_fmtp_encode,
tdav_codec_g711u_fmtp_decode,
tdav_codec_g711u_fmtp_match,
tdav_codec_g711u_fmtp_get,
tdav_codec_g711u_fmtp_set
@ -105,13 +122,44 @@ const tmedia_codec_plugin_def_t *tdav_codec_g711u_plugin_def_t = &tdav_codec_g71
#define tdav_codec_g711a_fmtp_get tsk_null
#define tdav_codec_g711a_fmtp_set tsk_null
tsk_size_t tdav_codec_g711a_fmtp_encode(tmedia_codec_t* self, const void* in_data, tsk_size_t in_size, void** out_data)
{
return 0;
}
tsk_size_t tdav_codec_g711a_fmtp_decode(tmedia_codec_t* self, const void* in_data, tsk_size_t in_size, void** out_data)
{
tsk_size_t i;
if(!in_data || !in_size || !out_data){
TSK_DEBUG_ERROR("Invalid parameter");
return 0;
}
/* free old buffer */
if(*out_data){
TSK_FREE(*out_data);
}
/* allocate new buffer */
if(!(*out_data = tsk_calloc(in_size, sizeof(short)))){
TSK_DEBUG_ERROR("Failed to allocate new buffer");
return 0;
}
for(i = 0; i<in_size; i++){
((short*)*out_data)[i] = alaw2linear(((uint8_t*)in_data)[i]);
}
return (in_size*2);
}
tsk_bool_t tdav_codec_g711a_fmtp_match(const tmedia_codec_t* codec, const char* fmtp)
{ /* always match */
return tsk_true;
}
//======================================================
//
// G.711a Plugin definition
//
@ -164,6 +212,8 @@ static const tmedia_codec_plugin_def_t tdav_codec_g711a_plugin_def_s =
/* video */
{0},
tdav_codec_g711a_fmtp_encode,
tdav_codec_g711a_fmtp_decode,
tdav_codec_g711a_fmtp_match,
tdav_codec_g711a_fmtp_get,
tdav_codec_g711a_fmtp_set

View File

@ -6,36 +6,42 @@
%%pwd mamadou
%%proxy_ip 192.168.16.104 # IP address or FQDN
%%proxy_port 5060
%%proxy_trans udp # udp, tcp, tls or sctp
%%expires 36 # expires used by all dialogs
%%proxy_trans tcp # udp, tcp, tls or sctp
%%expires 100 # expires used by all dialogs
%%sleep-sec 1.0 # number of seconds to wait before sending next sip message
%%reg-sid
%%sub-reg-sid
%%sub-pres-sid
%%pub-sid
%%inv_audio_sid
# Configure the stack
# Realm, IMPI and IMPU are mandatory
++cst --realm $$(domain) --impi $$(user)@$$(domain) --impu sip:$$(user)@$$(domain) --pwd $$(pwd) \
--pcscf-ip $$(proxy_ip) --pcscf-port $$(proxy_port) --pcscf-trans $$(proxy_trans)\
--header Privacy=header;id --header Allow=INVITE, ACK, CANCEL, BYE, MESSAGE, OPTIONS, NOTIFY, PRACK, UPDATE, REFER \
--pcscf-ip $$(proxy_ip) --pcscf-port $$(proxy_port) --pcscf-trans $$(proxy_trans) \
--header Privacy=none --header Allow=INVITE, ACK, CANCEL, BYE, MESSAGE, OPTIONS, NOTIFY, PRACK, UPDATE, REFER \
--header P-Access-Network-Info=ADSL;utran-cell-id-3gpp=00000000 \
--header User-Agent=IM-client/OMA1.0 doubango/v1.0.0 # last should not have backslash
# Run the engine
++r
# OPTIONS to hack AOR
#++opt
#++sleep --sec $$(sleep-sec)
# REGISTER
++reg --xp $$(expires) --caps +g.oma.sip-im --caps +g.3gpp.smsip --caps language="en,fr" \
--header Action-Header=Myheader-value @@action\
--header Action-Header=Myheader-value @@action \
>>(reg-sid)
# sleep
++sleep --sec $$(sleep-sec)
# SUBSCRIBE to reg event package
#++sub --to sip:$$(user)@$$(domain) --xp $$(expires) --header Event=reg --header Accept=application/reginfo+xml \
# SUBSCRIBE to reg event package (silent hangup)
#++sub --to sip:$$(user)@$$(domain) --xp $$(expires) --silent --header Event=reg --header Accept=application/reginfo+xml \
# --header Allow-Events=refer, presence, presence.winfo, xcap-diff, conference >>(sub-reg-sid)
#SUBSCRIBE to presence event package (alice)
@ -46,17 +52,31 @@
#PUBLISH
#++sn --path ./publish.sn
#++sleep --sec -1 # Press ENTER
#send Pager Mode IM
#++m --to sip:alice@$$(domain) \
# --header NS=imdn <urn:ietf:params:imdn> \
# --header imdn.Message-ID=34jk324j \
# --header DateTime=2006-04-04T12:16:49-05:00 \
# --header imdn.Disposition-Notification=positive-delivery, negative-delivery \
# --header Content-Type=text/plain \
# --pay Hello World
#Send Binary SMS (RP-DATA)
#++sms --smsc sip:+33185145269@$$(domain);user=phone;npi=ISDN --to sip:+33685214585@$$(domain);user=phone \
# --header Content-Type=application/vnd.3gpp.sms \
# --header Transfer-Encoding=binary \
# --pay hello world
# MESSAGE
#++m --to sip:alice@$$(domain) --pay Test SMS-RPDATA --header Content-Type=application/vnd.3gpp.sms --header Transfer-Encoding=binary
# INVITE
++audio --to sip:alice@$$(domain)
#send INVITE
++a --to sip:bob@$$(domain) >>(inv_audio_sid)
#++sleep --sec -1
#++ho --sid $$(inv_audio_sid)
#++sleep --sec -1
#++res --sid $$(inv_audio_sid)
# sleep
++sleep --sec -1 # Press ENTER
# Press ENTER
++sleep --sec -1
# unsunscribe (reg and pres)
#++hu --sid $$(sub-reg-sid)
@ -67,7 +87,7 @@
#++sleep --sec $$(sleep-sec)
# unregister
++hu --sid $$(reg-sid)
#++hu --sid $$(reg-sid)
# sleep
#++sleep --sec $$(sleep-sec)

View File

@ -5,13 +5,13 @@
#++sn --path ./core-colibria.sn
# Ericsson
++sn --path ./core-ericsson.sn
#++sn --path ./core-ericsson.sn
# Inexbee
#++sn --path ./core-inexbee.sn
# Micromethod
#++sn --path ./core-micromethod.sn
++sn --path ./core-micromethod.sn
# Nokia Siemens Networks
#++sn --path ./core-nsn.sn

View File

@ -85,7 +85,7 @@ THTTP_BEGIN_DECLS
typedef enum thttp_stack_param_type_e
{
thttp_pname_null = tsk_null,
thttp_pname_null = 0,
#define THTTP_STACK_SET_NULL() thttp_pname_null
/* Network */

View File

@ -75,7 +75,7 @@ thttp_action_type_t;
typedef enum thttp_action_param_type_e
{
thttp_aptype_null = tsk_null,
thttp_aptype_null = 0,
thttp_aptype_option,
thttp_aptype_header,

View File

@ -65,7 +65,7 @@ thttp_session_option_t;
typedef enum thttp_session_param_type_e
{
httpp_null = tsk_null,
httpp_null = 0,
httpp_option,
httpp_cred,

View File

@ -164,6 +164,10 @@ typedef struct tmedia_codec_plugin_def_s
/* ...to be continued */
} video;
//! encode data
tsk_size_t (*encode) (tmedia_codec_t*, const void* in_data, tsk_size_t in_size, void** out_data);
//! decode data
tsk_size_t (*decode) (tmedia_codec_t*, const void* in_data, tsk_size_t in_size, void** out_data);
//! whether the codec can handle the fmtp
tsk_bool_t (* fmtp_match) (const tmedia_codec_t*, const char* );
//! gets fmtp value. e.g. "mode-set=0,2,5,7; mode-change-period=2; mode-change-neighbor=1"

View File

@ -67,7 +67,7 @@ typedef struct tmedia_consumer_plugin_def_s
int (* prepare) (tmedia_consumer_t*, const tmedia_codec_t* );
int (* start) (tmedia_consumer_t* );
int (* consume) (tmedia_consumer_t*, const void* buffer, tsk_size_t size);
int (* consume) (tmedia_consumer_t*, void** buffer, tsk_size_t size);
int (* pause) (tmedia_consumer_t* );
int (* stop) (tmedia_consumer_t* );
}
@ -79,7 +79,7 @@ TINYMEDIA_API tmedia_consumer_t* tmedia_consumer_create(tmedia_type_t type);
TINYMEDIA_API int tmedia_consumer_init(tmedia_consumer_t* self);
TINYMEDIA_API int tmedia_consumer_prepare(tmedia_consumer_t *self, const tmedia_codec_t* codec);
TINYMEDIA_API int tmedia_consumer_start(tmedia_consumer_t *self);
TINYMEDIA_API int tmedia_consumer_consume(tmedia_consumer_t* self, const void* buffer, tsk_size_t size);
TINYMEDIA_API int tmedia_consumer_consume(tmedia_consumer_t* self, void** buffer, tsk_size_t size);
TINYMEDIA_API int tmedia_consumer_pause(tmedia_consumer_t *self);
TINYMEDIA_API int tmedia_consumer_stop(tmedia_consumer_t *self);
TINYMEDIA_API int tmedia_consumer_deinit(tmedia_consumer_t* self);

View File

@ -199,7 +199,7 @@ tmedia_session_mgr_t;
typedef enum tmedia_session_param_type_e
{
tmedia_sptype_null = tsk_null,
tmedia_sptype_null = 0,
tmedia_sptype_remote_ip,
tmedia_sptype_local_ip,

View File

@ -37,6 +37,8 @@
#define tmedia_codec_dpcmu_fmtp_get tsk_null
#define tmedia_codec_dpcmu_fmtp_set tsk_null
#define tmedia_codec_dpcmu_fmtp_encode tsk_null
#define tmedia_codec_dpcmu_fmtp_decode tsk_null
tsk_bool_t tmedia_codec_dpcmu_fmtp_match(const tmedia_codec_t* codec, const char* fmtp)
{ /* always match */
@ -91,7 +93,8 @@ static const tmedia_codec_plugin_def_t tmedia_codec_dpcmu_plugin_def_s =
/* video */
{0},
tmedia_codec_dpcmu_fmtp_encode,
tmedia_codec_dpcmu_fmtp_decode,
tmedia_codec_dpcmu_fmtp_match,
tmedia_codec_dpcmu_fmtp_get,
tmedia_codec_dpcmu_fmtp_set
@ -104,6 +107,8 @@ const tmedia_codec_plugin_def_t *tmedia_codec_dpcmu_plugin_def_t = &tmedia_codec
#define tmedia_codec_dpcma_fmtp_get tsk_null
#define tmedia_codec_dpcma_fmtp_set tsk_null
#define tmedia_codec_dpcma_fmtp_encode tsk_null
#define tmedia_codec_dpcma_fmtp_decode tsk_null
tsk_bool_t tmedia_codec_dpcma_fmtp_match(const tmedia_codec_t* codec, const char* fmtp)
{ /* always match */
@ -159,6 +164,8 @@ static const tmedia_codec_plugin_def_t tmedia_codec_dpcma_plugin_def_s =
/* video */
{0},
tmedia_codec_dpcma_fmtp_encode,
tmedia_codec_dpcma_fmtp_decode,
tmedia_codec_dpcma_fmtp_match,
tmedia_codec_dpcma_fmtp_get,
tmedia_codec_dpcma_fmtp_set
@ -171,6 +178,16 @@ const tmedia_codec_plugin_def_t *tmedia_codec_dpcma_plugin_def_t = &tmedia_codec
// Dummy H.263 object definition
//
tsk_size_t tmedia_codec_dh263_fmtp_encode(tmedia_codec_t* self, const void* in_data, tsk_size_t in_size, void** out_data)
{
return 0;
}
tsk_size_t tmedia_codec_dh263_fmtp_decode(tmedia_codec_t* self, const void* in_data, tsk_size_t in_size, void** out_data)
{
return 0;
}
tsk_bool_t tmedia_codec_dh263_fmtp_match(const tmedia_codec_t* codec, const char* fmtp)
{
/* check whether we can match this fmtp with our local
@ -237,6 +254,8 @@ static const tmedia_codec_plugin_def_t tmedia_codec_dh263_plugin_def_s =
/* video */
{176, 144},
tmedia_codec_dh263_fmtp_encode,
tmedia_codec_dh263_fmtp_decode,
tmedia_codec_dh263_fmtp_match,
tmedia_codec_dh263_fmtp_get,
tmedia_codec_dh263_fmtp_set
@ -250,6 +269,16 @@ const tmedia_codec_plugin_def_t *tmedia_codec_dh263_plugin_def_t = &tmedia_codec
// Dummy H.264 (Base profile 10) object definition
//
tsk_size_t tmedia_codec_dh264_fmtp_encode(tmedia_codec_t* self, const void* in_data, tsk_size_t in_size, void** out_data)
{
return 0;
}
tsk_size_t tmedia_codec_dh264_fmtp_decode(tmedia_codec_t* self, const void* in_data, tsk_size_t in_size, void** out_data)
{
return 0;
}
tsk_bool_t tmedia_codec_dh264_fmtp_match(const tmedia_codec_t* codec, const char* fmtp)
{
/* check whether we can match this fmtp with our local
@ -316,6 +345,8 @@ static const tmedia_codec_plugin_def_t tmedia_codec_dh264_plugin_def_s =
/* video */
{176, 144},
tmedia_codec_dh264_fmtp_encode,
tmedia_codec_dh264_fmtp_decode,
tmedia_codec_dh264_fmtp_match,
tmedia_codec_dh264_fmtp_get,
tmedia_codec_dh264_fmtp_set

View File

@ -88,7 +88,7 @@ int tmedia_consumer_start(tmedia_consumer_t *self)
* @param buffer Pointer to the data to consume
* @param size Size of the data to consume
*/
int tmedia_consumer_consume(tmedia_consumer_t* self, const void* buffer, tsk_size_t size)
int tmedia_consumer_consume(tmedia_consumer_t* self, void** buffer, tsk_size_t size)
{
if(!self || !self->plugin || !self->plugin->consume){
TSK_DEBUG_ERROR("Invalid parameter");

View File

@ -131,7 +131,7 @@ int tmedia_qos_tline_to_sdp(const tmedia_qos_tline_t* self, tsdp_header_M_t* m)
{
if(!self || !m){
TSK_DEBUG_ERROR("Invalid parameter");
return tsk_null;
return -1;
}
switch(self->type){

View File

@ -228,7 +228,7 @@ int _tmedia_session_prepare_lo(tmedia_session_t* self)
int ret;
if(!self || !self->plugin || !self->plugin->prepare){
TSK_DEBUG_ERROR("Invalid parameter");
return tsk_null;
return -1;
}
if(self->prepared){
TSK_DEBUG_WARN("Session already prepared");

View File

@ -52,7 +52,7 @@ tnet_dns_message_t* tnet_dns_message_create(const char* qname, tnet_dns_qclass_t
*/
tnet_dns_message_t* tnet_dns_message_create_null()
{
return tnet_dns_message_create(tsk_null, qclass_any, qtype_any, tsk_null);
return tnet_dns_message_create(tsk_null, qclass_any, qtype_any, tsk_false);
}
/**@ingroup tnet_dns_group

View File

@ -128,8 +128,12 @@ int tnet_transport_get_ip_n_port_2(const tnet_transport_handle_t *handle, tnet_i
const tnet_transport_t *transport = handle;
if(transport){
// do not check the master, let the apllication die if "null"
memcpy(*ip, transport->master->ip, sizeof(transport->master->ip));
*port = transport->master->port;
if(ip){
memcpy(*ip, transport->master->ip, sizeof(transport->master->ip));
}
if(port){
*port = transport->master->port;
}
}
else{
TSK_DEBUG_ERROR("NULL transport object.");

View File

@ -491,7 +491,7 @@ void *tnet_transport_mainthread(void *param)
void* buffer = 0;
tnet_transport_event_t* e;
TSK_DEBUG_INFO("NETWORK EVENT FOR SERVER [%s] -- TNET_POLLIN", transport->description);
/* TSK_DEBUG_INFO("NETWORK EVENT FOR SERVER [%s] -- TNET_POLLIN", transport->description); */
/* Retrieve the amount of pending data.
* IMPORTANT: If you are using Symbian please update your SDK to the latest build (August 2009) to have 'FIONREAD'.
@ -540,10 +540,10 @@ void *tnet_transport_mainthread(void *param)
TNET_PRINT_LAST_ERROR("recv have failed.");
continue;
}
else if(len != (tsk_size_t)ret){ /* useless test */
else if((len != (tsk_size_t)ret) && len){ /* useless test? */
len = (tsk_size_t)ret;
buffer = tsk_realloc(buffer, len);
}
e = tnet_transport_event_create(event_data, transport->callback_data, active_socket->fd);
e->data = buffer;

View File

@ -559,7 +559,7 @@ void *tnet_transport_mainthread(void *param)
DWORD readCount = 0;
WSABUF wsaBuffer;
TSK_DEBUG_INFO("NETWORK EVENT FOR SERVER [%s] -- FD_READ", transport->description);
/* TSK_DEBUG_INFO("NETWORK EVENT FOR SERVER [%s] -- FD_READ", transport->description); */
if(networkEvents.iErrorCode[FD_READ_BIT]){
TSK_RUNNABLE_ENQUEUE(transport, event_error, transport->callback_data, active_socket->fd);
@ -596,6 +596,10 @@ void *tnet_transport_mainthread(void *param)
}
else{
ret = WSARecv(active_socket->fd, &wsaBuffer, 1, &readCount, &flags, 0, 0);
if(readCount < wsaBuffer.len){
wsaBuffer.len = readCount;
wsaBuffer.buf = tsk_realloc(wsaBuffer.buf, readCount);
}
}
if(ret){

View File

@ -38,8 +38,8 @@ TRTP_BEGIN_DECLS
/* Forward declarations */
struct trtp_rtp_packet_s;
typedef int (*trtp_manager_rtp_cb_f)(const void* callback_data, struct trtp_rtp_packet_s* packet);
typedef int (*trtp_manager_rtcp_cb_f)(const void* callback_data, struct trtp_rtpc_packet_s* packet);
typedef int (*trtp_manager_rtp_cb_f)(const void* callback_data, const struct trtp_rtp_packet_s* packet);
typedef int (*trtp_manager_rtcp_cb_f)(const void* callback_data, const struct trtp_rtpc_packet_s* packet);
/** RTP/RTCP manager */
typedef struct trtp_manager_s

View File

@ -93,6 +93,7 @@ int tsk_buffer_append_2(tsk_buffer_t* self, const char* format, ...)
va_list ap;
char *buffer;
tsk_size_t oldsize;
va_list ap2;
if(!self){
return -1;
@ -101,8 +102,9 @@ int tsk_buffer_append_2(tsk_buffer_t* self, const char* format, ...)
oldsize = self->size;
buffer = (char*)TSK_BUFFER_DATA(self);
/* initialize variable arguments */
/* initialize variable arguments (needed for 64bit platforms where vsnprintf will change the va_list) */
va_start(ap, format);
va_start(ap2, format);
/* compute destination len for windows mobile
*/
@ -129,11 +131,12 @@ int tsk_buffer_append_2(tsk_buffer_t* self, const char* format, ...)
#if !defined(_MSC_VER) || defined(__GNUC__)
+1
#endif
, format, ap);
, format, ap2);
#endif
/* reset variable arguments */
va_end( ap );
va_end(ap);
va_end(ap2);
self->data = buffer;
self->size = (oldsize+len);
@ -255,7 +258,7 @@ int tsk_buffer_insert(tsk_buffer_t* self, tsk_size_t position, const void* data,
memcpy(((uint8_t*)self->data) + position, data, size);
}
else{
memset(((uint8_t*)self->data) + position, tsk_null, size);
memset(((uint8_t*)self->data) + position, 0, size);
}
return 0;

View File

@ -50,7 +50,10 @@ typedef int tsk_boolean_t;
typedef int tsk_ssize_t; /**< Signed size */
typedef unsigned int tsk_size_t; /**< Unsigned size */
#define tsk_null 0 /**< Null pointer */
#ifdef NULL
#define tsk_null NULL /**< Null pointer */
#else
#define tsk_null 0 /**< Null pointer */
#endif
#endif /* _TINYSAK_COMMON_H_ */

View File

@ -42,8 +42,8 @@ TSK_BEGIN_DECLS
*/
#define TSK_LIST_IS_EMPTY(self) (self ? (!self->head) : tsk_true)
#define TSK_LIST_IS_FIRST(self, item) (self ? (self->head == item) : tsk_null)
#define TSK_LIST_IS_LAST(self, item) (self ? (self->tail == item) : tsk_null)
#define TSK_LIST_IS_FIRST(self, item) (self ? (self->head == item) : tsk_false)
#define TSK_LIST_IS_LAST(self, item) (self ? (self->tail == item) : tsk_false)
/**@ingroup tsk_list_group
* Item for linked list.

View File

@ -248,14 +248,12 @@ int tsk_params_tostring(const tsk_params_L_t *self, const char separator, tsk_bu
{
tsk_param_t* param = item->data;
//tsk_params_param_tostring(param, output);
if(TSK_LIST_IS_FIRST(self, item))
{
if(TSK_LIST_IS_FIRST(self, item)){
if(ret = tsk_buffer_append_2(output, param->value?"%s=%s":"%s", param->name, param->value)){
goto bail;
}
}
else
{
else{
if(ret = tsk_buffer_append_2(output, param->value?"%c%s=%s":"%c%s", separator, param->name, param->value)){
goto bail;
}

View File

@ -56,6 +56,9 @@
/**@defgroup tsk_string_group String utillity functions.
*/
#if !defined(va_copy)
# define va_copy(D, S) ((D) = (S))
#endif
static char HEX[] = "0123456789abcdef";
@ -304,12 +307,16 @@ int tsk_sprintf(char** str, const char* format, ...)
int tsk_sprintf_2(char** str, const char* format, va_list* ap)
{
int len = 0;
va_list ap2;
/* free previous value */
if(*str){
tsk_free((void**)str);
}
/* needed for 64bit platforms where vsnprintf will change the va_list */
va_copy(ap2, *ap);
/* compute destination len for windows mobile
*/
#if defined(_WIN32_WCE)
@ -337,9 +344,11 @@ done:
#if !defined(_MSC_VER) || defined(__GNUC__)
+1
#endif
, format, *ap);
, format, ap2);
#endif
va_end(ap2);
return len;
}

View File

@ -72,7 +72,7 @@ tsdp_header_Dummy_t* tsdp_header_dummy_create(char name, const char* value)
tsdp_header_Dummy_t* tsdp_header_dummy_create_null()
{
return tsdp_header_dummy_create(tsk_null, tsk_null);
return tsdp_header_dummy_create(0, tsk_null);
}
int tsdp_header_Dummy_tostring(const tsdp_header_t* header, tsk_buffer_t* output)

View File

@ -53,7 +53,7 @@ tsdp_header_Dummy_t* tsdp_header_dummy_create(char name, const char* value)
tsdp_header_Dummy_t* tsdp_header_dummy_create_null()
{
return tsdp_header_dummy_create(tsk_null, tsk_null);
return tsdp_header_dummy_create(0, tsk_null);
}
int tsdp_header_Dummy_tostring(const tsdp_header_t* header, tsk_buffer_t* output)

View File

@ -93,7 +93,7 @@ tsip_action_type_t;
/* internal enum used to pass parameters from the application layer to the stack */
typedef enum tsip_action_param_type_e
{
aptype_null = tsk_null,
aptype_null = 0,
aptype_header,
aptype_config,

View File

@ -58,7 +58,7 @@ typedef uint64_t tsip_ssession_id_t;
typedef enum tsip_ssession_param_type_e
{
sstype_null = tsk_null,
sstype_null = 0,
sstype_header,
sstype_caps,
@ -87,7 +87,7 @@ tsip_ssession_param_type_t;
typedef enum tsip_msession_param_type_e
{
mstype_null = tsk_null,
mstype_null = 0,
mstype_set_qos,
mstype_unset_qos,

View File

@ -58,7 +58,7 @@ typedef uint8_t operator_id_t[16];
typedef enum tsip_stack_param_type_e
{
tsip_pname_null = tsk_null,
tsip_pname_null = 0,
/* === Identity === */
tsip_pname_display_name,

View File

@ -318,7 +318,7 @@ tsip_request_t *tsip_dialog_request_new(const tsip_dialog_t *self, const char* m
else
{ /* No routes associated to this dialog. */
if(self->state == tsip_initial || self->state == tsip_early){
#if _DEBUG /* FIXME: remove this */
#if _DEBUG && SDS_HACK/* FIXME: remove this */
/* Ericsson SDS hack (INVITE with Proxy-CSCF as First route fail) */
#else
tsip_uri_t *uri = tsip_stack_get_pcscf_uri(TSIP_DIALOG_GET_STACK(self), tsk_true);

View File

@ -396,6 +396,11 @@ int x0000_Any_2_Any_X_i1xx(va_list *app)
const tsip_response_t *r1xx = va_arg(*app, const tsip_response_t *);
int ret = 0;
/* Update the dialog state */
if((ret = tsip_dialog_update(TSIP_DIALOG(self), r1xx))){
return ret;
}
/* RFC 3262 - 4 UAC Behavior
If a provisional response is received for an initial request, and
that response contains a Require header field containing the option

View File

@ -35,6 +35,8 @@
#include "tinysdp/parsers/tsdp_parser_message.h"
#include "tnet_transport.h"
#include "tsk_debug.h"
extern int send_INVITE(tsip_dialog_invite_t *self);
@ -49,9 +51,9 @@ int c0000_Started_2_Outgoing_X_oINVITE(va_list *app)
//const tsip_response_t *response = va_arg(*app, const tsip_response_t *);
/* This is the first transaction when you try to make an audio/video/msrp call */
if(self->msession_mgr == tsk_null){
if(self->msession_mgr == tsk_null){
self->msession_mgr = tmedia_session_mgr_create((tmedia_audio | tmedia_video | tmedia_msrp | tmedia_t38),
"192.168.0.12", tsk_false, tsk_true);
TSIP_DIALOG_GET_STACK(self)->network.local_ip, tsk_false, tsk_true);
}
/* send the request */

View File

@ -553,6 +553,19 @@ int tsip_stack_start(tsip_stack_handle_t *self)
TSK_DEBUG_ERROR("Failed to start sip transport");
goto bail;
}
else if(!stack->network.local_ip){
/* Update the local_ip */
if(!TSK_LIST_IS_EMPTY(stack->layer_transport->transports)){
tnet_ip_t ip;
if(!tnet_transport_get_ip_n_port_2(stack->layer_transport->transports->head->data, &ip, tsk_null)){
stack->network.local_ip = tsk_strdup(ip);
}
else{
TSK_DEBUG_WARN("Failed to get local_ip");
/* Do not exit */
}
}
}
/* === ALL IS OK === */
if(stack->layer_transac){ /* For transaction layer */

View File

@ -72,7 +72,7 @@ txcap_action_option_t;
typedef enum txcap_action_param_type_e
{
txcap_apt_null = tsk_null,
txcap_apt_null = 0,
txcap_apt_option,
txcap_apt_header,

View File

@ -39,7 +39,7 @@ TXCAP_BEGIN_DECLS
typedef enum txcap_selector_param_type_e
{
xcapp_node_null = tsk_null,
xcapp_node_null = 0,
xcapp_node_name,
xcapp_node_pos,

View File

@ -59,7 +59,7 @@ txcap_stack_option_t;
typedef enum txcap_stack_param_type_e
{
xcapp_null = tsk_null,
xcapp_null = 0,
xcapp_option,
xcapp_header,

View File

@ -40,7 +40,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\thirdparties\win32\include;..\..\tinyDAV\include;..\..\tinyMEDIA\include;..\..\tinySDP\include;..\..\tinySAK\src"
AdditionalIncludeDirectories="..\..\thirdparties\win32\include;..\..\tinyDAV\include;..\..\tinyMEDIA\include;..\..\tinyRTP\include;..\..\tinySDP\include;..\..\tinySAK\src;..\..\tinyNET\src"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;TINYDAV_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@ -63,7 +63,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="$(OutDir)\tinySAK.lib $(OutDir)\tinyNET.lib $(OutDir)\tinyRTP.lib $(OutDir)\tinySDP.lib $(OutDir)\tinyMEDIA.lib"
AdditionalDependencies="Winmm.lib $(OutDir)\tinySAK.lib $(OutDir)\tinyNET.lib $(OutDir)\tinyRTP.lib $(OutDir)\tinySDP.lib $(OutDir)\tinyMEDIA.lib"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
@ -200,6 +200,10 @@
<Filter
Name="g711"
>
<File
RelativePath="..\..\tinyDAV\include\tinydav\codecs\g711\g711.h"
>
</File>
<File
RelativePath="..\..\tinyDAV\include\tinydav\codecs\g711\tdav_codec_g711.h"
>
@ -245,6 +249,18 @@
<Filter
Name="audio"
>
<File
RelativePath="..\..\tinyDAV\include\tinydav\audio\tdav_consumer_audio.h"
>
</File>
<File
RelativePath="..\..\tinyDAV\include\tinydav\audio\tdav_jitterbuffer.h"
>
</File>
<File
RelativePath="..\..\tinyDAV\include\tinydav\audio\tdav_producer_audio.h"
>
</File>
<File
RelativePath="..\..\tinyDAV\include\tinydav\audio\tdav_session_audio.h"
>
@ -300,6 +316,10 @@
<Filter
Name="g711"
>
<File
RelativePath="..\..\tinyDAV\src\codecs\g711\g711.c"
>
</File>
<File
RelativePath="..\..\tinyDAV\src\codecs\g711\tdav_codec_g711.c"
>
@ -345,6 +365,18 @@
<Filter
Name="audio"
>
<File
RelativePath="..\..\tinyDAV\src\audio\tdav_consumer_audio.c"
>
</File>
<File
RelativePath="..\..\tinyDAV\src\audio\tdav_jitterbuffer.c"
>
</File>
<File
RelativePath="..\..\tinyDAV\src\audio\tdav_producer_audio.c"
>
</File>
<File
RelativePath="..\..\tinyDAV\src\audio\tdav_session_audio.c"
>
@ -364,6 +396,14 @@
<Filter
Name="waveapi"
>
<File
RelativePath="..\..\tinyDAV\src\audio\waveapi\tdav_consumer_waveapi.c"
>
</File>
<File
RelativePath="..\..\tinyDAV\src\audio\waveapi\tdav_producer_waveapi.c"
>
</File>
</Filter>
</Filter>
<Filter