mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-23 13:59:29 +00:00
Improved the way ready messages are sent.
This commit is contained in:
parent
959afda2cf
commit
9e559ed568
@ -293,12 +293,17 @@ public class CallActivity extends BaseActivity implements SignalExchangerCallbac
|
|||||||
|
|
||||||
if(mList.find(member) == null && member.getUserID() > AccountUtils.getID(this)) {
|
if(mList.find(member) == null && member.getUserID() > AccountUtils.getID(this)) {
|
||||||
createPeerConnection(member, false);
|
createPeerConnection(member, false);
|
||||||
mSignalExchangerClient.sendReadyMessage(member.getUserCallID());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CallPeerConnection connection = mList.find(member);
|
||||||
|
|
||||||
if(mList.find(member) != null)
|
if(connection != null) {
|
||||||
Objects.requireNonNull(mList.find(member)).setMember(member);
|
|
||||||
|
if(!connection.isConnected())
|
||||||
|
mSignalExchangerClient.sendReadyMessage(connection.getMember().getUserCallID());
|
||||||
|
|
||||||
|
Objects.requireNonNull(connection).setMember(member);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -403,9 +408,11 @@ public class CallActivity extends BaseActivity implements SignalExchangerCallbac
|
|||||||
mHangUpButton.setVisibility(View.GONE);
|
mHangUpButton.setVisibility(View.GONE);
|
||||||
mStopped = true;
|
mStopped = true;
|
||||||
|
|
||||||
mRefreshCallInformation.interrupt();
|
if(mRefreshCallInformation != null)
|
||||||
|
mRefreshCallInformation.interrupt();
|
||||||
|
|
||||||
mSignalExchangerClient.close();
|
if(mSignalExchangerClient != null)
|
||||||
|
mSignalExchangerClient.close();
|
||||||
|
|
||||||
for (CallPeerConnection client : mList)
|
for (CallPeerConnection client : mList)
|
||||||
disconnectFromPeer(client.getMember());
|
disconnectFromPeer(client.getMember());
|
||||||
@ -592,24 +599,28 @@ public class CallActivity extends BaseActivity implements SignalExchangerCallbac
|
|||||||
public void onIceConnected() {
|
public void onIceConnected() {
|
||||||
Log.v(TAG, "Ice connected with peer " +
|
Log.v(TAG, "Ice connected with peer " +
|
||||||
connection.getMember().getUserID());
|
connection.getMember().getUserID());
|
||||||
|
connection.setConnected(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onIceDisconnected() {
|
public void onIceDisconnected() {
|
||||||
Log.v(TAG, "Ice disconnected from peer " +
|
Log.v(TAG, "Ice disconnected from peer " +
|
||||||
connection.getMember().getUserID());
|
connection.getMember().getUserID());
|
||||||
|
connection.setConnected(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConnected() {
|
public void onConnected() {
|
||||||
Log.v(TAG, "Connected to peer " +
|
Log.v(TAG, "Connected to peer " +
|
||||||
connection.getMember().getUserID());
|
connection.getMember().getUserID());
|
||||||
|
connection.setConnected(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisconnected() {
|
public void onDisconnected() {
|
||||||
Log.v(TAG, "Disconnected from peer " +
|
Log.v(TAG, "Disconnected from peer " +
|
||||||
connection.getMember().getUserID());
|
connection.getMember().getUserID());
|
||||||
|
connection.setConnected(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -617,6 +628,7 @@ public class CallActivity extends BaseActivity implements SignalExchangerCallbac
|
|||||||
Log.v(TAG, "Connection close from user " +
|
Log.v(TAG, "Connection close from user " +
|
||||||
connection.getMember().getUserID());
|
connection.getMember().getUserID());
|
||||||
runOnUiThread(() -> disconnectFromPeer(connection.getMember()));
|
runOnUiThread(() -> disconnectFromPeer(connection.getMember()));
|
||||||
|
connection.setConnected(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -629,6 +641,7 @@ public class CallActivity extends BaseActivity implements SignalExchangerCallbac
|
|||||||
public void onPeerConnectionError(String description) {
|
public void onPeerConnectionError(String description) {
|
||||||
Log.e(TAG, "Peer connection error with " +
|
Log.e(TAG, "Peer connection error with " +
|
||||||
connection.getMember().getUserID() + " " + description);
|
connection.getMember().getUserID() + " " + description);
|
||||||
|
connection.setConnected(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ public class CallPeerConnection {
|
|||||||
//Private fields
|
//Private fields
|
||||||
private CallMember member;
|
private CallMember member;
|
||||||
private PeerConnectionClient peerConnectionClient;
|
private PeerConnectionClient peerConnectionClient;
|
||||||
|
private boolean connected = false;
|
||||||
private VideoSink localProxyVideoSink;
|
private VideoSink localProxyVideoSink;
|
||||||
private VideoSink remoteProxyRenderer;
|
private VideoSink remoteProxyRenderer;
|
||||||
private ArrayList<VideoSink> remoteSinks = new ArrayList<>();
|
private ArrayList<VideoSink> remoteSinks = new ArrayList<>();
|
||||||
@ -45,6 +46,14 @@ public class CallPeerConnection {
|
|||||||
this.peerConnectionClient = peerConnectionClient;
|
this.peerConnectionClient = peerConnectionClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isConnected() {
|
||||||
|
return connected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConnected(boolean connected) {
|
||||||
|
this.connected = connected;
|
||||||
|
}
|
||||||
|
|
||||||
public ArrayList<VideoSink> getRemoteSinks() {
|
public ArrayList<VideoSink> getRemoteSinks() {
|
||||||
return remoteSinks;
|
return remoteSinks;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user