Closed streunerlein closed 1 year ago
createAnswer
should always create an answer, no?
Yeah, definitely. It might be bugs in our code.
@streunerlein I checked our code, surely I found the code which might occurs the issue. We add the issue into our backlog.
memo: WRS-387
@karasusan Thank you very much.
October is a bit far away, I am thinking about a workaround. Do you have some more information on when this happens? Because I think the following naive solution is pretty much not going to work:
RTCSessionDescription desc = null;
while (desc == null || desc.type == RTCSdpType.Offer) {
var op3 = pc.CreateAnswer();
yield return op3;
desc = op3.desc;
}
@streunerlein I guess this issues might occur when running process of CreateOffer/CreateAnswer in parallel in native code.
@karasusan Ok, thank you. Then indeed the naive solution might work. I got better results using this code:
while (true) {
var op3 = pc.CreateAnswer();
yield return op3;
if (!op3.IsError)
{
if (op3.Desc.type != RTCSdpType.Answer)
{
Debug.Log($"Received {op3.Desc.type} instead of answer, retrying...");
continue;
}
yield return OnCreateAnswerSuccess(pc, op3.Desc);
break;
}
else
{
break;
}
}
Update: Of course, we've also done things wrong on our side creating these kind of race conditions. By correctly implementing perfect negotiation we haven't seen this phenomenon anymore.
Package version
2.4.0-exp.9
Environment
Steps To Reproduce
createOffer
), set it as local description (setLocalDescription
) and send it to other ComputersetRemoteDescription
and thencreateAnswer
on the connection. Try tosetLocalDescription
on this answer.Current Behavior
Sometimes (here it's 6 out of 10 times), the last call
setLocalDescription
fails withwrong state: have-remote-offer
. Debugging it shows that thecreateAnswer
in that situation created an offer instead of an answer.Expected Behavior
createAnswer
should always create an answer, no?Anything else?
Can someone explain any circumstances that would make
createAnswer
return an offer? I don't think it ever should...See screenshot appended.