本文共 624 字,大约阅读时间需要 2 分钟。
在PJSIP的相关函数中(例如pjsua_call_make_call等),都增加了线程注册的判断,
下面以pjsua_call_make_call为例说明:
如果执行pjsua_call_make_call的线程没有在pjsip中注册过,就会assert中断,提示未知线程,需要使用pj_thread_register注册才可以
所以我们只要在线程中先执行以下注册代码,然后再执行pjsua_call_make_call就可以了
//线程注册pj_status_t pjcall_thread_register(void) { static pj_thread_desc desc; pj_thread_t* thread = 0; if (!pj_thread_is_registered()) { return pj_thread_register(NULL, desc, &thread); } return PJ_SUCCESS; } //呼叫线程DWORD WINAPI CallThreadProc( LPVOID pParam ) { pjcall_thread_register();//首先注册当前线程onCallByTwoNumber((WPARAM)pParam, NULL);//该函数内部执行了pjsua_call_make_call就不会报错了 return 0; }
转载地址:http://wcxui.baihongyu.com/