diff --git a/mediastreamer2/src/mscommon.c b/mediastreamer2/src/mscommon.c index ce9bfdd..86093ee 100644 --- a/mediastreamer2/src/mscommon.c +++ b/mediastreamer2/src/mscommon.c @@ -607,10 +607,16 @@ static void ms_android_log_handler(OrtpLogLevel lev, const char *fmt, va_list ar } #endif +static unsigned int init_count = 0; + void ms_init(){ int i; MSSndCardManager *cm; + init_count += 1; + if (init_count > 1) + return; + #if defined(ENABLE_NLS) bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); #endif @@ -668,6 +674,12 @@ } void ms_exit(){ + if (init_count == 0) + return; + init_count -= 1; + if (init_count > 0) + return; + ms_filter_unregister_all(); ms_snd_card_manager_destroy(); #ifdef VIDEO_ENABLED