【发布时间】:2017-12-08 08:28:22
【问题描述】:
在我将 pjsip 从 v2.6 更新到 v2.7.1 后,我的应用程序将断言失败,函数 pjsua_set_snd_dev()。 根据 pjsip 的票 #1941:
拨出电话:
func provider(_ provider: CXProvider, perform action: CXStartCallAction) {
/* 1. We must not start call audio here, and can only do so
* once the audio session has been activated by the system
* after having its priority elevated. So, make sure that the sound
* device is closed at this point.
*/
/* 2. Provide your own implementation to configure
* the audio session here.
*/
configureAudioSession()
/* 3. Make call with pjsua_call_make_call().
* Then use pjsua's on_call_state() callback to report significant
* events in the call's lifecycle, by calling iOS API
* CXProvider.reportOutgoingCall(with: startedConnectingAt:) and
* CXProvider.reportOutgoingCall(with: ConnectedAt:)
*/
/* 4. If step (3) above returns PJ_SUCCESS, call action.fulfill(),
* otherwise call action.fail().
*/
}
处理来电:
func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) {
/* 1. We must not start call audio here, and can only do so
* once the audio session has been activated by the system
* after having its priority elevated. So, make sure that the sound
* device is closed at this point.
*/
/* 2. Provide your own implementation to configure
* the audio session here.
*/
configureAudioSession()
/* 3. Answer the call with pjsua_call_answer().
*/
/* 4. If step (3) above returns PJ_SUCCESS, call action.fulfill(),
* otherwise call action.fail().
*/
}
启动声音设备:
func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession) {
/* Start call audio media, now that the audio session has been
* activated after having its priority boosted.
*
* Call pjsua API pjsua_set_snd_dev() here.
*/
}
调用pjsua API pjsua_set_snd_dev()时,显示:
断言失败:(param && id!=PJMEDIA_AUD_INVALID_DEV),函数 pjmedia_aud_dev_default_param,文件 ../src/pjmedia/audiodev.c,行 487.
我发现v2.7.1,在pjsua_set_no_snd_dev()中有
pjsua_var.cap_dev = PJSUA_SND_NO_DEV; pjsua_var.play_dev = PJSUA_SND_NO_DEV;
但在 v2.6 中,没有这个。
PJSUA_SND_NO_DEV 和 PJMEDIA_AUD_INVALID_DEV 与 -3 相同。
这是一个错误,还是我混淆了什么?
【问题讨论】:
-
你找到解决方案了吗,@steve?
-
最后,在函数 pjsua_set_no_snd_dev() 中,我删除了“pjsua_var.cap_dev = PJSUA_SND_NO_DEV;”和“pjsua_var.play_dev = PJSUA_SND_NO_DEV;”。现在可以正常工作了。
-
是的,它有效。但我不明白为什么在 2.7.1 中添加了它