无法在WebRTC上设置会话描述

Avi*_*iya 5 iphone video-streaming ios webrtc

我设置了远程描述,didSetSessionDescriptionWithError命中了回调,并显示了错误:

- (void)processAnswer:(NSString *)sdpAnswer connectionId:(NSString *)connectionId {
    //NSParameterAssert(sdpAnswer);
    NSParameterAssert(connectionId);

    NBMPeerConnection *connection = self.connectionMap[connectionId];
    __block __weak RTCPeerConnection* peerConnection = connection.peerConnection;
    RTCSessionDescription *description = [[RTCSessionDescription alloc] initWithType:RTCSdpTypeAnswer sdp:sdpAnswer];
   [connection.peerConnection setRemoteDescription:description completionHandler:^(NSError * _Nullable error) {
    [self peerConnection:peerConnection didSetSessionDescriptionWithError:error];
}];
}
Run Code Online (Sandbox Code Playgroud)

通话后收到此错误。

错误Domain = org.webrtc.RTCPeerConnection代码= -1“ SessionDescription为NULL。”

小智 3

我遇到了同样的错误,并通过在 Offer 字符串的末尾添加“\n”来修复它。希望这可以帮助。