gpt4 book ai didi

ios - iOS 上的 webRTC : Can't send SDP answer, RTCPeerConnection.setRemoteDescription() 失败

转载 作者:塔克拉玛干 更新时间:2023-11-02 10:30:46 25 4
gpt4 key购买 nike

我正在使用随 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.

有什么建议吗,我在调用者或被调用者方面可能会错过什么?

最佳答案

根据错误消息,该提议似乎被标记为“答案”。它失败了,因为它希望您处于 STATE_SENTOFFER 状态。

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

关于ios - iOS 上的 webRTC : Can't send SDP answer, RTCPeerConnection.setRemoteDescription() 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37858353/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com