Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS上的webRTC:Can';无法发送SDP应答,RTPeerConnection.setRemoteDescription()失败_Ios_Webrtc_Sdp_Libjingle - Fatal编程技术网

iOS上的webRTC:Can';无法发送SDP应答,RTPeerConnection.setRemoteDescription()失败

iOS上的webRTC:Can';无法发送SDP应答,RTPeerConnection.setRemoteDescription()失败,ios,webrtc,sdp,libjingle,Ios,Webrtc,Sdp,Libjingle,我正在使用安装有cocoapods的libjingle\u peerconnection。当我通过信令服务器从呼叫方接收SDP提供时,我试图将其设置为远程描述,这将触发RTCSessionDescriptionDelegatepeerConnection:DidSetSessionDescriptionWither: 有误: Error Domain=RTCSDPError code=-1“(null)”UserInfo={Error=无法设置远程应答sdp:在错误状态下调用:state_INI

我正在使用安装有cocoapods的
libjingle\u peerconnection
。当我通过信令服务器从呼叫方接收SDP提供时,我试图将其设置为远程描述,这将触发
RTCSessionDescriptionDelegate
peerConnection:DidSetSessionDescriptionWither:
有误:

Error Domain=RTCSDPError code=-1“(null)”UserInfo={Error=无法设置远程应答sdp:在错误状态下调用:state_INIT}

我的代码是:

- (void)transportChanell:(TransportChannel *)channel didReceivedSignalWithSessionDescription:(NSString *)sessionDescription withType:(NSString *)type {
    RTCSessionDescription *remoteDesc = [[RTCSessionDescription alloc] initWithType:@"answer" sdp:sessionDescription];
    [_peerConnection setRemoteDescriptionWithDelegate:self sessionDescription:remoteDesc];
}
我已经对这个问题进行了很多调查,并在webRTC源代码中找到了这个地方,正如我所想,这个错误来自
BadRemoteSdp(type,badstateErrorMsg(state()),err_desc)
WebRtcSession
的所有可能状态为:

    STATE_INIT = 0,
    STATE_SENTOFFER,         // Sent offer, waiting for answer.
    STATE_RECEIVEDOFFER,     // Received an offer. Need to send answer.
    STATE_SENTPRANSWER,      // Sent provisional answer. Need to send answer.
    STATE_RECEIVEDPRANSWER,  // Received provisional answer, waiting for answer.
    STATE_INPROGRESS,        // Offer/answer exchange completed.
    STATE_CLOSED,            // Close() was called.

请问,有什么建议,我可以错过来电方或被叫方

根据错误消息,该报价似乎被标记为“应答”。它失败是因为它希望您处于“提供”状态


如果您已经创建了一个offer并将其发送给另一方,那么您可能忘记了首先调用setLocalDescription。如果您没有发送失败客户的报价,则应将另一方更改为发送报价,而不是答复。

如果这有助于来自谷歌的任何人:

我自己也遇到了这个问题,结果我匆忙地从我写的报价人那里复制粘贴了一些代码。因此,我用类型
RTCSdpTypeAnswer
初始化
rtcsdptypedescription
,而不是
RTCSdpTypeOffer


确保在分配
RTCSessionDescription
时使用的类型正确

我希望我描述得很清楚:当我收到来电者的报价时,问题在被叫方。若我只想在被调用方端看到调用方的流,而不想将被调用方流回到调用方,我该怎么办?如果被叫方也要创建报价,或者我应该只发送已收到报价的答复(这就是我现在正在尝试的)。如果我忘记调用
setLocalDescription
,我无法让SDP报价通过信令服务器发送,我成功地做到了这一点。但正如我已经说过的,我只在呼叫者端生成offer,并希望从被呼叫者那里得到答案,但失败了。我是不是做错了,被叫方也应该先给出报价?