Search in sources :

Example 1 with TurnServerInfo

use of org.whispersystems.signalservice.api.messages.calls.TurnServerInfo in project Signal-Android by WhisperSystems.

the class WebRtcCallService method retrieveTurnServers.

private ListenableFutureTask<List<PeerConnection.IceServer>> retrieveTurnServers() {
    Callable<List<PeerConnection.IceServer>> callable = new Callable<List<PeerConnection.IceServer>>() {

        @Override
        public List<PeerConnection.IceServer> call() {
            LinkedList<PeerConnection.IceServer> results = new LinkedList<>();
            try {
                TurnServerInfo turnServerInfo = accountManager.getTurnServerInfo();
                for (String url : turnServerInfo.getUrls()) {
                    if (url.startsWith("turn")) {
                        results.add(new PeerConnection.IceServer(url, turnServerInfo.getUsername(), turnServerInfo.getPassword()));
                    } else {
                        results.add(new PeerConnection.IceServer(url));
                    }
                }
            } catch (IOException e) {
                Log.w(TAG, e);
            }
            return results;
        }
    };
    ListenableFutureTask<List<PeerConnection.IceServer>> futureTask = new ListenableFutureTask<>(callable, null, serviceExecutor);
    networkExecutor.execute(futureTask);
    return futureTask;
}
Also used : PeerConnection(org.webrtc.PeerConnection) IOException(java.io.IOException) Callable(java.util.concurrent.Callable) LinkedList(java.util.LinkedList) TurnServerInfo(org.whispersystems.signalservice.api.messages.calls.TurnServerInfo) ListenableFutureTask(org.thoughtcrime.securesms.util.ListenableFutureTask) List(java.util.List) LinkedList(java.util.LinkedList)

Aggregations

IOException (java.io.IOException)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Callable (java.util.concurrent.Callable)1 ListenableFutureTask (org.thoughtcrime.securesms.util.ListenableFutureTask)1 PeerConnection (org.webrtc.PeerConnection)1 TurnServerInfo (org.whispersystems.signalservice.api.messages.calls.TurnServerInfo)1