reverse: webrtc: include oldState in onConnectionChange
turns out we don’t need it and a better way is for RtpConnection to keep track of *all* states in the current generation
This commit is contained in:
parent
9c3f55bef2
commit
b6dee6da6a
|
@ -1338,8 +1338,8 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConnectionChange(final PeerConnection.PeerConnectionState oldState, final PeerConnection.PeerConnectionState newState) {
|
public void onConnectionChange(final PeerConnection.PeerConnectionState newState) {
|
||||||
Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": PeerConnectionState changed: " + oldState + "->" + newState);
|
Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": PeerConnectionState changed to" + newState);
|
||||||
this.stateHistory.add(newState);
|
this.stateHistory.add(newState);
|
||||||
if (newState == PeerConnection.PeerConnectionState.CONNECTED) {
|
if (newState == PeerConnection.PeerConnectionState.CONNECTED) {
|
||||||
this.sessionDuration.start();
|
this.sessionDuration.start();
|
||||||
|
|
|
@ -88,7 +88,6 @@ public class WebRTCWrapper {
|
||||||
private final Handler mainHandler = new Handler(Looper.getMainLooper());
|
private final Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
private VideoTrack localVideoTrack = null;
|
private VideoTrack localVideoTrack = null;
|
||||||
private VideoTrack remoteVideoTrack = null;
|
private VideoTrack remoteVideoTrack = null;
|
||||||
private PeerConnection.PeerConnectionState currentState;
|
|
||||||
private final PeerConnection.Observer peerConnectionObserver = new PeerConnection.Observer() {
|
private final PeerConnection.Observer peerConnectionObserver = new PeerConnection.Observer() {
|
||||||
@Override
|
@Override
|
||||||
public void onSignalingChange(PeerConnection.SignalingState signalingState) {
|
public void onSignalingChange(PeerConnection.SignalingState signalingState) {
|
||||||
|
@ -100,9 +99,7 @@ public class WebRTCWrapper {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConnectionChange(final PeerConnection.PeerConnectionState newState) {
|
public void onConnectionChange(final PeerConnection.PeerConnectionState newState) {
|
||||||
final PeerConnection.PeerConnectionState oldState = currentState;
|
eventCallback.onConnectionChange(newState);
|
||||||
currentState = newState;
|
|
||||||
eventCallback.onConnectionChange(oldState, newState);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -154,6 +151,7 @@ public class WebRTCWrapper {
|
||||||
@Override
|
@Override
|
||||||
public void onRenegotiationNeeded() {
|
public void onRenegotiationNeeded() {
|
||||||
Log.d(EXTENDED_LOGGING_TAG, "onRenegotiationNeeded()");
|
Log.d(EXTENDED_LOGGING_TAG, "onRenegotiationNeeded()");
|
||||||
|
final PeerConnection.PeerConnectionState currentState = peerConnection == null ? null : peerConnection.connectionState();
|
||||||
if (currentState != null && currentState != PeerConnection.PeerConnectionState.NEW) {
|
if (currentState != null && currentState != PeerConnection.PeerConnectionState.NEW) {
|
||||||
eventCallback.onRenegotiationNeeded();
|
eventCallback.onRenegotiationNeeded();
|
||||||
}
|
}
|
||||||
|
@ -267,8 +265,6 @@ public class WebRTCWrapper {
|
||||||
throw new InitializationException("Unable to create PeerConnection");
|
throw new InitializationException("Unable to create PeerConnection");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.currentState = peerConnection.connectionState();
|
|
||||||
|
|
||||||
final Optional<CapturerChoice> optionalCapturerChoice = media.contains(Media.VIDEO) ? getVideoCapturer() : Optional.absent();
|
final Optional<CapturerChoice> optionalCapturerChoice = media.contains(Media.VIDEO) ? getVideoCapturer() : Optional.absent();
|
||||||
|
|
||||||
if (optionalCapturerChoice.isPresent()) {
|
if (optionalCapturerChoice.isPresent()) {
|
||||||
|
@ -535,7 +531,7 @@ public class WebRTCWrapper {
|
||||||
public interface EventCallback {
|
public interface EventCallback {
|
||||||
void onIceCandidate(IceCandidate iceCandidate);
|
void onIceCandidate(IceCandidate iceCandidate);
|
||||||
|
|
||||||
void onConnectionChange(PeerConnection.PeerConnectionState oldState, PeerConnection.PeerConnectionState newState);
|
void onConnectionChange(PeerConnection.PeerConnectionState newState);
|
||||||
|
|
||||||
void onAudioDeviceChanged(AppRTCAudioManager.AudioDevice selectedAudioDevice, Set<AppRTCAudioManager.AudioDevice> availableAudioDevices);
|
void onAudioDeviceChanged(AppRTCAudioManager.AudioDevice selectedAudioDevice, Set<AppRTCAudioManager.AudioDevice> availableAudioDevices);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue