Skip to content

Commit

Permalink
Merge pull request #537 from GNUDimarik/remote_control
Browse files Browse the repository at this point in the history
Fixed issue when remote control doesn't work when user enabled it during connection state
  • Loading branch information
ibauersachs committed Dec 23, 2018
2 parents 4f84756 + 69ad01b commit 454469e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
Expand Up @@ -312,7 +312,10 @@ public void setVideoComponent(Component videoComponent)

synchronized(videoComponentMutex)
{
if(this.videoComponent == null)
boolean oldVideoComponentIsNull = this.videoComponent == null;
this.videoComponent = videoComponent;

if(oldVideoComponentIsNull)
{
// If there was no old video component and a new one is set,
// registers to the operation set.
Expand All @@ -330,8 +333,6 @@ public void setVideoComponent(Component videoComponent)
desktopSharingClient.removeRemoteControlListener(this);
}
}

this.videoComponent = videoComponent;
}
}
}
Expand Up @@ -180,6 +180,10 @@ else if(inputIQ.getAction() == InputEvtAction.STOP)
fireRemoteControlRevoked(callPeer);
}
}
else
{
addAddDeferredRemoteControlPeer(callPeerID);
}
}
}
}
Expand Down
Expand Up @@ -80,6 +80,11 @@ public void peerStateChanged(CallPeerChangeEvent evt)
private final List<WeakReference<RemoteControlListener>> listeners
= new ArrayList<WeakReference<RemoteControlListener>>();

/**
* Peers who granted/revoked remote control before it's listeners was
* added
*/
private List<String> deferredRemoteControlPeers = new ArrayList<>();
/**
* The <tt>ProtocolProviderService</tt> implementation which created this
* instance and for which telephony conferencing services are being provided
Expand Down Expand Up @@ -148,6 +153,12 @@ else if (l.equals(listener))
// function for this listener.
if(this.removesNullAndRevokedControlPeer(peer.getPeerID()) != -1)
listener.remoteControlGranted(new RemoteControlGrantedEvent(peer));

if (deferredRemoteControlPeers.contains(peer.getAddress()))
{
fireRemoteControlGranted(peer);
deferredRemoteControlPeers.remove(peer.getAddress());
}
}

/**
Expand Down Expand Up @@ -195,6 +206,13 @@ public void fireRemoteControlRevoked(CallPeer peer)
this.removesNullAndRevokedControlPeer(peer.getPeerID());
}

public void addAddDeferredRemoteControlPeer(String address)
{
if (!deferredRemoteControlPeers.contains(address))
{
deferredRemoteControlPeers.add(address);
}
}
/**
* Gets a list of <tt>RemoteControlListener</tt>s to be notified of remote
* control access changes.
Expand Down

0 comments on commit 454469e

Please sign in to comment.