ios - 应用程序在使用PJSIP连续暂停和启动视频流时崩溃

原文 标签 ios swift voip pjsip

如果我在视频通话进行过程中连续暂停并开始运行,则我的应用程序将崩溃,我使用以下代码暂停和恢复视频流。

PJSIP版本:2.9

func pauseVideo(_ value: Bool) {
    guard let id = SIPAccount.account?.calls.last?.call_id else { return }
    let operation = value ? PJSUA_CALL_VID_STRM_STOP_TRANSMIT : PJSUA_CALL_VID_STRM_START_TRANSMIT

    var param = pjsua_call_vid_strm_op_param()
    pjsua_call_vid_strm_op_param_default(&param)
    param.med_idx = pjsua_call_get_vid_stream_idx(pjsua_call_id(id))
    param.dir = value ? PJMEDIA_DIR_NONE : PJMEDIA_DIR_ENCODING_DECODING

    pjsua_call_set_vid_strm(pjsua_call_id(id), operation, &param)
}


日志:

PJSIP_log: in pauseVideo
pjsua_vid.c  Call 0: set video stream, op=5
vid_conf.c  .Updating render state for port id 2 (1 sources)..
vid_conf.c  .Created render state for connection 3->2
vid_conf.c  .src#0=BGRA/352x288->352x264@0,12 dst=320x240@0,0
vid_conf.c  .Port 3 (Front Camera) transmitting to port 2 (vstenc0x12c093028)
vstenc0x12c093028  .Encoder stream resumed
PJSIP_log: video pause status 0
vstenc0x12c093028 !Forcing encoder to generate keyframe
PJSIP_log: in pauseVideo
pjsua_vid.c !Call 0: set video stream, op=6
vstenc0x12c093028  .Encoder stream paused
vid_conf.c  .Cleaned up render state for connection 3->2
vid_conf.c  .Port 3 (Front Camera) stop transmitting to port 2 (vstenc0x12c093028)
PJSIP_log: video pause status 0
silencedet.c !Re-adjust threshold (in silence)to 0
PJSIP_log: in pauseVideo
pjsua_vid.c !Call 0: set video stream, op=5
strm0x12ca03228 !Jitter buffer starts returning normal frames (after 249 empty/lost)
strm0x12ca03228  Jitter buffer empty (prefetch=0), plc invoked
strm0x12ca03228  Start talksprut..
strm0x12ca03228  Starting silence
silencedet.c  Re-adjust threshold (in silence)to 0


pjsua_vid.c !Call 0: set video stream, op=5应用程序挂起后,这3行将被多次记录

strm0x12ca03228  Start talksprut..
strm0x12ca03228  Starting silence
silencedet.c  Re-adjust threshold (in silence)to 0

最佳答案

使用pjsua_schedule_timer2()解决了此问题

关于ios - 应用程序在使用PJSIP连续暂停和启动视频流时崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58074156/

相关文章:

iphone - 在iPhone游戏中隐藏图像的一部分

ios - 更新Firebase会删除现有数据

ios - NSDataDetector类型NSTextCheckingTypeTransitInformation-它可用于iOS吗?

swift - Swift-更新上一张照片中的UIButton图像

ios - CocoaPods未将Firebase SDK更新到版本4.0.0

ios - 缺少音频/视频SDP问题

ios - 协议(protocol) 'View' 只能用作泛型约束,因为它有 Self 或相关的类型要求

swift - 在Swift闭包中隐式使用self

linux - 在 Asterisk 中同时播放和录制

ios - 适用于VoIP通信的iOS WebRTC