You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(68) |
Jul
(27) |
Aug
(1) |
Sep
(9) |
Oct
(16) |
Nov
(64) |
Dec
(18) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(11) |
Feb
(5) |
Mar
(20) |
Apr
(9) |
May
(8) |
Jun
(8) |
Jul
(2) |
Aug
|
Sep
(11) |
Oct
(34) |
Nov
(23) |
Dec
(34) |
2005 |
Jan
(41) |
Feb
(25) |
Mar
(25) |
Apr
(32) |
May
(27) |
Jun
(9) |
Jul
(36) |
Aug
(6) |
Sep
(3) |
Oct
(11) |
Nov
(2) |
Dec
(21) |
2006 |
Jan
(14) |
Feb
(8) |
Mar
(18) |
Apr
(6) |
May
|
Jun
(17) |
Jul
(14) |
Aug
(26) |
Sep
(34) |
Oct
(24) |
Nov
(48) |
Dec
(64) |
2007 |
Jan
(72) |
Feb
(21) |
Mar
(50) |
Apr
(41) |
May
(35) |
Jun
(50) |
Jul
(33) |
Aug
(32) |
Sep
(50) |
Oct
(85) |
Nov
(43) |
Dec
(33) |
2008 |
Jan
(10) |
Feb
(29) |
Mar
(15) |
Apr
(45) |
May
(5) |
Jun
(2) |
Jul
(14) |
Aug
(3) |
Sep
|
Oct
|
Nov
(3) |
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
(9) |
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <sb...@us...> - 2008-02-05 23:56:30
|
Revision: 1341 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1341&view=rev Author: sbalea Date: 2008-02-05 15:56:33 -0800 (Tue, 05 Feb 2008) Log Message: ----------- Make iaxclient work (and require!!!) speex-1.2beta3 Modified Paths: -------------- trunk/configure.ac trunk/lib/Makefile.am trunk/lib/audio_encode.c trunk/m4/speex.m4 Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2008-02-05 20:29:40 UTC (rev 1340) +++ trunk/configure.ac 2008-02-05 23:56:33 UTC (rev 1341) @@ -235,6 +235,12 @@ obtain a copy. ])) +PKG_CHECK_MODULES(SPEEXDSP, [speexdsp >= 1.2],,AC_MSG_ERROR([ + speexdsp is required to build this package! + please see http://www.xiph.org/ for how to + obtain a copy. +])) + has_theora=no if test ! x$with_theora = xno; then PKG_CHECK_MODULES(THEORA, [theora >= 1.0alpha7],has_theora=yes) Modified: trunk/lib/Makefile.am =================================================================== --- trunk/lib/Makefile.am 2008-02-05 20:29:40 UTC (rev 1340) +++ trunk/lib/Makefile.am 2008-02-05 23:56:33 UTC (rev 1341) @@ -12,6 +12,7 @@ AM_CFLAGS = \ $(PTHREAD_CFLAGS) \ $(SPEEX_CFLAGS) \ + $(SPEEXDSP_CFLAGS) \ $(IAX2_CFLAGS) \ $(PORTAUDIO_CFLAGS) @@ -25,7 +26,8 @@ $(PTHREAD_LIBS) \ $(IAX2_LIBS) \ $(PORTAUDIO_LIBS) \ - $(SPEEX_LIBS) + $(SPEEX_LIBS) \ + $(SPEEXDSP_LIBS) AM_LDFLAGS = \ -no-undefined \ Modified: trunk/lib/audio_encode.c =================================================================== --- trunk/lib/audio_encode.c 2008-02-05 20:29:40 UTC (rev 1340) +++ trunk/lib/audio_encode.c 2008-02-05 23:56:33 UTC (rev 1341) @@ -105,10 +105,14 @@ i = (iaxci_filters & IAXC_FILTER_DENOISE) ? 1 : 0; speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DENOISE, &i); - /* make vad more sensitive */ - i = 30; + /* + * We can tweak these parameters to play with VAD sensitivity. + * For now, we use the default values since it seems they are a good starting point. + * However, if need be, this is the code that needs to change + */ + i = 35; speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_PROB_START, &i); - i = 7; + i = 20; speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_PROB_CONTINUE, &i); } @@ -153,10 +157,10 @@ /* Analog AGC: Bring speex AGC gain out to mixer, with lots of hysteresis */ /* use a higher continuation threshold for AAGC than for VAD itself */ if ( !silent && - iaxci_silence_threshold != 0.0f && - (iaxci_filters & IAXC_FILTER_AGC) && - (iaxci_filters & IAXC_FILTER_AAGC) && - st->speech_prob > 0.20f ) + iaxci_silence_threshold != 0.0f && + (iaxci_filters & IAXC_FILTER_AGC) && + (iaxci_filters & IAXC_FILTER_AAGC) + ) { static int i = 0; @@ -164,8 +168,8 @@ if ( (i & 0x3f) == 0 ) { - const float loudness = st->loudness2; - + const float loudness; + speex_preprocess_ctl(st, SPEEX_PREPROCESS_GET_AGC_LOUDNESS, &loudness); if ( loudness > 8000.0f || loudness < 4000.0f ) { const float level = iaxc_input_level_get(); Modified: trunk/m4/speex.m4 =================================================================== --- trunk/m4/speex.m4 2008-02-05 20:29:40 UTC (rev 1340) +++ trunk/m4/speex.m4 2008-02-05 23:56:33 UTC (rev 1341) @@ -41,7 +41,7 @@ SPEEX_LIBS="-L$prefix/lib" fi - SPEEX_LIBS="$SPEEX_LIBS -lspeex" + SPEEX_LIBS="$SPEEX_LIBS -lspeex -lspeexdsp" if test "x$speex_includes" != "x" ; then SPEEX_CFLAGS="-I$speex_includes" @@ -60,7 +60,7 @@ LIBS="$LIBS $SPEEX_LIBS" dnl Check for a working version of speex that is of the right version. -min_speex_version=ifelse([$1], ,1.0.0,$1) +min_speex_version=ifelse([$1], ,1.2.0,$1) AC_MSG_CHECKING(for speex headers version >= $min_speex_version) #no_speex="" speex_min_major_version=`echo $min_speex_version | \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sb...@us...> - 2008-02-05 20:29:35
|
Revision: 1340 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1340&view=rev Author: sbalea Date: 2008-02-05 12:29:40 -0800 (Tue, 05 Feb 2008) Log Message: ----------- Make sure that the video timestamps don't run backwards Code cleanups and comments Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2008-02-04 22:50:20 UTC (rev 1339) +++ trunk/lib/libiax2/src/iax.c 2008-02-05 20:29:40 UTC (rev 1340) @@ -473,11 +473,10 @@ struct iax_session *iax_session_new(void) { struct iax_session *s; - s = (struct iax_session *)malloc(sizeof(struct iax_session)); + s = calloc(1, sizeof(struct iax_session)); if (s) { jb_conf jbconf; - memset(s, 0, sizeof(struct iax_session)); /* Initialize important fields */ s->voiceformat = -1; s->svoiceformat = -1; @@ -643,7 +642,18 @@ if(ms <= session->lastsent) ms = session->lastsent + 3; #endif - } else if ( !video ) { + } else if ( video ) { + /* + * IAX2 draft 03 says that timestamps MUST be in order. + * It does not say anything about several frames having the same timestamp + * When transporting video, we can have a frame that spans multiple iax packets + * (so called slices), so it would make sense to use the same timestamp for all of + * them + * We do want to make sure that frames don't go backwards though + */ + if ( (unsigned int)ms < session->lastsent ) + ms = session->lastsent; + } else { /* On a dataframe, use last value + 3 (to accomodate jitter buffer shrinking) if appropriate unless it's a genuine frame */ if (genuine) { @@ -1101,14 +1111,13 @@ /* Bitmask taken from chan_iax2.c... I must ask Mark Spencer for this? I think not... */ if ( f->frametype == AST_FRAME_VIDEO ) { - if (((fts & 0xFFFF8000L) == (pvt->lastvsent & 0xFFFF8000L)) - /* High two bits are the same on timestamp, or sending on a trunk */ && - ((f->subclass & ~0x01) == pvt->svideoformat) - /* is the same type */ ) + /* Check if the timestamp has rolled over or if the video codec has changed */ + if ( ((fts & 0xFFFF8000L) == (pvt->lastvsent & 0xFFFF8000L)) && + (f->subclass == pvt->svideoformat) + ) { - /* Force immediate rather than delayed transmission */ + /* send a mini video frame immediately */ now = 1; - /* Mark that mini-style frame is appropriate */ sendmini = 1; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sb...@us...> - 2008-02-04 22:50:26
|
Revision: 1339 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1339&view=rev Author: sbalea Date: 2008-02-04 14:50:20 -0800 (Mon, 04 Feb 2008) Log Message: ----------- Full video frames should be sent whenever the 15 bits video timestamp rolls over Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2008-02-01 16:19:08 UTC (rev 1338) +++ trunk/lib/libiax2/src/iax.c 2008-02-04 22:50:20 UTC (rev 1339) @@ -167,6 +167,8 @@ unsigned int last_ts; /* Last transmitted timestamp */ unsigned int lastsent; + /* Timestamp of the last transmitted video frame */ + unsigned int lastvsent; #ifdef USE_VOICE_TS_PREDICTION /* Next predicted voice ts */ unsigned int nextpred; @@ -641,10 +643,7 @@ if(ms <= session->lastsent) ms = session->lastsent + 3; #endif - } else if (video) { - if ((unsigned int)ms <= session->lastsent) - ms = session->lastsent + 3; - } else { + } else if ( !video ) { /* On a dataframe, use last value + 3 (to accomodate jitter buffer shrinking) if appropriate unless it's a genuine frame */ if (genuine) { @@ -1102,7 +1101,7 @@ /* Bitmask taken from chan_iax2.c... I must ask Mark Spencer for this? I think not... */ if ( f->frametype == AST_FRAME_VIDEO ) { - if (((fts & 0xFFFF8000L) == (lastsent & 0xFFFF8000L)) + if (((fts & 0xFFFF8000L) == (pvt->lastvsent & 0xFFFF8000L)) /* High two bits are the same on timestamp, or sending on a trunk */ && ((f->subclass & ~0x01) == pvt->svideoformat) /* is the same type */ ) @@ -1117,6 +1116,7 @@ now = 0; sendmini = 0; } + pvt->lastvsent = fts; } /* if requested, force a full frame */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sb...@us...> - 2008-02-01 16:19:08
|
Revision: 1338 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1338&view=rev Author: sbalea Date: 2008-02-01 08:19:08 -0800 (Fri, 01 Feb 2008) Log Message: ----------- Create a personal branch for local video features Added Paths: ----------- branches/team/mihai/localvideo/ Copied: branches/team/mihai/localvideo (from rev 1337, trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <do...@us...> - 2008-01-30 19:02:57
|
Revision: 1337 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1337&view=rev Author: dohpaz Date: 2008-01-30 11:02:59 -0800 (Wed, 30 Jan 2008) Log Message: ----------- Merge up to trunk of r1336. Modified Paths: -------------- branches/team/elbunce/iaxclient/configure.ac branches/team/elbunce/iaxclient/contrib/win/vc6/libiax2.dsp branches/team/elbunce/iaxclient/contrib/win/vs2005/libiax2.vcproj branches/team/elbunce/iaxclient/contrib/win/vs2005/libiaxclient.vcproj branches/team/elbunce/iaxclient/lib/audio_encode.c branches/team/elbunce/iaxclient/lib/audio_portaudio.c branches/team/elbunce/iaxclient/lib/iaxclient_lib.c branches/team/elbunce/iaxclient/lib/iaxclient_lib.h branches/team/elbunce/iaxclient/lib/libiax2/configure.in branches/team/elbunce/iaxclient/lib/libiax2/src/iax-client.h branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c branches/team/elbunce/iaxclient/lib/video.c branches/team/elbunce/iaxclient/lib/winfuncs.c Removed Paths: ------------- branches/team/elbunce/iaxclient/lib/libiax2/src/winpoop.h Modified: branches/team/elbunce/iaxclient/configure.ac =================================================================== --- branches/team/elbunce/iaxclient/configure.ac 2008-01-30 16:18:05 UTC (rev 1336) +++ branches/team/elbunce/iaxclient/configure.ac 2008-01-30 19:02:59 UTC (rev 1337) @@ -47,6 +47,7 @@ AC_CHECK_FUNCS([vsnprintf _vsnprintf]) AC_CHECK_FUNCS([srandomdev srandom srand48 random lrand48]) +AC_CHECK_FUNCS(gettimeofday) ACX_PTHREAD Modified: branches/team/elbunce/iaxclient/contrib/win/vc6/libiax2.dsp =================================================================== --- branches/team/elbunce/iaxclient/contrib/win/vc6/libiax2.dsp 2008-01-30 16:18:05 UTC (rev 1336) +++ branches/team/elbunce/iaxclient/contrib/win/vc6/libiax2.dsp 2008-01-30 19:02:59 UTC (rev 1337) @@ -159,10 +159,6 @@ SOURCE=..\..\..\lib\libiax2\src\ringtone.h # End Source File -# Begin Source File - -SOURCE=..\..\..\lib\libiax2\src\winpoop.h -# End Source File # End Group # End Target # End Project Modified: branches/team/elbunce/iaxclient/contrib/win/vs2005/libiax2.vcproj =================================================================== --- branches/team/elbunce/iaxclient/contrib/win/vs2005/libiax2.vcproj 2008-01-30 16:18:05 UTC (rev 1336) +++ branches/team/elbunce/iaxclient/contrib/win/vs2005/libiax2.vcproj 2008-01-30 19:02:59 UTC (rev 1337) @@ -222,10 +222,6 @@ RelativePath="..\..\..\lib\libiax2\src\ringtone.h" > </File> - <File - RelativePath="..\..\..\lib\libiax2\src\winpoop.h" - > - </File> </Filter> <Filter Name="Resource Files" Modified: branches/team/elbunce/iaxclient/contrib/win/vs2005/libiaxclient.vcproj =================================================================== --- branches/team/elbunce/iaxclient/contrib/win/vs2005/libiaxclient.vcproj 2008-01-30 16:18:05 UTC (rev 1336) +++ branches/team/elbunce/iaxclient/contrib/win/vs2005/libiaxclient.vcproj 2008-01-30 19:02:59 UTC (rev 1337) @@ -40,7 +40,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\..\lib\libiax2\src;..\..\..\..\portaudio\include;..\..\..\lib\spandsp;..\..\..\lib\gsm\inc;..\..\..\..\speex\include;..\..\..\..\libogg\include;..\..\..\..\libtheora\include;..\..\..\lib\portmixer\px_common;..\..\..\..\libvidcap\include" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;PA_NO_DS;PA_NO_ASIO;BUILDING_DLL;LIBIAX;_CRT_SECURE_NO_DEPRECATE;strncasecmp=strnicmp;__inline__=_inline;SPEEX_EC=1;NTDDI_VERSION=NTDDI_WIN2KSP4;_WIN32_WINNT=0x0500;WINVER=0x0500;USE_VIDEO;USE_THEORA;CODEC_GSM" + PreprocessorDefinitions="WIN32;_DEBUG;_LIB;PA_NO_DS;PA_NO_ASIO;BUILDING_DLL;LIBIAX;_CRT_SECURE_NO_DEPRECATE;strncasecmp=strnicmp;__inline__=_inline;NTDDI_VERSION=NTDDI_WIN2KSP4;_WIN32_WINNT=0x0500;WINVER=0x0500;USE_VIDEO;USE_THEORA;CODEC_GSM" BasicRuntimeChecks="3" RuntimeLibrary="3" WarningLevel="3" @@ -104,7 +104,7 @@ <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="..\..\..\lib\libiax2\src;..\..\..\..\portaudio\include;..\..\..\lib\spandsp;..\..\..\lib\gsm\inc;..\..\..\..\speex\include;..\..\..\..\libogg\include;..\..\..\..\libtheora\include;..\..\..\lib\portmixer\px_common;..\..\..\..\libvidcap\include" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;PA_NO_DS;PA_NO_ASIO;BUILDING_DLL;LIBIAX;_CRT_SECURE_NO_DEPRECATE;strncasecmp=strnicmp;__inline__=_inline;SPEEX_EC=1;NTDDI_VERSION=NTDDI_WIN2KSP4;_WIN32_WINNT=0x0500;WINVER=0x0500;USE_VIDEO;USE_THEORA;CODEC_GSM" + PreprocessorDefinitions="WIN32;NDEBUG;_LIB;PA_NO_DS;PA_NO_ASIO;BUILDING_DLL;LIBIAX;_CRT_SECURE_NO_DEPRECATE;strncasecmp=strnicmp;__inline__=_inline;NTDDI_VERSION=NTDDI_WIN2KSP4;_WIN32_WINNT=0x0500;WINVER=0x0500;USE_VIDEO;USE_THEORA;CODEC_GSM" RuntimeLibrary="2" WarningLevel="3" Detect64BitPortabilityProblems="true" @@ -167,7 +167,7 @@ <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="..\..\..\lib\libiax2\src;..\..\..\..\portaudio\include;..\..\..\lib\spandsp;..\..\..\lib\gsm\inc;..\..\..\..\speex\include;..\..\..\..\libogg\include;..\..\..\..\libtheora\include;..\..\..\lib\portmixer\px_common;..\..\..\..\libvidcap\include" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;PA_NO_DS;PA_NO_ASIO;BUILDING_DLL;LIBIAX;_CRT_SECURE_NO_DEPRECATE;strncasecmp=strnicmp;__inline__=_inline;SPEEX_EC=1;NTDDI_VERSION=NTDDI_WIN2KSP4;_WIN32_WINNT=0x0500;WINVER=0x0500;USE_VIDEO;USE_THEORA;CODEC_GSM" + PreprocessorDefinitions="WIN32;NDEBUG;_LIB;PA_NO_DS;PA_NO_ASIO;BUILDING_DLL;LIBIAX;_CRT_SECURE_NO_DEPRECATE;strncasecmp=strnicmp;__inline__=_inline;NTDDI_VERSION=NTDDI_WIN2KSP4;_WIN32_WINNT=0x0500;WINVER=0x0500;USE_VIDEO;USE_THEORA;CODEC_GSM" RuntimeLibrary="2" WarningLevel="3" Detect64BitPortabilityProblems="true" @@ -239,7 +239,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\..\lib\libiax2\src;..\..\..\..\portaudio\include;..\..\..\lib\spandsp;..\..\..\lib\gsm\inc;..\..\..\..\speex\include;..\..\..\..\libogg\include;..\..\..\..\libtheora\include;..\..\..\lib\portmixer\px_common;..\..\..\..\libvidcap\include" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;PA_NO_DS;PA_NO_ASIO;BUILDING_DLL;LIBIAX;_CRT_SECURE_NO_DEPRECATE;strncasecmp=strnicmp;__inline__=_inline;SPEEX_EC=1;NTDDI_VERSION=NTDDI_WIN2KSP4;_WIN32_WINNT=0x0500;WINVER=0x0500;USE_VIDEO;USE_THEORA;CODEC_GSM" + PreprocessorDefinitions="WIN32;_DEBUG;_LIB;PA_NO_DS;PA_NO_ASIO;BUILDING_DLL;LIBIAX;_CRT_SECURE_NO_DEPRECATE;strncasecmp=strnicmp;__inline__=_inline;NTDDI_VERSION=NTDDI_WIN2KSP4;_WIN32_WINNT=0x0500;WINVER=0x0500;USE_VIDEO;USE_THEORA;CODEC_GSM" BasicRuntimeChecks="3" RuntimeLibrary="3" WarningLevel="3" Modified: branches/team/elbunce/iaxclient/lib/audio_encode.c =================================================================== --- branches/team/elbunce/iaxclient/lib/audio_encode.c 2008-01-30 16:18:05 UTC (rev 1336) +++ branches/team/elbunce/iaxclient/lib/audio_encode.c 2008-01-30 19:02:59 UTC (rev 1337) @@ -71,7 +71,7 @@ float input_db; float output_db; - gettimeofday(&now, 0); + now = iax_tvnow(); if ( last.tv_sec != 0 && iaxci_usecdiff(&now, &last) < 100000 ) return 0; @@ -261,7 +261,7 @@ int insize = samples; /* update last input timestamp */ - gettimeofday( &timeLastInput, NULL ) ; + timeLastInput = iax_tvnow(); silent = input_postprocess(data, insize, 8000); @@ -342,7 +342,7 @@ int insize = len; int outsize = *samples; - gettimeofday( &timeLastOutput, NULL ) ; + timeLastOutput = iax_tvnow(); if ( format == 0 ) { Modified: branches/team/elbunce/iaxclient/lib/audio_portaudio.c =================================================================== --- branches/team/elbunce/iaxclient/lib/audio_portaudio.c 2008-01-30 16:18:05 UTC (rev 1336) +++ branches/team/elbunce/iaxclient/lib/audio_portaudio.c 2008-01-30 19:02:59 UTC (rev 1337) @@ -38,16 +38,19 @@ #include "portmixer.h" #ifdef USE_MEC2 +#define DO_EC #include "mec3.h" static echo_can_state_t *ec; #endif #ifdef SPAN_EC +#define DO_EC #include "ec/echo.h" static echo_can_state_t *ec; #endif -#ifdef SPEEX_EC +#if defined(SPEEX_EC) && ! defined (WIN32) +#define DO_EC #define restrict __restrict #include "speex/speex_echo.h" static SpeexEchoState *ec; @@ -427,33 +430,35 @@ * it's turned back on. */ if ( !(iaxc_get_filters() & IAXC_FILTER_ECHO) ) { +#if defined(DO_EC) if ( ec ) { #if defined(USE_MEC2) || defined(SPAN_EC) echo_can_free(ec); ec = NULL; -#endif -#if defined(SPEEX_EC) +#elif defined(SPEEX_EC) speex_echo_state_destroy(ec); ec = NULL; #endif } +#endif return; } /* we want echo cancellation */ +#if defined(DO_EC) if ( !ec ) { rb_InitializeRingBuffer(&ecOutRing, EC_RING_SZ, &outRingBuf); #if defined(USE_MEC2) || defined(SPAN_EC) ec = echo_can_create(ECHO_TAIL, 0); -#endif -#if defined(SPEEX_EC) +#elif defined(SPEEX_EC) ec = speex_echo_state_init(SAMPLES_PER_FRAME, ECHO_TAIL); #endif } +#endif /* fill ecOutRing */ rb_WriteRingBuffer(&ecOutRing, outputBuffer, n * 2); @@ -465,7 +470,7 @@ rb_ReadRingBuffer(&ecOutRing, delayedBuf, n * 2); -#if defined(SPEEX_EC) +#if defined(DO_EC) && defined(SPEEX_EC) { short cancelledBuffer[1024]; Modified: branches/team/elbunce/iaxclient/lib/iaxclient_lib.c =================================================================== --- branches/team/elbunce/iaxclient/lib/iaxclient_lib.c 2008-01-30 16:18:05 UTC (rev 1336) +++ branches/team/elbunce/iaxclient/lib/iaxclient_lib.c 2008-01-30 19:02:59 UTC (rev 1337) @@ -742,7 +742,7 @@ { if ( callNo < 0 ) return; - gettimeofday(&calls[callNo].last_activity, NULL); + calls[callNo].last_activity = iax_tvnow(); } static void iaxc_refresh_registrations() @@ -750,7 +750,7 @@ struct iaxc_registration *cur; struct timeval now; - gettimeofday(&now,NULL); + now = iax_tvnow(); for ( cur = registrations; cur != NULL; cur = cur->next ) { @@ -1273,7 +1273,7 @@ return -1; } - gettimeofday(&newreg->last,NULL); + newreg->last = iax_tvnow(); newreg->refresh = refresh; strncpy(newreg->host, host, 256); Modified: branches/team/elbunce/iaxclient/lib/iaxclient_lib.h =================================================================== --- branches/team/elbunce/iaxclient/lib/iaxclient_lib.h 2008-01-30 16:18:05 UTC (rev 1336) +++ branches/team/elbunce/iaxclient/lib/iaxclient_lib.h 2008-01-30 19:02:59 UTC (rev 1337) @@ -32,7 +32,6 @@ #include <string.h> #if defined(WIN32) || defined(_WIN32_WCE) -void gettimeofday(struct timeval *tv, void /*struct timezone*/ *tz); #include <winsock.h> #if !defined(_WIN32_WCE) #include <process.h> Modified: branches/team/elbunce/iaxclient/lib/libiax2/configure.in =================================================================== --- branches/team/elbunce/iaxclient/lib/libiax2/configure.in 2008-01-30 16:18:05 UTC (rev 1336) +++ branches/team/elbunce/iaxclient/lib/libiax2/configure.in 2008-01-30 19:02:59 UTC (rev 1337) @@ -15,6 +15,8 @@ dnl Check header files AC_HEADER_STDC +AC_CHECK_FUNCS(gettimeofday) + AC_SUBST(LIBS) AC_ARG_ENABLE(snomhack, [ --enable-snomhack Use slower memset for SNOM phoneem ],,enable_snomhack=no) Modified: branches/team/elbunce/iaxclient/lib/libiax2/src/iax-client.h =================================================================== --- branches/team/elbunce/iaxclient/lib/libiax2/src/iax-client.h 2008-01-30 16:18:05 UTC (rev 1336) +++ branches/team/elbunce/iaxclient/lib/libiax2/src/iax-client.h 2008-01-30 19:02:59 UTC (rev 1337) @@ -200,6 +200,8 @@ extern void iax_enable_debug(void); extern void iax_disable_debug(void); +extern struct timeval iax_tvnow(void); + /* For attended transfer, application create a new session, * make a call on the new session. * On answer of the new session, call iax_setup_transfer and wait for Modified: branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c =================================================================== --- branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c 2008-01-30 16:18:05 UTC (rev 1336) +++ branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c 2008-01-30 19:02:59 UTC (rev 1337) @@ -34,6 +34,9 @@ #include <stdio.h> #include <limits.h> +#if !defined(_WIN32_WCE) +#include <sys/timeb.h> +#endif #define snprintf _snprintf @@ -44,14 +47,6 @@ #endif #endif -#ifdef __cplusplus -extern "C" { -#endif -void gettimeofday(struct timeval *tv, void /*struct timezone*/ *tz); -#ifdef __cplusplus -} -#endif - #else #include <netdb.h> @@ -278,30 +273,6 @@ s->sendto = ptr; } -void iax_seed_random() -{ -#if defined(HAVE_SRANDOMDEV) - srandomdev(); -#elif defined(HAVE_SRANDOM) - srandom((unsigned int)time(0)); -#elif defined(HAVE_SRAND48) - srand48((long int)time(0)); -#else - srand((unsigned int)time(0)); -#endif -} - -int iax_random() -{ -#if defined(HAVE_RANDOM) - return (int)random(); -#elif defined(HAVE_LRAND48) - return (int)lrand48(); -#else - return rand(); -#endif -} - /* This is a little strange, but to debug you call DEBU(G "Hello World!\n"); */ #if defined(WIN32) || defined(_WIN32_WCE) #define G __FILE__, __LINE__, @@ -346,6 +317,30 @@ #define G #endif +void iax_seed_random() +{ +#if defined(HAVE_SRANDOMDEV) + srandomdev(); +#elif defined(HAVE_SRANDOM) + srandom((unsigned int)time(0)); +#elif defined(HAVE_SRAND48) + srand48((long int)time(0)); +#else + srand((unsigned int)time(0)); +#endif +} + +int iax_random() +{ +#if defined(HAVE_RANDOM) + return (int)random(); +#elif defined(HAVE_LRAND48) + return (int)lrand48(); +#else + return rand(); +#endif +} + typedef void (*sched_func)(void *); struct iax_sched { @@ -393,7 +388,7 @@ sched = (struct iax_sched*)malloc(sizeof(struct iax_sched)); if (sched) { memset(sched, 0, sizeof(struct iax_sched)); - gettimeofday(&sched->when, NULL); + sched->when = iax_tvnow(); sched->when.tv_sec += (ms / 1000); ms = ms % 1000; sched->when.tv_usec += (ms * 1000); @@ -460,7 +455,7 @@ /* If there are no pending events, we don't need to timeout */ if (!cur) return -1; - gettimeofday(&tv, NULL); + tv = iax_tvnow(); while(cur) { ms = (cur->when.tv_sec - tv.tv_sec) * 1000 + (cur->when.tv_usec - tv.tv_usec) / 1000; @@ -595,7 +590,7 @@ /* If this is the first packet we're sending, get our offset now. */ if (!session->offset.tv_sec && !session->offset.tv_usec) - gettimeofday(&session->offset, NULL); + session->offset = iax_tvnow(); /* If the timestamp is specified, just use their specified timestamp no matter what. Usually this is done for @@ -608,7 +603,7 @@ } /* Otherwise calculate the timestamp from the current time */ - gettimeofday(&tv, NULL); + tv = iax_tvnow(); /* Calculate the number of milliseconds since we sent the first packet */ ms = (tv.tv_sec - session->offset.tv_sec) * 1000 + @@ -1418,12 +1413,12 @@ struct iax_session *s0 = org_session; struct iax_session *s1 = new_session; + int transfer_id = 1 + (int)(32767.0 * (iax_random() / (RAND_MAX + 1.0))); + memset(&ied0, 0, sizeof(ied0)); memset(&ied1, 0, sizeof(ied1)); - int transfer_id = 1 + (int)(32767.0 * (iax_random() / (RAND_MAX + 1.0))); - /* reversed setup */ iax_ie_append_addr(&ied0, IAX_IE_APPARENT_ADDR, &s1->peeraddr); iax_ie_append_short(&ied0, IAX_IE_CALLNO, s1->peercallno); @@ -2230,9 +2225,9 @@ int ms; if (!session->rxcore.tv_sec && !session->rxcore.tv_usec) { - gettimeofday(&session->rxcore, NULL); + session->rxcore = iax_tvnow(); } - gettimeofday(&tv, NULL); + tv = iax_tvnow(); ms = (tv.tv_sec - session->rxcore.tv_sec) * 1000 + (tv.tv_usec - session->rxcore.tv_usec) / 1000; @@ -3266,7 +3261,7 @@ struct iax_sched *cur; struct iax_session *session; - gettimeofday(&tv, NULL); + tv = iax_tvnow(); while((cur = iax_get_sched(tv))) { @@ -3492,3 +3487,21 @@ return send_command(session, AST_FRAME_IAX, IAX_COMMAND_QUELCH, 0, ied.buf, ied.pos, -1); } + +struct timeval iax_tvnow(void) +{ + struct timeval tv; + +#ifdef HAVE_GETTIMEOFDAY + gettimeofday(&tv, 0); +#elif defined(_MSC_VER) + struct _timeb curSysTime; + + _ftime(&curSysTime); + tv.tv_sec = (long)curSysTime.time; + tv.tv_usec = curSysTime.millitm * 1000; +#else +#error no gettimeofday or equivalent available +#endif + return tv; +} Deleted: branches/team/elbunce/iaxclient/lib/libiax2/src/winpoop.h =================================================================== --- branches/team/elbunce/iaxclient/lib/libiax2/src/winpoop.h 2008-01-30 16:18:05 UTC (rev 1336) +++ branches/team/elbunce/iaxclient/lib/libiax2/src/winpoop.h 2008-01-30 19:02:59 UTC (rev 1337) @@ -1,41 +0,0 @@ -/* - * Functions Windows doesn't have... but should - * Copyright(C) 2001, Linux Support Services, Inc. - * - * Distributed under GNU LGPL. - * - * These are NOT fully compliant with BSD 4.3 and are not - * threadsafe. - * - */ - -#ifndef _winpoop_h -#define _winpoop_h - -#if defined(_MSC_VER) -#define INLINE __inline -#else -#define INLINE inline -#endif - -#include <winsock.h> - -void gettimeofday(struct timeval *tv, void /*struct timezone*/ *tz); - -static INLINE int inet_aton(char *cp, struct in_addr *inp) -{ - int a1, a2, a3, a4; - unsigned int saddr; - - if (sscanf(cp, "%d.%d.%d.%d", &a1, &a2, &a3, &a4) != 4) - return 0; - a1 &= 0xff; - a2 &= 0xff; - a3 &= 0xff; - a4 &= 0xff; - saddr = (a1 << 24) | (a2 << 16) | (a3 << 8) | a4; - inp->s_addr = htonl(saddr); - return 1; -} - -#endif Modified: branches/team/elbunce/iaxclient/lib/video.c =================================================================== --- branches/team/elbunce/iaxclient/lib/video.c 2008-01-30 16:18:05 UTC (rev 1336) +++ branches/team/elbunce/iaxclient/lib/video.c 2008-01-30 19:02:59 UTC (rev 1337) @@ -139,7 +139,7 @@ return; memset(&vcodec->video_stats, 0, sizeof(struct iaxc_video_stats)); - gettimeofday(&vcodec->video_stats.start_time, 0); + vcodec->video_stats.start_time = iax_tvnow(); } static void reset_video_stats(struct iaxc_call * call) @@ -200,9 +200,9 @@ return -1; if ( video_stats_start.tv_sec == 0 && video_stats_start.tv_usec == 0 ) - gettimeofday(&video_stats_start, 0); + video_stats_start = iax_tvnow(); - gettimeofday(&now, 0); + now = iax_tvnow(); if ( iaxci_msecdiff(&now, &video_stats_start) > video_stats_interval ) { @@ -732,7 +732,7 @@ /* Gather statistics */ call->vencoder->video_stats.outbound_frames++; - gettimeofday(&now, 0); + now = iax_tvnow(); time_delta = iaxci_msecdiff(&now, &call->vencoder->video_stats.start_time); @@ -1298,7 +1298,7 @@ } /* Statistics */ - gettimeofday(&now, 0); + now = iax_tvnow(); time = iaxci_msecdiff(&now, &call->vdecoder->video_stats.start_time); call->vdecoder->video_stats.received_slices++; call->vdecoder->video_stats.acc_recv_size += encoded_video_len; @@ -1778,9 +1778,9 @@ return -1; if ( video_stats_start.tv_sec == 0 && video_stats_start.tv_usec == 0 ) - gettimeofday(&video_stats_start, 0); + video_stats_start = iax_tvnow(); - gettimeofday(&now, 0); + now = iax_tvnow(); if ( iaxci_msecdiff(&now, &video_stats_start) > video_stats_interval ) { Modified: branches/team/elbunce/iaxclient/lib/winfuncs.c =================================================================== --- branches/team/elbunce/iaxclient/lib/winfuncs.c 2008-01-30 16:18:05 UTC (rev 1336) +++ branches/team/elbunce/iaxclient/lib/winfuncs.c 2008-01-30 19:02:59 UTC (rev 1337) @@ -19,33 +19,6 @@ #include <stdio.h> -#if !defined(_WIN32_WCE) -#include <sys/timeb.h> - -/* Win-doze doesnt have gettimeofday(). This sux. So, what we did is -provide some gettimeofday-like functionality that works for our purposes. */ - -/* - changed 'struct timezone*' to 'void*' since - timezone is defined as a long in MINGW and caused compile-time warnings. - this should be okay since we don't use the passed value. -*/ - - -/* - * functions implementations - */ - -void gettimeofday( struct timeval* tv, void* tz ) -{ - struct _timeb curSysTime; - - _ftime(&curSysTime); - tv->tv_sec = (long)curSysTime.time; - tv->tv_usec = curSysTime.millitm * 1000; -} -#endif - void os_init(void) { WSADATA wsd; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <do...@us...> - 2008-01-30 16:18:01
|
Revision: 1336 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1336&view=rev Author: dohpaz Date: 2008-01-30 08:18:05 -0800 (Wed, 30 Jan 2008) Log Message: ----------- Revert Lee Howard's timestamp changeset (rev 1316) It causes large amounts of video frames to be sent as full IAX2 frames, which is incorrect according to the IAX2 protocol and causes a lot of grief for people running on spotty network connections (grief == VNAK storms). Revision Links: -------------- http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1316&view=rev Modified Paths: -------------- branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c Modified: branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c =================================================================== --- branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c 2008-01-29 22:58:40 UTC (rev 1335) +++ branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c 2008-01-30 16:18:05 UTC (rev 1336) @@ -1075,7 +1075,7 @@ struct iax_frame *fr; int res; int sendmini=0; - unsigned int nextpred; + unsigned int lastsent; unsigned int fts; if (!pvt) @@ -1084,15 +1084,14 @@ return -1; } + /* this must come before the next call to calc_timestamp() since + calc_timestamp() will change lastsent to the returned value */ + lastsent = pvt->lastsent; + /* Calculate actual timestamp */ fts = calc_timestamp(pvt, ts, f); - /* If the next predicted VOICE timestamp will overflow the 16-bit - portion of the timestamp then we send a full VOICE frame to - keep the 32-bit portion of the timestamp synchronized. */ - nextpred = pvt->nextpred; - - if (((fts & 0xFFFF0000L) == (nextpred & 0xFFFF0000L)) + if (((fts & 0xFFFF0000L) == (lastsent & 0xFFFF0000L)) /* High two bits are the same on timestamp, or sending on a trunk */ && (f->frametype == AST_FRAME_VOICE) /* is a voice frame */ && @@ -1108,7 +1107,7 @@ /* Bitmask taken from chan_iax2.c... I must ask Mark Spencer for this? I think not... */ if ( f->frametype == AST_FRAME_VIDEO ) { - if (((fts & 0xFFFF8000L) == (nextpred & 0xFFFF8000L)) + if (((fts & 0xFFFF8000L) == (lastsent & 0xFFFF8000L)) /* High two bits are the same on timestamp, or sending on a trunk */ && ((f->subclass & ~0x01) == pvt->svideoformat) /* is the same type */ ) @@ -2580,7 +2579,7 @@ /* don't run last_ts backwards; i.e. for retransmits and the like */ if (ts > session->last_ts && - ((fh->type == AST_FRAME_IAX || fh->type == AST_FRAME_VOICE) && + (fh->type == AST_FRAME_IAX && subclass != IAX_COMMAND_ACK && subclass != IAX_COMMAND_PONG && subclass != IAX_COMMAND_LAGRP)) @@ -2705,7 +2704,6 @@ */ e->etype = -1; e->session = session; - e->ts = ts; switch(fh->type) { case AST_FRAME_DTMF: e->etype = IAX_EVENT_DTMF; @@ -2718,6 +2716,7 @@ case AST_FRAME_VOICE: e->etype = IAX_EVENT_VOICE; e->subclass = subclass; + e->ts = ts; session->voiceformat = subclass; if (datalen) { memcpy(e->data, fh->iedata, datalen); @@ -2798,14 +2797,17 @@ case IAX_COMMAND_LAGRQ: /* Pass this along for later handling */ e->etype = IAX_EVENT_LAGRQ; + e->ts = ts; e = schedule_delivery(e, ts, updatehistory); break; case IAX_COMMAND_POKE: e->etype = IAX_EVENT_POKE; + e->ts = ts; break; case IAX_COMMAND_PING: /* PINGS and PONGS don't get scheduled; */ e->etype = IAX_EVENT_PING; + e->ts = ts; break; case IAX_COMMAND_PONG: e->etype = IAX_EVENT_PONG; @@ -2974,6 +2976,7 @@ case AST_FRAME_VIDEO: e->etype = IAX_EVENT_VIDEO; e->subclass = subclass; + e->ts = ts; session->videoformat = e->subclass; memcpy(e->data, fh->iedata, datalen); e->datalen = datalen; @@ -3091,8 +3094,7 @@ e->subclass = session->voiceformat; e->datalen = datalen; memcpy(e->data, mh->data, datalen); - e->ts = (session->last_ts & 0xFFFF0000L) | (ntohs(mh->ts) & 0xFFFF); - e->ts = unwrap_timestamp(e->ts, session->last_ts); + e->ts = (session->last_ts & 0xFFFF0000) | ntohs(mh->ts); return schedule_delivery(e, e->ts, 1); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sb...@us...> - 2008-01-29 22:58:36
|
Revision: 1335 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1335&view=rev Author: sbalea Date: 2008-01-29 14:58:40 -0800 (Tue, 29 Jan 2008) Log Message: ----------- Revert Lee Howard's timestamp changeset (rev 1316) It causes large amounts of video frames to be sent as full IAX2 frames, which is incorrect according to the IAX2 protocol and causes a lot of grief for people running on spotty network connections (grief == VNAK storms) Revision Links: -------------- http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1316&view=rev Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2008-01-29 21:27:00 UTC (rev 1334) +++ trunk/lib/libiax2/src/iax.c 2008-01-29 22:58:40 UTC (rev 1335) @@ -1070,7 +1070,7 @@ struct iax_frame *fr; int res; int sendmini=0; - unsigned int nextpred; + unsigned int lastsent; unsigned int fts; if (!pvt) @@ -1079,15 +1079,14 @@ return -1; } + /* this must come before the next call to calc_timestamp() since + calc_timestamp() will change lastsent to the returned value */ + lastsent = pvt->lastsent; + /* Calculate actual timestamp */ fts = calc_timestamp(pvt, ts, f); - /* If the next predicted VOICE timestamp will overflow the 16-bit - portion of the timestamp then we send a full VOICE frame to - keep the 32-bit portion of the timestamp synchronized. */ - nextpred = pvt->nextpred; - - if (((fts & 0xFFFF0000L) == (nextpred & 0xFFFF0000L)) + if (((fts & 0xFFFF0000L) == (lastsent & 0xFFFF0000L)) /* High two bits are the same on timestamp, or sending on a trunk */ && (f->frametype == AST_FRAME_VOICE) /* is a voice frame */ && @@ -1103,7 +1102,7 @@ /* Bitmask taken from chan_iax2.c... I must ask Mark Spencer for this? I think not... */ if ( f->frametype == AST_FRAME_VIDEO ) { - if (((fts & 0xFFFF8000L) == (nextpred & 0xFFFF8000L)) + if (((fts & 0xFFFF8000L) == (lastsent & 0xFFFF8000L)) /* High two bits are the same on timestamp, or sending on a trunk */ && ((f->subclass & ~0x01) == pvt->svideoformat) /* is the same type */ ) @@ -2571,7 +2570,7 @@ /* don't run last_ts backwards; i.e. for retransmits and the like */ if (ts > session->last_ts && - ((fh->type == AST_FRAME_IAX || fh->type == AST_FRAME_VOICE) && + (fh->type == AST_FRAME_IAX && subclass != IAX_COMMAND_ACK && subclass != IAX_COMMAND_PONG && subclass != IAX_COMMAND_LAGRP)) @@ -2696,7 +2695,6 @@ */ e->etype = -1; e->session = session; - e->ts = ts; switch(fh->type) { case AST_FRAME_DTMF: e->etype = IAX_EVENT_DTMF; @@ -2709,6 +2707,7 @@ case AST_FRAME_VOICE: e->etype = IAX_EVENT_VOICE; e->subclass = subclass; + e->ts = ts; session->voiceformat = subclass; if (datalen) { memcpy(e->data, fh->iedata, datalen); @@ -2789,14 +2788,17 @@ case IAX_COMMAND_LAGRQ: /* Pass this along for later handling */ e->etype = IAX_EVENT_LAGRQ; + e->ts = ts; e = schedule_delivery(e, ts, updatehistory); break; case IAX_COMMAND_POKE: e->etype = IAX_EVENT_POKE; + e->ts = ts; break; case IAX_COMMAND_PING: /* PINGS and PONGS don't get scheduled; */ e->etype = IAX_EVENT_PING; + e->ts = ts; break; case IAX_COMMAND_PONG: e->etype = IAX_EVENT_PONG; @@ -2965,6 +2967,7 @@ case AST_FRAME_VIDEO: e->etype = IAX_EVENT_VIDEO; e->subclass = subclass; + e->ts = ts; session->videoformat = e->subclass; memcpy(e->data, fh->iedata, datalen); e->datalen = datalen; @@ -3082,8 +3085,7 @@ e->subclass = session->voiceformat; e->datalen = datalen; memcpy(e->data, mh->data, datalen); - e->ts = (session->last_ts & 0xFFFF0000L) | (ntohs(mh->ts) & 0xFFFF); - e->ts = unwrap_timestamp(e->ts, session->last_ts); + e->ts = (session->last_ts & 0xFFFF0000) | ntohs(mh->ts); return schedule_delivery(e, e->ts, 1); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <do...@us...> - 2008-01-29 21:26:56
|
Revision: 1334 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1334&view=rev Author: dohpaz Date: 2008-01-29 13:27:00 -0800 (Tue, 29 Jan 2008) Log Message: ----------- Revert out change 1328. Causes more problems then it attempted to fix. Need to figure out why it works in asterisk but not iaxclient. Modified Paths: -------------- branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c Modified: branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c =================================================================== --- branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c 2008-01-24 20:15:59 UTC (rev 1333) +++ branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c 2008-01-29 21:27:00 UTC (rev 1334) @@ -662,7 +662,9 @@ } /* Record the last sent packet for future reference */ - session->lastsent = ms; + /* unless an AST_FRAME_IAX */ + if (!genuine) + session->lastsent = ms; #ifdef USE_VOICE_TS_PREDICTION /* set next predicted ts based on 8khz samples */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bc...@us...> - 2008-01-24 20:15:53
|
Revision: 1333 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1333&view=rev Author: bcholew Date: 2008-01-24 12:15:59 -0800 (Thu, 24 Jan 2008) Log Message: ----------- Distinguish between speex-specific and echo-cancellation-generic code. Modified Paths: -------------- trunk/lib/audio_portaudio.c Modified: trunk/lib/audio_portaudio.c =================================================================== --- trunk/lib/audio_portaudio.c 2008-01-24 19:10:01 UTC (rev 1332) +++ trunk/lib/audio_portaudio.c 2008-01-24 20:15:59 UTC (rev 1333) @@ -38,16 +38,19 @@ #include "portmixer.h" #ifdef USE_MEC2 +#define DO_EC #include "mec3.h" static echo_can_state_t *ec; #endif #ifdef SPAN_EC +#define DO_EC #include "ec/echo.h" static echo_can_state_t *ec; #endif -#ifdef SPEEX_EC +#if defined(SPEEX_EC) && ! defined (WIN32) +#define DO_EC #define restrict __restrict #include "speex/speex_echo.h" static SpeexEchoState *ec; @@ -390,15 +393,16 @@ * it's turned back on. */ if ( !(iaxc_get_filters() & IAXC_FILTER_ECHO) ) { -#if defined(SPEEX_EC) +#if defined(DO_EC) if ( ec ) { #if defined(USE_MEC2) || defined(SPAN_EC) echo_can_free(ec); ec = NULL; -#endif +#elif defined(SPEEX_EC) speex_echo_state_destroy(ec); ec = NULL; +#endif } #endif @@ -407,14 +411,15 @@ /* we want echo cancellation */ -#if defined(SPEEX_EC) +#if defined(DO_EC) if ( !ec ) { rb_InitializeRingBuffer(&ecOutRing, EC_RING_SZ, &outRingBuf); #if defined(USE_MEC2) || defined(SPAN_EC) ec = echo_can_create(ECHO_TAIL, 0); +#elif defined(SPEEX_EC) + ec = speex_echo_state_init(SAMPLES_PER_FRAME, ECHO_TAIL); #endif - ec = speex_echo_state_init(SAMPLES_PER_FRAME, ECHO_TAIL); } #endif @@ -428,7 +433,7 @@ rb_ReadRingBuffer(&ecOutRing, delayedBuf, n * 2); -#if defined(SPEEX_EC) +#if defined(DO_EC) && defined(SPEEX_EC) { short cancelledBuffer[1024]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bc...@us...> - 2008-01-24 19:09:56
|
Revision: 1332 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1332&view=rev Author: bcholew Date: 2008-01-24 11:10:01 -0800 (Thu, 24 Jan 2008) Log Message: ----------- Turn off SPEEX_EC flag. It doesn't work. Fix to allow SPEEX_EC to be undefined. Modified Paths: -------------- trunk/contrib/win/vs2005/libiaxclient.vcproj trunk/lib/audio_portaudio.c Modified: trunk/contrib/win/vs2005/libiaxclient.vcproj =================================================================== --- trunk/contrib/win/vs2005/libiaxclient.vcproj 2008-01-14 19:04:03 UTC (rev 1331) +++ trunk/contrib/win/vs2005/libiaxclient.vcproj 2008-01-24 19:10:01 UTC (rev 1332) @@ -40,7 +40,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\..\lib\libiax2\src;..\..\..\..\portaudio\include;..\..\..\lib\spandsp;..\..\..\lib\gsm\inc;..\..\..\..\speex\include;..\..\..\..\libogg\include;..\..\..\..\libtheora\include;..\..\..\lib\portmixer\px_common;..\..\..\..\libvidcap\include" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;PA_NO_DS;PA_NO_ASIO;BUILDING_DLL;LIBIAX;_CRT_SECURE_NO_DEPRECATE;strncasecmp=strnicmp;__inline__=_inline;SPEEX_EC=1;NTDDI_VERSION=NTDDI_WIN2KSP4;_WIN32_WINNT=0x0500;WINVER=0x0500;USE_VIDEO;USE_THEORA;CODEC_GSM" + PreprocessorDefinitions="WIN32;_DEBUG;_LIB;PA_NO_DS;PA_NO_ASIO;BUILDING_DLL;LIBIAX;_CRT_SECURE_NO_DEPRECATE;strncasecmp=strnicmp;__inline__=_inline;NTDDI_VERSION=NTDDI_WIN2KSP4;_WIN32_WINNT=0x0500;WINVER=0x0500;USE_VIDEO;USE_THEORA;CODEC_GSM" BasicRuntimeChecks="3" RuntimeLibrary="3" WarningLevel="3" @@ -104,7 +104,7 @@ <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="..\..\..\lib\libiax2\src;..\..\..\..\portaudio\include;..\..\..\lib\spandsp;..\..\..\lib\gsm\inc;..\..\..\..\speex\include;..\..\..\..\libogg\include;..\..\..\..\libtheora\include;..\..\..\lib\portmixer\px_common;..\..\..\..\libvidcap\include" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;PA_NO_DS;PA_NO_ASIO;BUILDING_DLL;LIBIAX;_CRT_SECURE_NO_DEPRECATE;strncasecmp=strnicmp;__inline__=_inline;SPEEX_EC=1;NTDDI_VERSION=NTDDI_WIN2KSP4;_WIN32_WINNT=0x0500;WINVER=0x0500;USE_VIDEO;USE_THEORA;CODEC_GSM" + PreprocessorDefinitions="WIN32;NDEBUG;_LIB;PA_NO_DS;PA_NO_ASIO;BUILDING_DLL;LIBIAX;_CRT_SECURE_NO_DEPRECATE;strncasecmp=strnicmp;__inline__=_inline;NTDDI_VERSION=NTDDI_WIN2KSP4;_WIN32_WINNT=0x0500;WINVER=0x0500;USE_VIDEO;USE_THEORA;CODEC_GSM" RuntimeLibrary="2" WarningLevel="3" Detect64BitPortabilityProblems="true" @@ -167,7 +167,7 @@ <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="..\..\..\lib\libiax2\src;..\..\..\..\portaudio\include;..\..\..\lib\spandsp;..\..\..\lib\gsm\inc;..\..\..\..\speex\include;..\..\..\..\libogg\include;..\..\..\..\libtheora\include;..\..\..\lib\portmixer\px_common;..\..\..\..\libvidcap\include" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;PA_NO_DS;PA_NO_ASIO;BUILDING_DLL;LIBIAX;_CRT_SECURE_NO_DEPRECATE;strncasecmp=strnicmp;__inline__=_inline;SPEEX_EC=1;NTDDI_VERSION=NTDDI_WIN2KSP4;_WIN32_WINNT=0x0500;WINVER=0x0500;USE_VIDEO;USE_THEORA;CODEC_GSM" + PreprocessorDefinitions="WIN32;NDEBUG;_LIB;PA_NO_DS;PA_NO_ASIO;BUILDING_DLL;LIBIAX;_CRT_SECURE_NO_DEPRECATE;strncasecmp=strnicmp;__inline__=_inline;NTDDI_VERSION=NTDDI_WIN2KSP4;_WIN32_WINNT=0x0500;WINVER=0x0500;USE_VIDEO;USE_THEORA;CODEC_GSM" RuntimeLibrary="2" WarningLevel="3" Detect64BitPortabilityProblems="true" @@ -239,7 +239,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\..\lib\libiax2\src;..\..\..\..\portaudio\include;..\..\..\lib\spandsp;..\..\..\lib\gsm\inc;..\..\..\..\speex\include;..\..\..\..\libogg\include;..\..\..\..\libtheora\include;..\..\..\lib\portmixer\px_common;..\..\..\..\libvidcap\include" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;PA_NO_DS;PA_NO_ASIO;BUILDING_DLL;LIBIAX;_CRT_SECURE_NO_DEPRECATE;strncasecmp=strnicmp;__inline__=_inline;SPEEX_EC=1;NTDDI_VERSION=NTDDI_WIN2KSP4;_WIN32_WINNT=0x0500;WINVER=0x0500;USE_VIDEO;USE_THEORA;CODEC_GSM" + PreprocessorDefinitions="WIN32;_DEBUG;_LIB;PA_NO_DS;PA_NO_ASIO;BUILDING_DLL;LIBIAX;_CRT_SECURE_NO_DEPRECATE;strncasecmp=strnicmp;__inline__=_inline;NTDDI_VERSION=NTDDI_WIN2KSP4;_WIN32_WINNT=0x0500;WINVER=0x0500;USE_VIDEO;USE_THEORA;CODEC_GSM" BasicRuntimeChecks="3" RuntimeLibrary="3" WarningLevel="3" Modified: trunk/lib/audio_portaudio.c =================================================================== --- trunk/lib/audio_portaudio.c 2008-01-14 19:04:03 UTC (rev 1331) +++ trunk/lib/audio_portaudio.c 2008-01-24 19:10:01 UTC (rev 1332) @@ -390,33 +390,33 @@ * it's turned back on. */ if ( !(iaxc_get_filters() & IAXC_FILTER_ECHO) ) { +#if defined(SPEEX_EC) if ( ec ) { #if defined(USE_MEC2) || defined(SPAN_EC) echo_can_free(ec); ec = NULL; #endif -#if defined(SPEEX_EC) speex_echo_state_destroy(ec); ec = NULL; + } #endif - } return; } /* we want echo cancellation */ +#if defined(SPEEX_EC) if ( !ec ) { rb_InitializeRingBuffer(&ecOutRing, EC_RING_SZ, &outRingBuf); #if defined(USE_MEC2) || defined(SPAN_EC) ec = echo_can_create(ECHO_TAIL, 0); #endif -#if defined(SPEEX_EC) ec = speex_echo_state_init(SAMPLES_PER_FRAME, ECHO_TAIL); + } #endif - } /* fill ecOutRing */ rb_WriteRingBuffer(&ecOutRing, outputBuffer, n * 2); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bc...@us...> - 2008-01-14 19:04:00
|
Revision: 1331 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1331&view=rev Author: bcholew Date: 2008-01-14 11:04:03 -0800 (Mon, 14 Jan 2008) Log Message: ----------- Drop unnecessary extern of iax_now() in iax.c. Rename iax_now() to iax_tvnow() for symmetry with asterisk. Remove most references to libiax2's unused winpoop.h. Add config-time check for gettimeofday() in libiax2's configure.in - for the future. Modified Paths: -------------- trunk/contrib/win/vc6/libiax2.dsp trunk/contrib/win/vs2005/libiax2.vcproj trunk/lib/audio_encode.c trunk/lib/iaxclient_lib.c trunk/lib/libiax2/configure.in trunk/lib/libiax2/src/iax-client.h trunk/lib/libiax2/src/iax.c trunk/lib/video.c Removed Paths: ------------- trunk/lib/libiax2/src/winpoop.h Modified: trunk/contrib/win/vc6/libiax2.dsp =================================================================== --- trunk/contrib/win/vc6/libiax2.dsp 2008-01-14 18:03:00 UTC (rev 1330) +++ trunk/contrib/win/vc6/libiax2.dsp 2008-01-14 19:04:03 UTC (rev 1331) @@ -159,10 +159,6 @@ SOURCE=..\..\..\lib\libiax2\src\ringtone.h # End Source File -# Begin Source File - -SOURCE=..\..\..\lib\libiax2\src\winpoop.h -# End Source File # End Group # End Target # End Project Modified: trunk/contrib/win/vs2005/libiax2.vcproj =================================================================== --- trunk/contrib/win/vs2005/libiax2.vcproj 2008-01-14 18:03:00 UTC (rev 1330) +++ trunk/contrib/win/vs2005/libiax2.vcproj 2008-01-14 19:04:03 UTC (rev 1331) @@ -222,10 +222,6 @@ RelativePath="..\..\..\lib\libiax2\src\ringtone.h" > </File> - <File - RelativePath="..\..\..\lib\libiax2\src\winpoop.h" - > - </File> </Filter> <Filter Name="Resource Files" Modified: trunk/lib/audio_encode.c =================================================================== --- trunk/lib/audio_encode.c 2008-01-14 18:03:00 UTC (rev 1330) +++ trunk/lib/audio_encode.c 2008-01-14 19:04:03 UTC (rev 1331) @@ -71,7 +71,7 @@ float input_db; float output_db; - now = iax_now(); + now = iax_tvnow(); if ( last.tv_sec != 0 && iaxci_usecdiff(&now, &last) < 100000 ) return 0; @@ -261,7 +261,7 @@ int insize = samples; /* update last input timestamp */ - timeLastInput = iax_now(); + timeLastInput = iax_tvnow(); silent = input_postprocess(data, insize, 8000); @@ -342,7 +342,7 @@ int insize = len; int outsize = *samples; - timeLastOutput = iax_now(); + timeLastOutput = iax_tvnow(); if ( format == 0 ) { Modified: trunk/lib/iaxclient_lib.c =================================================================== --- trunk/lib/iaxclient_lib.c 2008-01-14 18:03:00 UTC (rev 1330) +++ trunk/lib/iaxclient_lib.c 2008-01-14 19:04:03 UTC (rev 1331) @@ -733,7 +733,7 @@ { if ( callNo < 0 ) return; - calls[callNo].last_activity = iax_now(); + calls[callNo].last_activity = iax_tvnow(); } static void iaxc_refresh_registrations() @@ -741,7 +741,7 @@ struct iaxc_registration *cur; struct timeval now; - now = iax_now(); + now = iax_tvnow(); for ( cur = registrations; cur != NULL; cur = cur->next ) { @@ -1264,7 +1264,7 @@ return -1; } - newreg->last = iax_now(); + newreg->last = iax_tvnow(); newreg->refresh = refresh; strncpy(newreg->host, host, 256); Modified: trunk/lib/libiax2/configure.in =================================================================== --- trunk/lib/libiax2/configure.in 2008-01-14 18:03:00 UTC (rev 1330) +++ trunk/lib/libiax2/configure.in 2008-01-14 19:04:03 UTC (rev 1331) @@ -15,6 +15,8 @@ dnl Check header files AC_HEADER_STDC +AC_CHECK_FUNCS(gettimeofday) + AC_SUBST(LIBS) AC_ARG_ENABLE(snomhack, [ --enable-snomhack Use slower memset for SNOM phoneem ],,enable_snomhack=no) Modified: trunk/lib/libiax2/src/iax-client.h =================================================================== --- trunk/lib/libiax2/src/iax-client.h 2008-01-14 18:03:00 UTC (rev 1330) +++ trunk/lib/libiax2/src/iax-client.h 2008-01-14 19:04:03 UTC (rev 1331) @@ -200,7 +200,7 @@ extern void iax_enable_debug(void); extern void iax_disable_debug(void); -extern struct timeval iax_now(void); +extern struct timeval iax_tvnow(void); /* For attended transfer, application create a new session, * make a call on the new session. Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2008-01-14 18:03:00 UTC (rev 1330) +++ trunk/lib/libiax2/src/iax.c 2008-01-14 19:04:03 UTC (rev 1331) @@ -47,14 +47,6 @@ #endif #endif -#ifdef __cplusplus -extern "C" { -#endif -struct timeval iax_now(void); -#ifdef __cplusplus -} -#endif - #else #include <netdb.h> @@ -396,7 +388,7 @@ sched = (struct iax_sched*)malloc(sizeof(struct iax_sched)); if (sched) { memset(sched, 0, sizeof(struct iax_sched)); - sched->when = iax_now(); + sched->when = iax_tvnow(); sched->when.tv_sec += (ms / 1000); ms = ms % 1000; sched->when.tv_usec += (ms * 1000); @@ -463,7 +455,7 @@ /* If there are no pending events, we don't need to timeout */ if (!cur) return -1; - tv = iax_now(); + tv = iax_tvnow(); while(cur) { ms = (cur->when.tv_sec - tv.tv_sec) * 1000 + (cur->when.tv_usec - tv.tv_usec) / 1000; @@ -598,7 +590,7 @@ /* If this is the first packet we're sending, get our offset now. */ if (!session->offset.tv_sec && !session->offset.tv_usec) - session->offset = iax_now(); + session->offset = iax_tvnow(); /* If the timestamp is specified, just use their specified timestamp no matter what. Usually this is done for @@ -611,7 +603,7 @@ } /* Otherwise calculate the timestamp from the current time */ - tv = iax_now(); + tv = iax_tvnow(); /* Calculate the number of milliseconds since we sent the first packet */ ms = (tv.tv_sec - session->offset.tv_sec) * 1000 + @@ -2230,9 +2222,9 @@ int ms; if (!session->rxcore.tv_sec && !session->rxcore.tv_usec) { - session->rxcore = iax_now(); + session->rxcore = iax_tvnow(); } - tv = iax_now(); + tv = iax_tvnow(); ms = (tv.tv_sec - session->rxcore.tv_sec) * 1000 + (tv.tv_usec - session->rxcore.tv_usec) / 1000; @@ -3263,7 +3255,7 @@ struct iax_sched *cur; struct iax_session *session; - tv = iax_now(); + tv = iax_tvnow(); while((cur = iax_get_sched(tv))) { @@ -3490,7 +3482,7 @@ return send_command(session, AST_FRAME_IAX, IAX_COMMAND_QUELCH, 0, ied.buf, ied.pos, -1); } -struct timeval iax_now(void) +struct timeval iax_tvnow(void) { struct timeval tv; Deleted: trunk/lib/libiax2/src/winpoop.h =================================================================== --- trunk/lib/libiax2/src/winpoop.h 2008-01-14 18:03:00 UTC (rev 1330) +++ trunk/lib/libiax2/src/winpoop.h 2008-01-14 19:04:03 UTC (rev 1331) @@ -1,41 +0,0 @@ -/* - * Functions Windows doesn't have... but should - * Copyright(C) 2001, Linux Support Services, Inc. - * - * Distributed under GNU LGPL. - * - * These are NOT fully compliant with BSD 4.3 and are not - * threadsafe. - * - */ - -#ifndef _winpoop_h -#define _winpoop_h - -#if defined(_MSC_VER) -#define INLINE __inline -#else -#define INLINE inline -#endif - -#include <winsock.h> - -void gettimeofday(struct timeval *tv, void /*struct timezone*/ *tz); - -static INLINE int inet_aton(char *cp, struct in_addr *inp) -{ - int a1, a2, a3, a4; - unsigned int saddr; - - if (sscanf(cp, "%d.%d.%d.%d", &a1, &a2, &a3, &a4) != 4) - return 0; - a1 &= 0xff; - a2 &= 0xff; - a3 &= 0xff; - a4 &= 0xff; - saddr = (a1 << 24) | (a2 << 16) | (a3 << 8) | a4; - inp->s_addr = htonl(saddr); - return 1; -} - -#endif Modified: trunk/lib/video.c =================================================================== --- trunk/lib/video.c 2008-01-14 18:03:00 UTC (rev 1330) +++ trunk/lib/video.c 2008-01-14 19:04:03 UTC (rev 1331) @@ -139,7 +139,7 @@ return; memset(&vcodec->video_stats, 0, sizeof(struct iaxc_video_stats)); - vcodec->video_stats.start_time = iax_now(); + vcodec->video_stats.start_time = iax_tvnow(); } static void reset_video_stats(struct iaxc_call * call) @@ -200,9 +200,9 @@ return -1; if ( video_stats_start.tv_sec == 0 && video_stats_start.tv_usec == 0 ) - video_stats_start = iax_now(); + video_stats_start = iax_tvnow(); - now = iax_now(); + now = iax_tvnow(); if ( iaxci_msecdiff(&now, &video_stats_start) > video_stats_interval ) { @@ -732,7 +732,7 @@ /* Gather statistics */ call->vencoder->video_stats.outbound_frames++; - now = iax_now(); + now = iax_tvnow(); time_delta = iaxci_msecdiff(&now, &call->vencoder->video_stats.start_time); @@ -1296,7 +1296,7 @@ } /* Statistics */ - now = iax_now(); + now = iax_tvnow(); time = iaxci_msecdiff(&now, &call->vdecoder->video_stats.start_time); call->vdecoder->video_stats.received_slices++; call->vdecoder->video_stats.acc_recv_size += encoded_video_len; @@ -1776,9 +1776,9 @@ return -1; if ( video_stats_start.tv_sec == 0 && video_stats_start.tv_usec == 0 ) - video_stats_start = iax_now(); + video_stats_start = iax_tvnow(); - now = iax_now(); + now = iax_tvnow(); if ( iaxci_msecdiff(&now, &video_stats_start) > video_stats_interval ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bc...@us...> - 2008-01-14 18:02:57
|
Revision: 1330 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1330&view=rev Author: bcholew Date: 2008-01-14 10:03:00 -0800 (Mon, 14 Jan 2008) Log Message: ----------- Move local gettimeofday() implementation from winfuncs.c to new function iax_now() in libiax2 (different semantics). Use iax_now() in place of gettimeofday() throughout code. Add config-time check for gettimeofday() for unix builds. Move iax_seed_random() and iax_random() out of DEBUG_SUPPORT section. Remove small C99-ism to keep msoft happy. Modified Paths: -------------- trunk/configure.ac trunk/lib/audio_encode.c trunk/lib/iaxclient_lib.c trunk/lib/iaxclient_lib.h trunk/lib/libiax2/src/iax-client.h trunk/lib/libiax2/src/iax.c trunk/lib/video.c trunk/lib/winfuncs.c Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2008-01-09 07:59:40 UTC (rev 1329) +++ trunk/configure.ac 2008-01-14 18:03:00 UTC (rev 1330) @@ -47,6 +47,7 @@ AC_CHECK_FUNCS([vsnprintf _vsnprintf]) AC_CHECK_FUNCS([srandomdev srandom srand48 random lrand48]) +AC_CHECK_FUNCS(gettimeofday) ACX_PTHREAD Modified: trunk/lib/audio_encode.c =================================================================== --- trunk/lib/audio_encode.c 2008-01-09 07:59:40 UTC (rev 1329) +++ trunk/lib/audio_encode.c 2008-01-14 18:03:00 UTC (rev 1330) @@ -71,7 +71,7 @@ float input_db; float output_db; - gettimeofday(&now, 0); + now = iax_now(); if ( last.tv_sec != 0 && iaxci_usecdiff(&now, &last) < 100000 ) return 0; @@ -261,7 +261,7 @@ int insize = samples; /* update last input timestamp */ - gettimeofday( &timeLastInput, NULL ) ; + timeLastInput = iax_now(); silent = input_postprocess(data, insize, 8000); @@ -342,7 +342,7 @@ int insize = len; int outsize = *samples; - gettimeofday( &timeLastOutput, NULL ) ; + timeLastOutput = iax_now(); if ( format == 0 ) { Modified: trunk/lib/iaxclient_lib.c =================================================================== --- trunk/lib/iaxclient_lib.c 2008-01-09 07:59:40 UTC (rev 1329) +++ trunk/lib/iaxclient_lib.c 2008-01-14 18:03:00 UTC (rev 1330) @@ -733,7 +733,7 @@ { if ( callNo < 0 ) return; - gettimeofday(&calls[callNo].last_activity, NULL); + calls[callNo].last_activity = iax_now(); } static void iaxc_refresh_registrations() @@ -741,7 +741,7 @@ struct iaxc_registration *cur; struct timeval now; - gettimeofday(&now,NULL); + now = iax_now(); for ( cur = registrations; cur != NULL; cur = cur->next ) { @@ -1264,7 +1264,7 @@ return -1; } - gettimeofday(&newreg->last,NULL); + newreg->last = iax_now(); newreg->refresh = refresh; strncpy(newreg->host, host, 256); Modified: trunk/lib/iaxclient_lib.h =================================================================== --- trunk/lib/iaxclient_lib.h 2008-01-09 07:59:40 UTC (rev 1329) +++ trunk/lib/iaxclient_lib.h 2008-01-14 18:03:00 UTC (rev 1330) @@ -32,7 +32,6 @@ #include <string.h> #if defined(WIN32) || defined(_WIN32_WCE) -void gettimeofday(struct timeval *tv, void /*struct timezone*/ *tz); #include <winsock.h> #if !defined(_WIN32_WCE) #include <process.h> Modified: trunk/lib/libiax2/src/iax-client.h =================================================================== --- trunk/lib/libiax2/src/iax-client.h 2008-01-09 07:59:40 UTC (rev 1329) +++ trunk/lib/libiax2/src/iax-client.h 2008-01-14 18:03:00 UTC (rev 1330) @@ -200,6 +200,8 @@ extern void iax_enable_debug(void); extern void iax_disable_debug(void); +extern struct timeval iax_now(void); + /* For attended transfer, application create a new session, * make a call on the new session. * On answer of the new session, call iax_setup_transfer and wait for Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2008-01-09 07:59:40 UTC (rev 1329) +++ trunk/lib/libiax2/src/iax.c 2008-01-14 18:03:00 UTC (rev 1330) @@ -34,6 +34,9 @@ #include <stdio.h> #include <limits.h> +#if !defined(_WIN32_WCE) +#include <sys/timeb.h> +#endif #define snprintf _snprintf @@ -47,7 +50,7 @@ #ifdef __cplusplus extern "C" { #endif -void gettimeofday(struct timeval *tv, void /*struct timezone*/ *tz); +struct timeval iax_now(void); #ifdef __cplusplus } #endif @@ -278,30 +281,6 @@ s->sendto = ptr; } -void iax_seed_random() -{ -#if defined(HAVE_SRANDOMDEV) - srandomdev(); -#elif defined(HAVE_SRANDOM) - srandom((unsigned int)time(0)); -#elif defined(HAVE_SRAND48) - srand48((long int)time(0)); -#else - srand((unsigned int)time(0)); -#endif -} - -int iax_random() -{ -#if defined(HAVE_RANDOM) - return (int)random(); -#elif defined(HAVE_LRAND48) - return (int)lrand48(); -#else - return rand(); -#endif -} - /* This is a little strange, but to debug you call DEBU(G "Hello World!\n"); */ #if defined(WIN32) || defined(_WIN32_WCE) #define G __FILE__, __LINE__, @@ -346,6 +325,30 @@ #define G #endif +void iax_seed_random() +{ +#if defined(HAVE_SRANDOMDEV) + srandomdev(); +#elif defined(HAVE_SRANDOM) + srandom((unsigned int)time(0)); +#elif defined(HAVE_SRAND48) + srand48((long int)time(0)); +#else + srand((unsigned int)time(0)); +#endif +} + +int iax_random() +{ +#if defined(HAVE_RANDOM) + return (int)random(); +#elif defined(HAVE_LRAND48) + return (int)lrand48(); +#else + return rand(); +#endif +} + typedef void (*sched_func)(void *); struct iax_sched { @@ -393,7 +396,7 @@ sched = (struct iax_sched*)malloc(sizeof(struct iax_sched)); if (sched) { memset(sched, 0, sizeof(struct iax_sched)); - gettimeofday(&sched->when, NULL); + sched->when = iax_now(); sched->when.tv_sec += (ms / 1000); ms = ms % 1000; sched->when.tv_usec += (ms * 1000); @@ -460,7 +463,7 @@ /* If there are no pending events, we don't need to timeout */ if (!cur) return -1; - gettimeofday(&tv, NULL); + tv = iax_now(); while(cur) { ms = (cur->when.tv_sec - tv.tv_sec) * 1000 + (cur->when.tv_usec - tv.tv_usec) / 1000; @@ -595,7 +598,7 @@ /* If this is the first packet we're sending, get our offset now. */ if (!session->offset.tv_sec && !session->offset.tv_usec) - gettimeofday(&session->offset, NULL); + session->offset = iax_now(); /* If the timestamp is specified, just use their specified timestamp no matter what. Usually this is done for @@ -608,7 +611,7 @@ } /* Otherwise calculate the timestamp from the current time */ - gettimeofday(&tv, NULL); + tv = iax_now(); /* Calculate the number of milliseconds since we sent the first packet */ ms = (tv.tv_sec - session->offset.tv_sec) * 1000 + @@ -1419,12 +1422,12 @@ struct iax_session *s0 = org_session; struct iax_session *s1 = new_session; + int transfer_id = 1 + (int)(32767.0 * (iax_random() / (RAND_MAX + 1.0))); + memset(&ied0, 0, sizeof(ied0)); memset(&ied1, 0, sizeof(ied1)); - int transfer_id = 1 + (int)(32767.0 * (iax_random() / (RAND_MAX + 1.0))); - /* reversed setup */ iax_ie_append_addr(&ied0, IAX_IE_APPARENT_ADDR, &s1->peeraddr); iax_ie_append_short(&ied0, IAX_IE_CALLNO, s1->peercallno); @@ -2227,9 +2230,9 @@ int ms; if (!session->rxcore.tv_sec && !session->rxcore.tv_usec) { - gettimeofday(&session->rxcore, NULL); + session->rxcore = iax_now(); } - gettimeofday(&tv, NULL); + tv = iax_now(); ms = (tv.tv_sec - session->rxcore.tv_sec) * 1000 + (tv.tv_usec - session->rxcore.tv_usec) / 1000; @@ -3260,7 +3263,7 @@ struct iax_sched *cur; struct iax_session *session; - gettimeofday(&tv, NULL); + tv = iax_now(); while((cur = iax_get_sched(tv))) { @@ -3486,3 +3489,21 @@ return send_command(session, AST_FRAME_IAX, IAX_COMMAND_QUELCH, 0, ied.buf, ied.pos, -1); } + +struct timeval iax_now(void) +{ + struct timeval tv; + +#ifdef HAVE_GETTIMEOFDAY + gettimeofday(&tv, 0); +#elif defined(_MSC_VER) + struct _timeb curSysTime; + + _ftime(&curSysTime); + tv.tv_sec = (long)curSysTime.time; + tv.tv_usec = curSysTime.millitm * 1000; +#else +#error no gettimeofday or equivalent available +#endif + return tv; +} Modified: trunk/lib/video.c =================================================================== --- trunk/lib/video.c 2008-01-09 07:59:40 UTC (rev 1329) +++ trunk/lib/video.c 2008-01-14 18:03:00 UTC (rev 1330) @@ -139,7 +139,7 @@ return; memset(&vcodec->video_stats, 0, sizeof(struct iaxc_video_stats)); - gettimeofday(&vcodec->video_stats.start_time, 0); + vcodec->video_stats.start_time = iax_now(); } static void reset_video_stats(struct iaxc_call * call) @@ -200,9 +200,9 @@ return -1; if ( video_stats_start.tv_sec == 0 && video_stats_start.tv_usec == 0 ) - gettimeofday(&video_stats_start, 0); + video_stats_start = iax_now(); - gettimeofday(&now, 0); + now = iax_now(); if ( iaxci_msecdiff(&now, &video_stats_start) > video_stats_interval ) { @@ -732,7 +732,7 @@ /* Gather statistics */ call->vencoder->video_stats.outbound_frames++; - gettimeofday(&now, 0); + now = iax_now(); time_delta = iaxci_msecdiff(&now, &call->vencoder->video_stats.start_time); @@ -1296,7 +1296,7 @@ } /* Statistics */ - gettimeofday(&now, 0); + now = iax_now(); time = iaxci_msecdiff(&now, &call->vdecoder->video_stats.start_time); call->vdecoder->video_stats.received_slices++; call->vdecoder->video_stats.acc_recv_size += encoded_video_len; @@ -1776,9 +1776,9 @@ return -1; if ( video_stats_start.tv_sec == 0 && video_stats_start.tv_usec == 0 ) - gettimeofday(&video_stats_start, 0); + video_stats_start = iax_now(); - gettimeofday(&now, 0); + now = iax_now(); if ( iaxci_msecdiff(&now, &video_stats_start) > video_stats_interval ) { Modified: trunk/lib/winfuncs.c =================================================================== --- trunk/lib/winfuncs.c 2008-01-09 07:59:40 UTC (rev 1329) +++ trunk/lib/winfuncs.c 2008-01-14 18:03:00 UTC (rev 1330) @@ -19,33 +19,6 @@ #include <stdio.h> -#if !defined(_WIN32_WCE) -#include <sys/timeb.h> - -/* Win-doze doesnt have gettimeofday(). This sux. So, what we did is -provide some gettimeofday-like functionality that works for our purposes. */ - -/* - changed 'struct timezone*' to 'void*' since - timezone is defined as a long in MINGW and caused compile-time warnings. - this should be okay since we don't use the passed value. -*/ - - -/* - * functions implementations - */ - -void gettimeofday( struct timeval* tv, void* tz ) -{ - struct _timeb curSysTime; - - _ftime(&curSysTime); - tv->tv_sec = (long)curSysTime.time; - tv->tv_usec = curSysTime.millitm * 1000; -} -#endif - void os_init(void) { WSADATA wsd; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <do...@us...> - 2008-01-09 07:59:35
|
Revision: 1329 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1329&view=rev Author: dohpaz Date: 2008-01-08 23:59:40 -0800 (Tue, 08 Jan 2008) Log Message: ----------- Only call complete_transfer once in per code path in iax_handle_txready(). Make sure to clear transfer_moh if iax_unquelch is called. Modified Paths: -------------- branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c Modified: branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c =================================================================== --- branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c 2008-01-08 23:01:12 UTC (rev 1328) +++ branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c 2008-01-09 07:59:40 UTC (rev 1329) @@ -1504,12 +1504,9 @@ short s0_org_peer, s1_org_peer; if (s->transfer_moh) { - s->transfer_moh = 0; iax_unquelch(s); } - complete_transfer(s, s->peercallno, 0, 1); - s->transferring = TRANSFER_REL; s0 = s; @@ -1527,6 +1524,9 @@ iax_finish_transfer(s1, s0_org_peer); return 1; } + else { + complete_transfer(s, s->peercallno, 0, 1); + } return 0; } @@ -2052,6 +2052,10 @@ int iax_unquelch(struct iax_session *session) { + if (session->transfer_moh) { + session->transfer_moh = 0; + } + return send_command(session, AST_FRAME_IAX, IAX_COMMAND_UNQUELCH, 0, NULL, 0, -1); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <do...@us...> - 2008-01-08 23:01:11
|
Revision: 1328 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1328&view=rev Author: dohpaz Date: 2008-01-08 15:01:12 -0800 (Tue, 08 Jan 2008) Log Message: ----------- Always note lastsent at the end of calc_timestamp() even if it's a genuine AST_FRAME_IAX packet. Brings inline with what's in chan_iax2.c. Modified Paths: -------------- branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c Modified: branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c =================================================================== --- branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c 2007-12-21 15:52:10 UTC (rev 1327) +++ branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c 2008-01-08 23:01:12 UTC (rev 1328) @@ -662,9 +662,7 @@ } /* Record the last sent packet for future reference */ - /* unless an AST_FRAME_IAX */ - if (!genuine) - session->lastsent = ms; + session->lastsent = ms; #ifdef USE_VOICE_TS_PREDICTION /* set next predicted ts based on 8khz samples */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpg...@us...> - 2007-12-21 15:52:05
|
Revision: 1327 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1327&view=rev Author: jpgrayson Date: 2007-12-21 07:52:10 -0800 (Fri, 21 Dec 2007) Log Message: ----------- Revert changeset 1313. This change caused REGACK events to implictly destroy the iax_session. This lead to iaxclient double-destroying that session (aka crashing). Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2007-12-21 14:54:16 UTC (rev 1326) +++ trunk/lib/libiax2/src/iax.c 2007-12-21 15:52:10 UTC (rev 1327) @@ -1629,7 +1629,6 @@ */ case IAX_EVENT_REJECT: case IAX_EVENT_HANGUP: - case IAX_EVENT_REGACK: /* Destroy this session -- it's no longer valid */ destroy_session(event->session); return event; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <do...@us...> - 2007-12-21 14:54:11
|
Revision: 1326 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1326&view=rev Author: dohpaz Date: 2007-12-21 06:54:16 -0800 (Fri, 21 Dec 2007) Log Message: ----------- Pull out patch 1850525 until we can work out where these sessions should be destroyed. Modified Paths: -------------- branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c Modified: branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c =================================================================== --- branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c 2007-12-21 14:52:48 UTC (rev 1325) +++ branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c 2007-12-21 14:54:16 UTC (rev 1326) @@ -1629,7 +1629,6 @@ */ case IAX_EVENT_REJECT: case IAX_EVENT_HANGUP: - case IAX_EVENT_REGACK: /* Destroy this session -- it's no longer valid */ destroy_session(event->session); return event; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <do...@us...> - 2007-12-21 14:52:44
|
Revision: 1325 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1325&view=rev Author: dohpaz Date: 2007-12-21 06:52:48 -0800 (Fri, 21 Dec 2007) Log Message: ----------- Merge up to trunk of r1324. Modified Paths: -------------- branches/team/elbunce/iaxclient/Doxyfile branches/team/elbunce/iaxclient/doc/src/mainpage.dox branches/team/elbunce/iaxclient/lib/iaxclient_lib.c branches/team/elbunce/iaxclient/lib/libiax2/src/iax-client.h branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c branches/team/elbunce/iaxclient/lib/libiax2/src/iax2-parser.c Modified: branches/team/elbunce/iaxclient/Doxyfile =================================================================== --- branches/team/elbunce/iaxclient/Doxyfile 2007-12-20 17:45:11 UTC (rev 1324) +++ branches/team/elbunce/iaxclient/Doxyfile 2007-12-21 14:52:48 UTC (rev 1325) @@ -200,7 +200,7 @@ ENABLE_PREPROCESSING = YES MACRO_EXPANSION = YES EXPAND_ONLY_PREDEF = YES -SEARCH_INCLUDES = YES +SEARCH_INCLUDES = NO INCLUDE_PATH = INCLUDE_FILE_PATTERNS = PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS \ Modified: branches/team/elbunce/iaxclient/doc/src/mainpage.dox =================================================================== --- branches/team/elbunce/iaxclient/doc/src/mainpage.dox 2007-12-20 17:45:11 UTC (rev 1324) +++ branches/team/elbunce/iaxclient/doc/src/mainpage.dox 2007-12-21 14:52:48 UTC (rev 1325) @@ -1,8 +1,7 @@ /*! \mainpage <A href="http://iaxclient.sourceforge.net/">IAXClient</A> is an Open Source library to implement the IAX protocol used by -<A href="http://www.asterisk.org/">The Asterisk Software PBX</A>. -It is licensed under the the LGPL \ref License.<BR> +<A href="http://www.asterisk.org/">The Asterisk Software PBX</A> and is licensed under the the LGPL \ref License.<BR> Although asterisk supports other VOIP protocols (including SIP, and with patches, H.323), IAX's simple, lightweight nature gives it several advantages, particularly in that it can operate easily through NAT and packet firewalls, and it is easily extensible and simple to understand. Modified: branches/team/elbunce/iaxclient/lib/iaxclient_lib.c =================================================================== --- branches/team/elbunce/iaxclient/lib/iaxclient_lib.c 2007-12-20 17:45:11 UTC (rev 1324) +++ branches/team/elbunce/iaxclient/lib/iaxclient_lib.c 2007-12-21 14:52:48 UTC (rev 1325) @@ -1795,6 +1795,7 @@ iaxci_usermsg(IAXC_ERROR, "Registration requested by someone, but we don't understand!"); } else if ( e->etype == IAX_EVENT_CONNECT ) + { iaxc_handle_connect(e); } else if ( e->etype == IAX_EVENT_TIMEOUT ) Modified: branches/team/elbunce/iaxclient/lib/libiax2/src/iax-client.h =================================================================== --- branches/team/elbunce/iaxclient/lib/libiax2/src/iax-client.h 2007-12-20 17:45:11 UTC (rev 1324) +++ branches/team/elbunce/iaxclient/lib/libiax2/src/iax-client.h 2007-12-21 14:52:48 UTC (rev 1325) @@ -184,6 +184,7 @@ extern int iax_ring_announce(struct iax_session *session); extern struct sockaddr_in iax_get_peer_addr(struct iax_session *session); extern int iax_register(struct iax_session *session, const char *hostname, const char *peer, const char *secret, int refresh); +extern int iax_unregister(struct iax_session *session, const char *hostname, const char *peer, const char *secret, const char *reason); extern int iax_lag_request(struct iax_session *session); extern int iax_dial(struct iax_session *session, char *number); /* Dial on a TBD call */ extern int iax_dialplan_request(struct iax_session *session, char *number); /* Request dialplan status for number */ @@ -246,8 +247,8 @@ extern void iax_set_jb_target_extra( long value ); /* Portable 'decent' random number generation */ -void iax_seed_random(); -int iax_random(); +extern void iax_seed_random(void); +extern int iax_random(void); #if defined(__cplusplus) } Modified: branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c =================================================================== --- branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c 2007-12-20 17:45:11 UTC (rev 1324) +++ branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c 2007-12-21 14:52:48 UTC (rev 1325) @@ -202,6 +202,8 @@ struct timeval rxcore; /* Current link state */ int state; + /* Unregister reason */ + char unregreason[MAXSTRLEN]; /* Expected Username */ char username[MAXSTRLEN]; /* Expected Secret */ @@ -282,7 +284,7 @@ srandomdev(); #elif defined(HAVE_SRANDOM) srandom((unsigned int)time(0)); -#elif define(HAVE_SRAND48) +#elif defined(HAVE_SRAND48) srand48((long int)time(0)); #else srand((unsigned int)time(0)); @@ -1756,6 +1758,8 @@ else strcpy(session->secret, ""); + memset(&session->unregreason, 0, sizeof(session->unregreason)); + /* Connect first */ hp = gethostbyname(tmp); if (!hp) { @@ -1773,6 +1777,49 @@ return res; } +int iax_unregister(struct iax_session *session, const char *server, const char *peer, const char *secret, const char *reason) +{ + /* Send an unregistration request */ + char tmp[256]; + char *p; + int portno = IAX_DEFAULT_PORTNO; + struct iax_ie_data ied; + struct hostent *hp; + + tmp[255] = '\0'; + strncpy(tmp, server, sizeof(tmp) - 1); + p = strchr(tmp, ':'); + if (p) { + *p = '\0'; + portno = atoi(p+1); + } + + memset(&ied, 0, sizeof(ied)); + if (secret) + strncpy(session->secret, secret, sizeof(session->secret) - 1); + else + strcpy(session->secret, ""); + + if (reason && strlen(reason)) + strncpy(session->unregreason, reason, sizeof(session->unregreason) - 1); + else + strcpy(session->unregreason, "Unspecified"); + + /* Connect first */ + hp = gethostbyname(tmp); + if (!hp) { + snprintf(iax_errstr, sizeof(iax_errstr), "Invalid hostname: %s", tmp); + return -1; + } + memcpy(&session->peeraddr.sin_addr, hp->h_addr, sizeof(session->peeraddr.sin_addr)); + session->peeraddr.sin_port = htons(portno); + session->peeraddr.sin_family = AF_INET; + strncpy(session->username, peer, sizeof(session->username) - 1); + iax_ie_append_str(&ied, IAX_IE_USERNAME, peer); + iax_ie_append_str(&ied, IAX_IE_CAUSE, session->unregreason); + return send_command(session, AST_FRAME_IAX, IAX_COMMAND_REGREL, 0, ied.buf, ied.pos, -1); +} + int iax_reject(struct iax_session *session, char *reason) { struct iax_ie_data ied; @@ -1970,7 +2017,6 @@ struct iax_ie_data ied; memset(&ied, 0, sizeof(ied)); iax_ie_append_str(&ied, IAX_IE_USERNAME, session->username); - iax_ie_append_short(&ied, IAX_IE_REFRESH, session->refresh); if ((methods & IAX_AUTHMETHOD_MD5) && challenge) { MD5Init(&md5); MD5Update(&md5, (const unsigned char *) challenge, @@ -1984,7 +2030,13 @@ } else { iax_ie_append_str(&ied, IAX_IE_PASSWORD, password); } - return send_command(session, AST_FRAME_IAX, IAX_COMMAND_REGREQ, 0, ied.buf, ied.pos, -1); + if (strlen(session->unregreason)) { /* Non-zero unregreason length indicates REGREL */ + iax_ie_append_str(&ied, IAX_IE_CAUSE, session->unregreason); + return send_command(session, AST_FRAME_IAX, IAX_COMMAND_REGREL, 0, ied.buf, ied.pos, -1); + } else { + iax_ie_append_short(&ied, IAX_IE_REFRESH, session->refresh); + return send_command(session, AST_FRAME_IAX, IAX_COMMAND_REGREQ, 0, ied.buf, ied.pos, -1); + } } Modified: branches/team/elbunce/iaxclient/lib/libiax2/src/iax2-parser.c =================================================================== --- branches/team/elbunce/iaxclient/lib/libiax2/src/iax2-parser.c 2007-12-20 17:45:11 UTC (rev 1324) +++ branches/team/elbunce/iaxclient/lib/libiax2/src/iax2-parser.c 2007-12-21 14:52:48 UTC (rev 1325) @@ -345,7 +345,12 @@ "ANSWER ", "BUSY ", "TKOFFHK ", - "OFFHOOK" }; + "OFFHOOK ", + "CONGESTION ", + "FLASH ", + "WINK ", + "OPTION " + }; struct ast_iax2_full_hdr *fh; char retries[20]; char class2[20]; @@ -368,7 +373,7 @@ /* Don't mess with mini-frames */ return; } - if (fh->type > (int)sizeof(frames)/(int)sizeof(char *)) { + if (fh->type >= (int)(sizeof(frames)/sizeof(char *))) { snprintf(class2, (int)sizeof(class2), "(%d?)", fh->type); clas = class2; } else { @@ -385,7 +390,7 @@ subclass = iaxs[(int)fh->csub]; } } else if (fh->type == AST_FRAME_CONTROL) { - if (fh->csub > (int)sizeof(cmds)/(int)sizeof(char *)) { + if (fh->csub >= (int)(sizeof(cmds)/sizeof(char *))) { snprintf(subclass2, (int)sizeof(subclass2), "(%d?)", fh->csub); subclass = subclass2; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpg...@us...> - 2007-12-20 17:45:05
|
Revision: 1324 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1324&view=rev Author: jpgrayson Date: 2007-12-20 09:45:11 -0800 (Thu, 20 Dec 2007) Log Message: ----------- Use extern decorator and be explicit about these functions taking no arguments. Modified Paths: -------------- trunk/lib/libiax2/src/iax-client.h Modified: trunk/lib/libiax2/src/iax-client.h =================================================================== --- trunk/lib/libiax2/src/iax-client.h 2007-12-20 17:44:24 UTC (rev 1323) +++ trunk/lib/libiax2/src/iax-client.h 2007-12-20 17:45:11 UTC (rev 1324) @@ -247,8 +247,8 @@ extern void iax_set_jb_target_extra( long value ); /* Portable 'decent' random number generation */ -void iax_seed_random(); -int iax_random(); +extern void iax_seed_random(void); +extern int iax_random(void); #if defined(__cplusplus) } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpg...@us...> - 2007-12-20 17:44:19
|
Revision: 1323 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1323&view=rev Author: jpgrayson Date: 2007-12-20 09:44:24 -0800 (Thu, 20 Dec 2007) Log Message: ----------- Fix preprocessor barf. "define" --> "defined". Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2007-12-20 15:27:27 UTC (rev 1322) +++ trunk/lib/libiax2/src/iax.c 2007-12-20 17:44:24 UTC (rev 1323) @@ -284,7 +284,7 @@ srandomdev(); #elif defined(HAVE_SRANDOM) srandom((unsigned int)time(0)); -#elif define(HAVE_SRAND48) +#elif defined(HAVE_SRAND48) srand48((long int)time(0)); #else srand((unsigned int)time(0)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpg...@us...> - 2007-12-20 15:27:22
|
Revision: 1322 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1322&view=rev Author: jpgrayson Date: 2007-12-20 07:27:27 -0800 (Thu, 20 Dec 2007) Log Message: ----------- Apply patch from Lee Howard / Digium's bugtracker issue 6620. This fixes some crashes in iax_showframe() Modified Paths: -------------- trunk/lib/libiax2/src/iax2-parser.c Modified: trunk/lib/libiax2/src/iax2-parser.c =================================================================== --- trunk/lib/libiax2/src/iax2-parser.c 2007-12-20 15:18:27 UTC (rev 1321) +++ trunk/lib/libiax2/src/iax2-parser.c 2007-12-20 15:27:27 UTC (rev 1322) @@ -345,7 +345,12 @@ "ANSWER ", "BUSY ", "TKOFFHK ", - "OFFHOOK" }; + "OFFHOOK ", + "CONGESTION ", + "FLASH ", + "WINK ", + "OPTION " + }; struct ast_iax2_full_hdr *fh; char retries[20]; char class2[20]; @@ -368,7 +373,7 @@ /* Don't mess with mini-frames */ return; } - if (fh->type > (int)sizeof(frames)/(int)sizeof(char *)) { + if (fh->type >= (int)(sizeof(frames)/sizeof(char *))) { snprintf(class2, (int)sizeof(class2), "(%d?)", fh->type); clas = class2; } else { @@ -385,7 +390,7 @@ subclass = iaxs[(int)fh->csub]; } } else if (fh->type == AST_FRAME_CONTROL) { - if (fh->csub > (int)sizeof(cmds)/(int)sizeof(char *)) { + if (fh->csub >= (int)(sizeof(cmds)/sizeof(char *))) { snprintf(subclass2, (int)sizeof(subclass2), "(%d?)", fh->csub); subclass = subclass2; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpg...@us...> - 2007-12-20 15:18:35
|
Revision: 1321 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1321&view=rev Author: jpgrayson Date: 2007-12-20 07:18:27 -0800 (Thu, 20 Dec 2007) Log Message: ----------- Apply patch from Lee Howard to add iax_unregister() function to libiax2 api. Modified Paths: -------------- trunk/lib/libiax2/src/iax-client.h trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax-client.h =================================================================== --- trunk/lib/libiax2/src/iax-client.h 2007-12-20 05:16:37 UTC (rev 1320) +++ trunk/lib/libiax2/src/iax-client.h 2007-12-20 15:18:27 UTC (rev 1321) @@ -184,6 +184,7 @@ extern int iax_ring_announce(struct iax_session *session); extern struct sockaddr_in iax_get_peer_addr(struct iax_session *session); extern int iax_register(struct iax_session *session, const char *hostname, const char *peer, const char *secret, int refresh); +extern int iax_unregister(struct iax_session *session, const char *hostname, const char *peer, const char *secret, const char *reason); extern int iax_lag_request(struct iax_session *session); extern int iax_dial(struct iax_session *session, char *number); /* Dial on a TBD call */ extern int iax_dialplan_request(struct iax_session *session, char *number); /* Request dialplan status for number */ Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2007-12-20 05:16:37 UTC (rev 1320) +++ trunk/lib/libiax2/src/iax.c 2007-12-20 15:18:27 UTC (rev 1321) @@ -202,6 +202,8 @@ struct timeval rxcore; /* Current link state */ int state; + /* Unregister reason */ + char unregreason[MAXSTRLEN]; /* Expected Username */ char username[MAXSTRLEN]; /* Expected Secret */ @@ -1756,6 +1758,8 @@ else strcpy(session->secret, ""); + memset(&session->unregreason, 0, sizeof(session->unregreason)); + /* Connect first */ hp = gethostbyname(tmp); if (!hp) { @@ -1773,6 +1777,49 @@ return res; } +int iax_unregister(struct iax_session *session, const char *server, const char *peer, const char *secret, const char *reason) +{ + /* Send an unregistration request */ + char tmp[256]; + char *p; + int portno = IAX_DEFAULT_PORTNO; + struct iax_ie_data ied; + struct hostent *hp; + + tmp[255] = '\0'; + strncpy(tmp, server, sizeof(tmp) - 1); + p = strchr(tmp, ':'); + if (p) { + *p = '\0'; + portno = atoi(p+1); + } + + memset(&ied, 0, sizeof(ied)); + if (secret) + strncpy(session->secret, secret, sizeof(session->secret) - 1); + else + strcpy(session->secret, ""); + + if (reason && strlen(reason)) + strncpy(session->unregreason, reason, sizeof(session->unregreason) - 1); + else + strcpy(session->unregreason, "Unspecified"); + + /* Connect first */ + hp = gethostbyname(tmp); + if (!hp) { + snprintf(iax_errstr, sizeof(iax_errstr), "Invalid hostname: %s", tmp); + return -1; + } + memcpy(&session->peeraddr.sin_addr, hp->h_addr, sizeof(session->peeraddr.sin_addr)); + session->peeraddr.sin_port = htons(portno); + session->peeraddr.sin_family = AF_INET; + strncpy(session->username, peer, sizeof(session->username) - 1); + iax_ie_append_str(&ied, IAX_IE_USERNAME, peer); + iax_ie_append_str(&ied, IAX_IE_CAUSE, session->unregreason); + return send_command(session, AST_FRAME_IAX, IAX_COMMAND_REGREL, 0, ied.buf, ied.pos, -1); +} + int iax_reject(struct iax_session *session, char *reason) { struct iax_ie_data ied; @@ -1970,7 +2017,6 @@ struct iax_ie_data ied; memset(&ied, 0, sizeof(ied)); iax_ie_append_str(&ied, IAX_IE_USERNAME, session->username); - iax_ie_append_short(&ied, IAX_IE_REFRESH, session->refresh); if ((methods & IAX_AUTHMETHOD_MD5) && challenge) { MD5Init(&md5); MD5Update(&md5, (const unsigned char *) challenge, @@ -1984,7 +2030,13 @@ } else { iax_ie_append_str(&ied, IAX_IE_PASSWORD, password); } - return send_command(session, AST_FRAME_IAX, IAX_COMMAND_REGREQ, 0, ied.buf, ied.pos, -1); + if (strlen(session->unregreason)) { /* Non-zero unregreason length indicates REGREL */ + iax_ie_append_str(&ied, IAX_IE_CAUSE, session->unregreason); + return send_command(session, AST_FRAME_IAX, IAX_COMMAND_REGREL, 0, ied.buf, ied.pos, -1); + } else { + iax_ie_append_short(&ied, IAX_IE_REFRESH, session->refresh); + return send_command(session, AST_FRAME_IAX, IAX_COMMAND_REGREQ, 0, ied.buf, ied.pos, -1); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <do...@us...> - 2007-12-20 05:16:34
|
Revision: 1320 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1320&view=rev Author: dohpaz Date: 2007-12-19 21:16:37 -0800 (Wed, 19 Dec 2007) Log Message: ----------- Merge assorted changesets from /branches/team/elbunce: 1234 Add --enable-debug-iax option to enable libiax2 DEBUG_SUPPORT. Make ALL code enabled by DEBUG_SUPPORT in libiax2 pay attention to the current debug setting. Added an iaxclient public API iaxc_debug_iax_set to control the IAX protocol debugging state. 1277 Remove meaningless message. 1285 Add iax_seed_random() and iax_random() that will use the best random number generation I can find on a particular platform. Fall back to rand() in desperation. Lower 12 bits of rand() are not very random on many platforms, one should NEVER do a straight modulus of it's return value. Add myself to contributors for various files I've contributed to. 1298 Use consistant registration timeout. 1302 Add iaxc_register_ex() API to support passing a registration refresh time. 1304 Start register refresh up to 3 seconds before expiration, allow time for resend. 1318 Merge up to trunk of r1317. (Mostly resolving merge conflicts). 1319 Better conditionalize some debug output. Modified Paths: -------------- trunk/AUTHORS trunk/Doxyfile trunk/configure.ac trunk/doc/src/mainpage.dox trunk/lib/Makefile.am trunk/lib/audio_encode.c trunk/lib/audio_portaudio.c trunk/lib/iaxclient.h trunk/lib/iaxclient_lib.c trunk/lib/libiax2/src/iax-client.h trunk/lib/libiax2/src/iax.c trunk/lib/video.c Modified: trunk/AUTHORS =================================================================== --- trunk/AUTHORS 2007-12-19 20:01:18 UTC (rev 1319) +++ trunk/AUTHORS 2007-12-20 05:16:37 UTC (rev 1320) @@ -9,7 +9,7 @@ Steve Underwood <st...@co...> [PLC implementation from spandsp] Jean-Denis Girard <jd....@sy...> [URL Receive implementation] Panfilov Dmitry <di...@bd...> [Basic ALSA-native audio driver] -Erik Bunce <kd...@bu...> [Assorted fixes/tweaks, Documentation] +Erik Bunce <kd...@bu...> [Assorted fixes/tweaks/features, Documentation] Mihai Balea <mihai at hates dot ms> Bill Welch <welch1820 at gmail dot com> [Project files for several MS development environments] Peter Grayson <jpg...@gm...> Modified: trunk/Doxyfile =================================================================== --- trunk/Doxyfile 2007-12-19 20:01:18 UTC (rev 1319) +++ trunk/Doxyfile 2007-12-20 05:16:37 UTC (rev 1320) @@ -200,7 +200,7 @@ ENABLE_PREPROCESSING = YES MACRO_EXPANSION = YES EXPAND_ONLY_PREDEF = YES -SEARCH_INCLUDES = YES +SEARCH_INCLUDES = NO INCLUDE_PATH = INCLUDE_FILE_PATTERNS = PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS \ Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2007-12-19 20:01:18 UTC (rev 1319) +++ trunk/configure.ac 2007-12-20 05:16:37 UTC (rev 1320) @@ -46,6 +46,7 @@ AC_TYPE_SIZE_T AC_CHECK_FUNCS([vsnprintf _vsnprintf]) +AC_CHECK_FUNCS([srandomdev srandom srand48 random lrand48]) ACX_PTHREAD @@ -75,6 +76,12 @@ [Don't use local iax library])],, [enable_local_iax="yes"]) +AC_ARG_ENABLE(debug-iax, + [AS_HELP_STRING([--enable-debug-iax], + [Enable debug support in local iax library])], + enable_debug_iax2=$enableval, + enable_debug_iax2="no") + AC_ARG_ENABLE(speex_preprocess, [AS_HELP_STRING([--disable-speex-preprocess], [Turn off speex preprocessing])],, @@ -378,6 +385,7 @@ AM_CONDITIONAL(USE_CODEC_GSM, test x$has_gsm = xyes && test ! x$with_gsm = xno) AM_CONDITIONAL(USE_LOCAL_GSM, test x$enable_local_gsm = xyes) AM_CONDITIONAL(USE_LOCAL_IAX2, test x$enable_local_iax2 = xyes) +AM_CONDITIONAL(USE_DEBUG_IAX2, test x$enable_debug_iax2 = xyes) AM_CONDITIONAL(USE_LOCAL_ILBC, test x$enable_local_ilbc = xyes) AM_CONDITIONAL(LINUX, test x$OSTYPE = xLINUX) AM_CONDITIONAL(WIN32, test x$OSTYPE = xWIN32) Modified: trunk/doc/src/mainpage.dox =================================================================== --- trunk/doc/src/mainpage.dox 2007-12-19 20:01:18 UTC (rev 1319) +++ trunk/doc/src/mainpage.dox 2007-12-20 05:16:37 UTC (rev 1320) @@ -1,8 +1,7 @@ /*! \mainpage <A href="http://iaxclient.sourceforge.net/">IAXClient</A> is an Open Source library to implement the IAX protocol used by -<A href="http://www.asterisk.org/">The Asterisk Software PBX</A>. -It is licensed under the the LGPL \ref License.<BR> +<A href="http://www.asterisk.org/">The Asterisk Software PBX</A> and is licensed under the the LGPL \ref License.<BR> Although asterisk supports other VOIP protocols (including SIP, and with patches, H.323), IAX's simple, lightweight nature gives it several advantages, particularly in that it can operate easily through NAT and packet firewalls, and it is easily extensible and simple to understand. Modified: trunk/lib/Makefile.am =================================================================== --- trunk/lib/Makefile.am 2007-12-19 20:01:18 UTC (rev 1319) +++ trunk/lib/Makefile.am 2007-12-20 05:16:37 UTC (rev 1320) @@ -65,7 +65,9 @@ if USE_LOCAL_IAX2 SRCS += $(SRCS_IAX2) -# AM_CFLAGS += -DDEBUG_SUPPORT +if USE_DEBUG_IAX2 +AM_CFLAGS += -DDEBUG_SUPPORT +endif USE_DEBUG_IAX2 endif USE_LOCAL_IAX2 if USE_LOCAL_ILBC Modified: trunk/lib/audio_encode.c =================================================================== --- trunk/lib/audio_encode.c 2007-12-19 20:01:18 UTC (rev 1319) +++ trunk/lib/audio_encode.c 2007-12-20 05:16:37 UTC (rev 1320) @@ -327,7 +327,7 @@ if(iax_send_voice(call->session,format, outbuf, sizeof(outbuf) - outsize, samples-insize) == -1) { - puts("Failed to send voice!"); + fprintf(stderr, "Failed to send voice! %s\n", iax_errstr); return -1; } Modified: trunk/lib/audio_portaudio.c =================================================================== --- trunk/lib/audio_portaudio.c 2007-12-19 20:01:18 UTC (rev 1319) +++ trunk/lib/audio_portaudio.c 2007-12-20 05:16:37 UTC (rev 1320) @@ -9,6 +9,7 @@ * Steve Kann <st...@st...> * Michael Van Donselaar <mv...@va...> * Shawn Lawrence <sha...@te...> + * Erik Bunce <kd...@bu...> * * This program is free software, distributed under the terms of * the GNU Lesser (Library) General Public License. Modified: trunk/lib/iaxclient.h =================================================================== --- trunk/lib/iaxclient.h 2007-12-19 20:01:18 UTC (rev 1319) +++ trunk/lib/iaxclient.h 2007-12-20 05:16:37 UTC (rev 1320) @@ -751,6 +751,17 @@ EXPORT int iaxc_register(const char * user, const char * pass, const char * host); /*! + Registers the IAXClient instance with an IAX server + \param user The username to register as + \param pass The password to register with + \param host The address of the host/peer to register with + \param refresh The registration refresh period + + \return The registration id number upon success; -1 otherwise. +*/ +EXPORT int iaxc_register_ex(const char * user, const char * pass, const char * host, int refresh); + +/*! Respond to incoming call \a callNo as busy. */ EXPORT void iaxc_send_busy_on_incoming_call(int callNo); @@ -1357,6 +1368,12 @@ */ EXPORT int iaxc_push_video(void *data, unsigned int size, int fragment); +/*! + Sets the IAX debug set to \a enable. + \param enable If non-zero enable iax protocol debugging +*/ +EXPORT int iaxc_debug_iax_set(int enable); + #ifdef __cplusplus } #endif Modified: trunk/lib/iaxclient_lib.c =================================================================== --- trunk/lib/iaxclient_lib.c 2007-12-19 20:01:18 UTC (rev 1319) +++ trunk/lib/iaxclient_lib.c 2007-12-20 05:16:37 UTC (rev 1320) @@ -13,6 +13,7 @@ * Mihai Balea <mihai AT hates DOT ms> * Peter Grayson <jpg...@gm...> * Bill Cholewka <bc...@gm...> + * Erik Bunce <kd...@bu...> * * This program is free software, distributed under the terms of * the GNU Lesser (Library) General Public License. @@ -744,9 +745,9 @@ for ( cur = registrations; cur != NULL; cur = cur->next ) { - // If there is less than one second before the registration is about + // If there is less than three seconds before the registration is about // to expire, renew it. - if ( iaxci_usecdiff(&now, &cur->last) > cur->refresh - 1 * 1000 *1000 ) + if ( iaxci_usecdiff(&now, &cur->last) > (cur->refresh - 3) * 1000 *1000 ) { if ( cur->session != NULL ) { @@ -758,7 +759,7 @@ iaxci_usermsg(IAXC_ERROR, "Can't make new registration session"); return; } - iax_register(cur->session, cur->host, cur->user, cur->pass, 60); + iax_register(cur->session, cur->host, cur->user, cur->pass, cur->refresh); cur->last = now; } } @@ -1240,6 +1241,11 @@ EXPORT int iaxc_register(const char * user, const char * pass, const char * host) { + iaxc_register_ex(user, pass, host, 60); +} + +EXPORT int iaxc_register_ex(const char * user, const char * pass, const char * host, int refresh) +{ struct iaxc_registration *newreg; newreg = (struct iaxc_registration *)malloc(sizeof (struct iaxc_registration)); @@ -1259,14 +1265,14 @@ } gettimeofday(&newreg->last,NULL); - newreg->refresh = 60*1000*1000; /* 60 seconds, in usecs */ + newreg->refresh = refresh; strncpy(newreg->host, host, 256); strncpy(newreg->user, user, 256); strncpy(newreg->pass, pass, 256); - /* send out the initial registration timeout 300 seconds */ - iax_register(newreg->session, host, user, pass, 300); + /* send out the initial registration with refresh seconds */ + iax_register(newreg->session, host, user, pass, refresh); /* add it to the list; */ newreg->id = ++next_registration_id; @@ -1961,3 +1967,13 @@ return 0; } +int iaxc_debug_iax_set(int enable) +{ +#ifdef DEBUG_SUPPORT + if (enable) + iax_enable_debug(); + else + iax_disable_debug(); +#endif +} + Modified: trunk/lib/libiax2/src/iax-client.h =================================================================== --- trunk/lib/libiax2/src/iax-client.h 2007-12-19 20:01:18 UTC (rev 1319) +++ trunk/lib/libiax2/src/iax-client.h 2007-12-20 05:16:37 UTC (rev 1320) @@ -245,6 +245,10 @@ /* Fine tune jitterbuffer */ extern void iax_set_jb_target_extra( long value ); +/* Portable 'decent' random number generation */ +void iax_seed_random(); +int iax_random(); + #if defined(__cplusplus) } #endif Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2007-12-19 20:01:18 UTC (rev 1319) +++ trunk/lib/libiax2/src/iax.c 2007-12-20 05:16:37 UTC (rev 1320) @@ -276,7 +276,30 @@ s->sendto = ptr; } +void iax_seed_random() +{ +#if defined(HAVE_SRANDOMDEV) + srandomdev(); +#elif defined(HAVE_SRANDOM) + srandom((unsigned int)time(0)); +#elif define(HAVE_SRAND48) + srand48((long int)time(0)); +#else + srand((unsigned int)time(0)); +#endif +} +int iax_random() +{ +#if defined(HAVE_RANDOM) + return (int)random(); +#elif defined(HAVE_LRAND48) + return (int)lrand48(); +#else + return rand(); +#endif +} + /* This is a little strange, but to debug you call DEBU(G "Hello World!\n"); */ #if defined(WIN32) || defined(_WIN32_WCE) #define G __FILE__, __LINE__, @@ -286,7 +309,7 @@ #define DEBU __debug #if defined(WIN32) || defined(_WIN32_WCE) -static int __debug(char *file, int lineno, char *fmt, ...) +static int __debug(const char *file, int lineno, const char *fmt, ...) { va_list args; va_start(args, fmt); @@ -298,7 +321,7 @@ return 0; } #else -static int __debug(char *file, int lineno, char *func, char *fmt, ...) +static int __debug(const char *file, int lineno, const char *func, const char *fmt, ...) { va_list args; va_start(args, fmt); @@ -341,15 +364,12 @@ static struct iax_sched *schedq = NULL; static struct iax_session *sessions = NULL; static int callnums = 1; -static int transfer_id = 1; /* for attended transfer */ - unsigned int iax_session_get_capability(struct iax_session *s) { return s->capability; } - static int inaddrcmp(struct sockaddr_in *sin1, struct sockaddr_in *sin2) { return (sin1->sin_addr.s_addr != sin2->sin_addr.s_addr) || (sin1->sin_port != sin2->sin_port); @@ -831,10 +851,9 @@ if (ntohs(h->scallno) & IAX_FLAG_FULL) iax_showframe(f, NULL, 0, f->transfer ? - &(f->session->transfer) : - &(f->session->peeraddr), - f->datalen - - sizeof(struct ast_iax2_full_hdr)); + &(f->session->transfer) : + &(f->session->peeraddr), + f->datalen - sizeof(struct ast_iax2_full_hdr)); } #endif /* Send the frame raw */ @@ -1005,9 +1024,8 @@ DEBU(G "Started on port %d\n", portno); } - srand((unsigned int)time(0)); - callnums = rand() % 32767 + 1; - transfer_id = rand() % 32767 + 1; + iax_seed_random(); + callnums = 1 + (int)(32767.0 * (iax_random() / (RAND_MAX + 1.0))); return portno; } @@ -1400,8 +1418,11 @@ struct iax_session *s1 = new_session; memset(&ied0, 0, sizeof(ied0)); + memset(&ied1, 0, sizeof(ied1)); + int transfer_id = 1 + (int)(32767.0 * (iax_random() / (RAND_MAX + 1.0))); + /* reversed setup */ iax_ie_append_addr(&ied0, IAX_IE_APPARENT_ADDR, &s1->peeraddr); iax_ie_append_short(&ied0, IAX_IE_CALLNO, s1->peercallno); @@ -1425,12 +1446,14 @@ s0->transferpeer = s1->callno; s1->transferpeer = s0->callno; +#ifdef DEBUG_SUPPORT + if (debug) { + DEBU(G "iax_setup_transfer(%d, %d) transfer_id=%d\n", s0->callno, s1->callno, transfer_id); + DEBU(G "\torg: callno=%d peercallno=%d peeraddr=%s peerport=%d\n", s0->callno, s0->peercallno, inet_ntoa(s0->peeraddr.sin_addr), ntohs(s0->peeraddr.sin_port)); + DEBU(G "\tnew: callno=%d peercallno=%d peeraddr=%s peerport=%d\n", s1->callno, s1->peercallno, inet_ntoa(s1->peeraddr.sin_addr), ntohs(s1->peeraddr.sin_port)); + } +#endif - transfer_id++; - - if (transfer_id > 32767) - transfer_id = 1; - res = send_command(s0, AST_FRAME_IAX, IAX_COMMAND_TXREQ, 0, ied0.buf, ied0.pos, -1); if (res < 0) { return -1; Modified: trunk/lib/video.c =================================================================== --- trunk/lib/video.c 2007-12-19 20:01:18 UTC (rev 1319) +++ trunk/lib/video.c 2007-12-20 05:16:37 UTC (rev 1320) @@ -9,6 +9,7 @@ * Steve Kann <st...@st...> * Mihai Balea <mihai AT hates DOT ms> * Peter Grayson <jpg...@gm...> + * Erik Bunce <kd...@bu...> * * This program is free software, distributed under the terms of * the GNU Lesser (Library) General Public License. @@ -675,8 +676,6 @@ if ( call->vformat == 0 ) { - fprintf(stderr, "video format not set for call %d\n", - selected_call); goto callback_failed; } @@ -1830,8 +1829,8 @@ ) == -1 ) { - fprintf(stderr, "Failed to send a slice, call %d, size %d\n", - selected_call, slice_set.size[i]); + fprintf(stderr, "Failed to send a slice, call %d, size %d: %s\n", + selected_call, slice_set.size[i], iax_errstr); return -1; } @@ -1842,8 +1841,8 @@ size, 0, 0) == -1 ) { fprintf(stderr, "iaxc_push_video: failed to send " - "video frame of size %d on call %d\n", - size, selected_call); + "video frame of size %d on call %d: %s\n", + size, selected_call, iax_errstr); return -1; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <do...@us...> - 2007-12-19 20:01:14
|
Revision: 1319 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1319&view=rev Author: dohpaz Date: 2007-12-19 12:01:18 -0800 (Wed, 19 Dec 2007) Log Message: ----------- Better conditionalize some debug output. Modified Paths: -------------- branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c Modified: branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c =================================================================== --- branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c 2007-12-19 19:51:40 UTC (rev 1318) +++ branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c 2007-12-19 20:01:18 UTC (rev 1319) @@ -1446,11 +1446,14 @@ s0->transferpeer = s1->callno; s1->transferpeer = s0->callno; +#ifdef DEBUG_SUPPORT + if (debug) { + DEBU(G "iax_setup_transfer(%d, %d) transfer_id=%d\n", s0->callno, s1->callno, transfer_id); + DEBU(G "\torg: callno=%d peercallno=%d peeraddr=%s peerport=%d\n", s0->callno, s0->peercallno, inet_ntoa(s0->peeraddr.sin_addr), ntohs(s0->peeraddr.sin_port)); + DEBU(G "\tnew: callno=%d peercallno=%d peeraddr=%s peerport=%d\n", s1->callno, s1->peercallno, inet_ntoa(s1->peeraddr.sin_addr), ntohs(s1->peeraddr.sin_port)); + } +#endif - DEBU(G "iax_setup_transfer(%d, %d) transfer_id=%d\n", s0->callno, s1->callno, transfer_id); - DEBU(G "\torg: callno=%d peercallno=%d peeraddr=%s peerport=%d\n", s0->callno, s0->peercallno, inet_ntoa(s0->peeraddr.sin_addr), ntohs(s0->peeraddr.sin_port)); - DEBU(G "\tnew: callno=%d peercallno=%d peeraddr=%s peerport=%d\n", s1->callno, s1->peercallno, inet_ntoa(s1->peeraddr.sin_addr), ntohs(s1->peeraddr.sin_port)); - res = send_command(s0, AST_FRAME_IAX, IAX_COMMAND_TXREQ, 0, ied0.buf, ied0.pos, -1); if (res < 0) { return -1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <do...@us...> - 2007-12-19 19:51:35
|
Revision: 1318 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1318&view=rev Author: dohpaz Date: 2007-12-19 11:51:40 -0800 (Wed, 19 Dec 2007) Log Message: ----------- Merge up to trunk of r1317. Modified Paths: -------------- branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c branches/team/elbunce/iaxclient/lib/libiax2/src/iax2-parser.c Modified: branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c =================================================================== --- branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c 2007-12-19 15:55:20 UTC (rev 1317) +++ branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c 2007-12-19 19:51:40 UTC (rev 1318) @@ -30,7 +30,6 @@ #include <winsock.h> #include <time.h> #include <stdlib.h> -#include <malloc.h> #include <stdarg.h> #include <stdio.h> #include <limits.h> @@ -76,9 +75,9 @@ #include <arpa/inet.h> #include <time.h> -#ifndef MACOSX +#if !defined(MACOSX) && !defined(__OpenBSD__) #include <malloc.h> -#ifndef SOLARIS +#if !defined(SOLARIS) #include <error.h> #endif #endif @@ -97,7 +96,7 @@ #ifdef MACOSX #define IAX_SOCKOPTS MSG_DONTWAIT #else -#ifdef SOLARIS +#if defined(SOLARIS) || defined(__OpenBSD__) #define IAX_SOCKOPTS MSG_DONTWAIT #else /* Linux and others */ #define IAX_SOCKOPTS MSG_DONTWAIT | MSG_NOSIGNAL @@ -128,6 +127,9 @@ /* Video frames bypass jitterbuffer */ static int video_bypass_jitterbuffer = 0; +/* To use or not to use the jitterbuffer */ +static int iax_use_jitterbuffer = 1; + /* UDP Socket (file descriptor) */ static int netfd = -1; @@ -249,7 +251,55 @@ debug = 0; } +void iax_enable_jitterbuffer(void) +{ + iax_use_jitterbuffer = 1; +} +void iax_disable_jitterbuffer(void) +{ + iax_use_jitterbuffer = 0; +} + +void iax_set_private(struct iax_session *s, void *ptr) +{ + s->pvt = ptr; +} + +void *iax_get_private(struct iax_session *s) +{ + return s->pvt; +} + +void iax_set_sendto(struct iax_session *s, iax_sendto_t ptr) +{ + s->sendto = ptr; +} + +void iax_seed_random() +{ +#if defined(HAVE_SRANDOMDEV) + srandomdev(); +#elif defined(HAVE_SRANDOM) + srandom((unsigned int)time(0)); +#elif define(HAVE_SRAND48) + srand48((long int)time(0)); +#else + srand((unsigned int)time(0)); +#endif +} + +int iax_random() +{ +#if defined(HAVE_RANDOM) + return (int)random(); +#elif defined(HAVE_LRAND48) + return (int)lrand48(); +#else + return rand(); +#endif +} + /* This is a little strange, but to debug you call DEBU(G "Hello World!\n"); */ #if defined(WIN32) || defined(_WIN32_WCE) #define G __FILE__, __LINE__, @@ -315,52 +365,11 @@ static struct iax_session *sessions = NULL; static int callnums = 1; -void iax_seed_random() -{ -#if defined(HAVE_SRANDOMDEV) - srandomdev(); -#elif defined(HAVE_SRANDOM) - srandom((unsigned int)time(0)); -#elif define(HAVE_SRAND48) - srand48((long int)time(0)); -#else - srand((unsigned int)time(0)); -#endif -} - -int iax_random() -{ -#if defined(HAVE_RANDOM) - return (int)random(); -#elif defined(HAVE_LRAND48) - return (int)lrand48(); -#else - return rand(); -#endif -} - -void iax_set_private(struct iax_session *s, void *ptr) -{ - s->pvt = ptr; -} - -void *iax_get_private(struct iax_session *s) -{ - return s->pvt; -} - -void iax_set_sendto(struct iax_session *s, iax_sendto_t ptr) -{ - s->sendto = ptr; -} - - unsigned int iax_session_get_capability(struct iax_session *s) { return s->capability; } - static int inaddrcmp(struct sockaddr_in *sin1, struct sockaddr_in *sin2) { return (sin1->sin_addr.s_addr != sin2->sin_addr.s_addr) || (sin1->sin_port != sin2->sin_port); @@ -848,8 +857,9 @@ } #endif /* Send the frame raw */ - res = f->session->sendto(netfd, (const char *) f->data, f->datalen, IAX_SOCKOPTS, - f->transfer ? (struct sockaddr *)&(f->session->transfer) : + res = f->session->sendto(netfd, (const char *) f->data, f->datalen, + IAX_SOCKOPTS, f->transfer ? + (struct sockaddr *)&(f->session->transfer) : (struct sockaddr *)&(f->session->peeraddr), sizeof(f->session->peeraddr)); return res; @@ -1026,7 +1036,7 @@ { int x; for (x=0;x<16;x++) - out += sprintf(out, "%2.2x", (int)in[x]); + sprintf(out + (x << 1), "%2.2x", (int)in[x]); } static unsigned char compress_subclass(int subclass) @@ -1063,7 +1073,7 @@ struct iax_frame *fr; int res; int sendmini=0; - unsigned int lastsent; + unsigned int nextpred; unsigned int fts; if (!pvt) @@ -1072,14 +1082,15 @@ return -1; } - /* this must come before the next call to calc_timestamp() since - calc_timestamp() will change lastsent to the returned value */ - lastsent = pvt->lastsent; - /* Calculate actual timestamp */ fts = calc_timestamp(pvt, ts, f); - if (((fts & 0xFFFF0000L) == (lastsent & 0xFFFF0000L)) + /* If the next predicted VOICE timestamp will overflow the 16-bit + portion of the timestamp then we send a full VOICE frame to + keep the 32-bit portion of the timestamp synchronized. */ + nextpred = pvt->nextpred; + + if (((fts & 0xFFFF0000L) == (nextpred & 0xFFFF0000L)) /* High two bits are the same on timestamp, or sending on a trunk */ && (f->frametype == AST_FRAME_VOICE) /* is a voice frame */ && @@ -1095,7 +1106,7 @@ /* Bitmask taken from chan_iax2.c... I must ask Mark Spencer for this? I think not... */ if ( f->frametype == AST_FRAME_VIDEO ) { - if (((fts & 0xFFFF8000L) == (lastsent & 0xFFFF8000L)) + if (((fts & 0xFFFF8000L) == (nextpred & 0xFFFF8000L)) /* High two bits are the same on timestamp, or sending on a trunk */ && ((f->subclass & ~0x01) == pvt->svideoformat) /* is the same type */ ) @@ -1613,6 +1624,7 @@ */ case IAX_EVENT_REJECT: case IAX_EVENT_HANGUP: + case IAX_EVENT_REGACK: /* Destroy this session -- it's no longer valid */ destroy_session(event->session); return event; @@ -1942,7 +1954,7 @@ convert_reply(realreply, (unsigned char *) reply); iax_ie_append_str(&ied, IAX_IE_MD5_RESULT, realreply); } else { - iax_ie_append_str(&ied, IAX_IE_MD5_RESULT, password); + iax_ie_append_str(&ied, IAX_IE_PASSWORD, password); } return send_command(session, AST_FRAME_IAX, IAX_COMMAND_AUTHREP, 0, ied.buf, ied.pos, -1); } @@ -1967,7 +1979,7 @@ convert_reply(realreply, (unsigned char *) reply); iax_ie_append_str(&ied, IAX_IE_MD5_RESULT, realreply); } else { - iax_ie_append_str(&ied, IAX_IE_MD5_RESULT, password); + iax_ie_append_str(&ied, IAX_IE_PASSWORD, password); } return send_command(session, AST_FRAME_IAX, IAX_COMMAND_REGREQ, 0, ied.buf, ied.pos, -1); } @@ -2368,7 +2380,9 @@ /* insert into jitterbuffer */ /* TODO: Perhaps we could act immediately if it's not droppable and late */ - if ( e->etype == IAX_EVENT_VIDEO && video_bypass_jitterbuffer ) + if ( !iax_use_jitterbuffer || + (e->etype == IAX_EVENT_VIDEO && + video_bypass_jitterbuffer) ) { iax_sched_add(e, NULL, NULL, NULL, 0); return NULL; @@ -2508,7 +2522,7 @@ /* don't run last_ts backwards; i.e. for retransmits and the like */ if (ts > session->last_ts && - (fh->type == AST_FRAME_IAX && + ((fh->type == AST_FRAME_IAX || fh->type == AST_FRAME_VOICE) && subclass != IAX_COMMAND_ACK && subclass != IAX_COMMAND_PONG && subclass != IAX_COMMAND_LAGRP)) @@ -2633,6 +2647,7 @@ */ e->etype = -1; e->session = session; + e->ts = ts; switch(fh->type) { case AST_FRAME_DTMF: e->etype = IAX_EVENT_DTMF; @@ -2645,7 +2660,6 @@ case AST_FRAME_VOICE: e->etype = IAX_EVENT_VOICE; e->subclass = subclass; - e->ts = ts; session->voiceformat = subclass; if (datalen) { memcpy(e->data, fh->iedata, datalen); @@ -2726,17 +2740,14 @@ case IAX_COMMAND_LAGRQ: /* Pass this along for later handling */ e->etype = IAX_EVENT_LAGRQ; - e->ts = ts; e = schedule_delivery(e, ts, updatehistory); break; case IAX_COMMAND_POKE: e->etype = IAX_EVENT_POKE; - e->ts = ts; break; case IAX_COMMAND_PING: /* PINGS and PONGS don't get scheduled; */ e->etype = IAX_EVENT_PING; - e->ts = ts; break; case IAX_COMMAND_PONG: e->etype = IAX_EVENT_PONG; @@ -2905,7 +2916,6 @@ case AST_FRAME_VIDEO: e->etype = IAX_EVENT_VIDEO; e->subclass = subclass; - e->ts = ts; session->videoformat = e->subclass; memcpy(e->data, fh->iedata, datalen); e->datalen = datalen; @@ -3023,7 +3033,8 @@ e->subclass = session->voiceformat; e->datalen = datalen; memcpy(e->data, mh->data, datalen); - e->ts = (session->last_ts & 0xFFFF0000) | ntohs(mh->ts); + e->ts = (session->last_ts & 0xFFFF0000L) | (ntohs(mh->ts) & 0xFFFF); + e->ts = unwrap_timestamp(e->ts, session->last_ts); return schedule_delivery(e, e->ts, 1); } Modified: branches/team/elbunce/iaxclient/lib/libiax2/src/iax2-parser.c =================================================================== --- branches/team/elbunce/iaxclient/lib/libiax2/src/iax2-parser.c 2007-12-19 15:55:20 UTC (rev 1317) +++ branches/team/elbunce/iaxclient/lib/libiax2/src/iax2-parser.c 2007-12-19 19:51:40 UTC (rev 1318) @@ -159,7 +159,6 @@ { IAX_IE_CAPABILITY, "CAPABILITY", dump_int }, { IAX_IE_FORMAT, "FORMAT", dump_int }, { IAX_IE_LANGUAGE, "LANGUAGE", dump_string }, - { IAX_IE_CODEC_PREFS, "CODEC_PREFS", dump_string }, { IAX_IE_VERSION, "VERSION", dump_short }, { IAX_IE_ADSICPE, "ADSICPE", dump_short }, { IAX_IE_DNID, "DNID", dump_string }, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpg...@us...> - 2007-12-19 15:55:17
|
Revision: 1317 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1317&view=rev Author: jpgrayson Date: 2007-12-19 07:55:20 -0800 (Wed, 19 Dec 2007) Log Message: ----------- Apply patch from Lee Howard to be able to disable debugging when it is compiled in. I also touched up the whitespace for these touches. Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2007-12-19 15:42:24 UTC (rev 1316) +++ trunk/lib/libiax2/src/iax.c 2007-12-19 15:55:20 UTC (rev 1317) @@ -826,17 +826,21 @@ { int res; #ifdef DEBUG_SUPPORT - struct ast_iax2_full_hdr *h = (struct ast_iax2_full_hdr *)(f->data); + if (debug) { + struct ast_iax2_full_hdr *h = (struct ast_iax2_full_hdr *)f->data; - if (ntohs(h->scallno) & IAX_FLAG_FULL) - iax_showframe(f, NULL, 0, f->transfer ? - &(f->session->transfer) : - &(f->session->peeraddr), - f->datalen - sizeof(struct ast_iax2_full_hdr)); + if (ntohs(h->scallno) & IAX_FLAG_FULL) + iax_showframe(f, NULL, 0, f->transfer ? + &(f->session->transfer) : + &(f->session->peeraddr), + f->datalen - + sizeof(struct ast_iax2_full_hdr)); + } #endif /* Send the frame raw */ - res = f->session->sendto(netfd, (const char *) f->data, f->datalen, IAX_SOCKOPTS, - f->transfer ? (struct sockaddr *)&(f->session->transfer) : + res = f->session->sendto(netfd, (const char *) f->data, f->datalen, + IAX_SOCKOPTS, f->transfer ? + (struct sockaddr *)&(f->session->transfer) : (struct sockaddr *)&(f->session->peeraddr), sizeof(f->session->peeraddr)); return res; @@ -2507,7 +2511,8 @@ } #ifdef DEBUG_SUPPORT - iax_showframe(NULL, fh, 1, sin, datalen); + if (debug) + iax_showframe(NULL, fh, 1, sin, datalen); #endif /* Get things going with it, timestamp wise, if we This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |