博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
在线程中调用PJSIP中的呼叫出现提示注册线程pj_thread_register的解决方法
阅读量:3985 次
发布时间:2019-05-24

本文共 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/

你可能感兴趣的文章
微信小程序开发全线记录
查看>>
Centos import torchvision 出现 No module named ‘_lzma‘
查看>>
网页设计里的浮动 属性
查看>>
Maximum Subsequence Sum
查看>>
PTA:一元多项式的加乘运算
查看>>
CCF 分蛋糕
查看>>
解决python2.7中UnicodeEncodeError
查看>>
小谈python 输出
查看>>
Django objects.all()、objects.get()与objects.filter()之间的区别介绍
查看>>
python:如何将excel文件转化成CSV格式
查看>>
Django 的Error: [Errno 10013]错误
查看>>
机器学习实战之决策树(一)
查看>>
[LeetCode By Python] 2 Add Two Number
查看>>
python 中的 if __name__=='__main__' 作用
查看>>
机器学习实战之决策树二
查看>>
[LeetCode By Python]7 Reverse Integer
查看>>
[LeetCode By Python]9. Palindrome Number
查看>>
[LeetCode By Python]13 Roman to Integer
查看>>
[leetCode By Python] 14. Longest Common Prefix
查看>>
[LeetCode By Python]107. Binary Tree Level Order Traversal II
查看>>