Revert "Prefer H264"

This reverts commit 589f7f934f.
This commit is contained in:
Mario Danic 2018-10-16 21:53:35 +02:00
parent 589f7f934f
commit 0bb65795ad
4 changed files with 42 additions and 28 deletions

View file

@ -1263,7 +1263,7 @@ public class CallController extends BaseController {
magicPeerConnectionWrapper.setNick(ncSignalingMessage.getPayload().getNick());
String sessionDescriptionStringWithPreferredCodec = MagicWebRTCUtils.preferCodec
(ncSignalingMessage.getPayload().getSdp(),
"H264", false);
"VP8", false);
SessionDescription sessionDescriptionWithPreferredCodec = new SessionDescription(
SessionDescription.Type.fromCanonicalForm(type),

View file

@ -0,0 +1,31 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.utils;
import java.util.concurrent.ConcurrentHashMap;
public class MagicMap extends ConcurrentHashMap<Integer, Object> {
public int add(Object element) {
int key = System.identityHashCode(element);
super.put(key, element);
return key;
}
}

View file

@ -340,7 +340,7 @@ public class MagicPeerConnectionWrapper {
public void onCreateSuccess(SessionDescription sessionDescription) {
String sessionDescriptionStringWithPreferredCodec = MagicWebRTCUtils.preferCodec
(sessionDescription.description,
"H264", false);
"VP8", false);
SessionDescription sessionDescriptionWithPreferredCodec = new SessionDescription(
sessionDescription.type,

View file

@ -33,6 +33,7 @@ import com.nextcloud.talk.models.json.websocket.CallOverallWebSocketMessage;
import com.nextcloud.talk.models.json.websocket.ErrorOverallWebSocketMessage;
import com.nextcloud.talk.models.json.websocket.EventOverallWebSocketMessage;
import com.nextcloud.talk.models.json.websocket.HelloResponseOverallWebSocketMessage;
import com.nextcloud.talk.utils.MagicMap;
import org.greenrobot.eventbus.EventBus;
@ -41,6 +42,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import javax.inject.Inject;
@ -70,7 +72,7 @@ public class MagicWebSocketInstance extends WebSocketListener {
private boolean connected;
private WebSocketConnectionHelper webSocketConnectionHelper;
private WebSocket webSocket;
private ConcurrentHashMap<Integer, Object> concurrentHashMapQueue;
private MagicMap<Integer, Object> magicMap;
MagicWebSocketInstance(UserEntity conversationUser, String connectionUrl, String webSocketTicket) {
NextcloudTalkApplication.getSharedApplication().getComponentApplication().inject(this);
@ -82,7 +84,7 @@ public class MagicWebSocketInstance extends WebSocketListener {
this.webSocketTicket = webSocketTicket;
this.webSocketConnectionHelper = new WebSocketConnectionHelper();
concurrentHashMapQueue = new ConcurrentHashMap<>();
magicMap = new MagicMap();
}
@Override
@ -150,18 +152,8 @@ public class MagicWebSocketInstance extends WebSocketListener {
Map<String, Object> participantsUpdateMap = eventOverallWebSocketMessage.getEventMap();
HashMap<String, String> refreshChatHashMap = new HashMap<>();
refreshChatHashMap.put("roomToken", (String) eventOverallWebSocketMessage.getEventMap().get("roomid"));
int newId;
do {
Random rand = new Random();
newId = rand.nextInt(1000);
if (!concurrentHashMapQueue.contains(newId)) {
concurrentHashMapQueue.put(newId, participantsUpdateMap.get("users"));
refreshChatHashMap.put("roomToken", (String) eventOverallWebSocketMessage.getEventMap().get("roomid"));
refreshChatHashMap.put("jobId", Integer.toString(newId));
eventBus.post(new WebSocketCommunicationEvent("participantsUpdate", refreshChatHashMap));
}
} while (!concurrentHashMapQueue.contains(newId));
refreshChatHashMap.put("jobId", Integer.toString(magicMap.add(participantsUpdateMap.get("users"))));
eventBus.post(new WebSocketCommunicationEvent("participantsUpdate", refreshChatHashMap));
}
break;
}
@ -169,18 +161,9 @@ public class MagicWebSocketInstance extends WebSocketListener {
break;
case "message":
CallOverallWebSocketMessage callOverallWebSocketMessage = LoganSquare.parse(text, CallOverallWebSocketMessage.class);
int newId;
do {
HashMap<String, String> messageHashMap = new HashMap<>();
Random rand = new Random();
newId = rand.nextInt(1000);
if (!concurrentHashMapQueue.contains(newId)) {
concurrentHashMapQueue.put(newId, callOverallWebSocketMessage.getCallWebSocketMessage().getNcSignalingMessage());
messageHashMap.put("jobId", Integer.toString(newId));
eventBus.post(new WebSocketCommunicationEvent("signalingMessage", messageHashMap));
}
} while (!concurrentHashMapQueue.contains(newId));
HashMap<String, String> messageHashMap = new HashMap<>();
messageHashMap.put("jobId", Integer.toString(magicMap.add(callOverallWebSocketMessage.getCallWebSocketMessage().getNcSignalingMessage())));
eventBus.post(new WebSocketCommunicationEvent("signalingMessage", messageHashMap));
break;
default:
break;