Commit 41d13b7e authored by Simon Morlat's avatar Simon Morlat

fix ortp_init() to be able to work several times

parent 154ecfa1
......@@ -70,15 +70,16 @@ static bool_t win32_init_sockets(void){
}
#endif
static int ortp_initialized=0;
/**
* Initialize the oRTP library. You should call this function first before using
* oRTP API.
**/
void ortp_init()
{
static bool_t initialized=FALSE;
if (initialized) return;
initialized=TRUE;
if (ortp_initialized) return;
ortp_initialized++;
#ifdef WIN32
win32_init_sockets();
......@@ -131,10 +132,13 @@ void ortp_scheduler_init()
**/
void ortp_exit()
{
if (__ortp_scheduler!=NULL)
{
rtp_scheduler_destroy(__ortp_scheduler);
__ortp_scheduler=NULL;
ortp_initialized--;
if (ortp_initialized==0){
if (__ortp_scheduler!=NULL)
{
rtp_scheduler_destroy(__ortp_scheduler);
__ortp_scheduler=NULL;
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment