On some devices (specially Samsung) I have found the following error while establishing a P2P connection:
Error processing ICE candidate- Failed to set remote offer sdp: The order of m-lines in subsequent offer doesn't match order from previous offer/answer
If I establish the connection for the first time it works perfectly but if I try it a second time it fails until I wait some time, even if I force the P2P connection to close. This does not happen with Chrome for Android or every device.
My code before setting an Ice candidate:
var candidate = new RTCIceCandidate({
sdpMLineIndex: evt.sdpMLineIndex,
sdpMid : evt.sdpMid,
candidate : evt.candidate
});
peerConn.addIceCandidate(candidate, onSuccess, onFailure);