mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-21 12:35:30 +03:00
Handle offers to renegotiate an already established connection
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>
This commit is contained in:
parent
c1f77b13c1
commit
1b5be43cea
1 changed files with 3 additions and 1 deletions
|
@ -575,7 +575,9 @@ public class PeerConnectionWrapper {
|
||||||
@Override
|
@Override
|
||||||
public void onSetSuccess() {
|
public void onSetSuccess() {
|
||||||
if (peerConnection != null) {
|
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()) {
|
if (shouldNotReceiveVideo()) {
|
||||||
for (RtpTransceiver t : peerConnection.getTransceivers()) {
|
for (RtpTransceiver t : peerConnection.getTransceivers()) {
|
||||||
|
|
Loading…
Reference in a new issue