Skip to content

Commit bcc0597

Browse files
committed
null payload bug fix
1 parent 1a3d868 commit bcc0597

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/fr/pchab/AndroidRTC/RTCClient.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ private interface Command{
4040
}
4141

4242
private class CreateOfferCommand implements Command{
43-
44-
@Override
4543
public void execute(String peerId, JSONObject payload) throws JSONException {
4644
Peer peer = peers.get(peerId);
4745
peer.pc.createOffer(peer, pcConstraints);
@@ -95,7 +93,10 @@ public MessageHandler() {
9593
public void handle(JSONObject json) throws JSONException {
9694
String from = json.getString("from");
9795
String type = json.getString("type");
98-
JSONObject payload = json.getJSONObject("payload");
96+
JSONObject payload = null;
97+
if(!type.equals("init")) {
98+
payload = json.getJSONObject("payload");
99+
}
99100

100101
// if peer is unknown, add him
101102
if(!peers.containsKey(from)) {
@@ -125,7 +126,6 @@ public void onCreateSuccess(final SessionDescription sdp) {
125126

126127
@Override
127128
public void onSetSuccess() {
128-
pc.createAnswer(Peer.this, pcConstraints);
129129
}
130130

131131
@Override
@@ -252,7 +252,7 @@ public void start(){
252252
try {
253253
JSONObject message = new JSONObject();
254254
message.put("name", name);
255-
message.put("privacy", true);
255+
message.put("privacy", false);
256256
client.emit("readyToStream", new JSONArray().put(message));
257257
} catch (JSONException e) {
258258
e.printStackTrace();

0 commit comments

Comments
 (0)