【发布时间】:2016-10-17 22:06:48
【问题描述】:
我正在使用与 cocoapods 一起安装的 libjingle_peerconnection。当我从呼叫者通过信令服务器收到 SDP 报价时,我试图将其设置为远程描述,这会触发 RTCSessionDescriptionDelegate peerConnection:didSetSessionDescriptionWithError:
有错误:
Error Domain=RTCSDPError Code=-1 "(null)" UserInfo={error=Failed to set remote answer sdp: Called in wrong state: 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, BadStateErrMsg(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.
任何建议,拜托,我在呼叫者或被呼叫者方面错过了什么?
【问题讨论】: