--- oRTP/configure.ac +++ oRTP/configure.ac @@ -135,6 +135,11 @@ else AC_SUBST(PTHREAD_LIBS) AC_SUBST(PTHREAD_LDFLAGS) fi +AC_ARG_WITH(thread-stack-size, + AC_HELP_STRING([--with-thread-stack-size=SIZE-IN-BYTES],[Set thread stack size [[default=os-default]]]), + [thread_stack_size=$withval], [thread_stack_size=0]) +AC_DEFINE_UNQUOTED(ORTP_DEFAULT_THREAD_STACK_SIZE, $thread_stack_size, [Default thread stack size (0 = let operating system decide)]) + dnl check for libsrtp support (secure rtp) AC_ARG_WITH( srtp, --- oRTP/include/ortp/port.h +++ oRTP/include/ortp/port.h @@ -77,7 +77,12 @@ typedef pthread_cond_t ortp_cond_t; int __ortp_thread_join(ortp_thread_t thread, void **ptr); +#if ORTP_DEFAULT_THREAD_STACK_SIZE +int __ortp_thread_create(pthread_t *thread, pthread_attr_t *attr, void * (*routine)(void*), void *arg); +#define ortp_thread_create __ortp_thread_create +#else #define ortp_thread_create pthread_create +#endif #define ortp_thread_join __ortp_thread_join #define ortp_thread_exit pthread_exit #define ortp_mutex_init pthread_mutex_init --- oRTP/src/port.c +++ oRTP/src/port.c @@ -19,6 +19,11 @@ */ +#if defined(WIN32) || defined(_WIN32_WCE) +#include "ortp-config-win32.h" +#else +#include "ortp-config.h" +#endif #include "ortp/port.h" #include "ortp/ortp.h" #include "utils.h" @@ -124,6 +129,17 @@ int __ortp_thread_join(ortp_thread_t thr } return err; } + +#if ORTP_DEFAULT_THREAD_STACK_SIZE +int __ortp_thread_create(pthread_t *thread, pthread_attr_t *attr, void * (*routine)(void*), void *arg){ + pthread_attr_t my_attr; + pthread_attr_init(&my_attr); + if (attr) + my_attr = *attr; + pthread_attr_setstacksize(&my_attr, ORTP_DEFAULT_THREAD_STACK_SIZE); + return pthread_create(thread, &my_attr, routine, arg); +} +#endif #endif #if defined(_WIN32) || defined(_WIN32_WCE)