diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2022-02-21 09:02:41 +0300 |
---|---|---|
committer | Andy Scherzinger (Rebase PR Action) <info@andy-scherzinger.de> | 2022-10-12 01:23:33 +0300 |
commit | b8304f97da9d8e1ccd8fe172daced99c58c90845 (patch) | |
tree | 484ac0504ca4163f918c7700b2b3d220f5d6c162 | |
parent | 1d46912fb1e5b3ce418e3678b52809491ca97d5b (diff) |
Handle offers to renegotiate an already established connectionfix-handling-offers-in-already-established-connections
Once a RTCPeerConnection is established new offers can still be received
for that connection. These offers will update/renegotiate the connection
(for example, to add a video track to an audio only connection) and need
to be handled like the offers to establish the original connection (the
offer needs to be set as the remote description and a local answer needs
to be created for it, set as the local description and sent to the other
peer).
In the PeerConnectionWrapper the same SdpObserver object is called when
setting both local and remote descriptions, so the answer should be
created only when a remote description was set. Before the answer was
created if there was no local description already, so this only worked
when establishing the initial connection. Once the connection is
established new answers need to replace the current local description,
so now the creation of new answers is based on the signaling state
instead.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
-rw-r--r-- | app/src/main/java/com/nextcloud/talk/webrtc/PeerConnectionWrapper.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/src/main/java/com/nextcloud/talk/webrtc/PeerConnectionWrapper.java b/app/src/main/java/com/nextcloud/talk/webrtc/PeerConnectionWrapper.java index 64e7c0ddf..b9fc60bc0 100644 --- a/app/src/main/java/com/nextcloud/talk/webrtc/PeerConnectionWrapper.java +++ b/app/src/main/java/com/nextcloud/talk/webrtc/PeerConnectionWrapper.java @@ -465,7 +465,9 @@ public class PeerConnectionWrapper { @Override public void onSetSuccess() { if (peerConnection != null) { - if (peerConnection.getLocalDescription() == null) { + // Local provisional answers ("pranswer") are not used anywhere, + // so the "have-local-pranswer" state is not taken into account. + if (peerConnection.signalingState() == PeerConnection.SignalingState.HAVE_REMOTE_OFFER) { if (shouldNotReceiveVideo()) { for (RtpTransceiver t : peerConnection.getTransceivers()) { |