Community
cancel
Showing results for 
Search instead for 
Did you mean: 
闫__越卓
Beginner
62 Views

android webrtc4.0.1 调用ConferenceClient.leave() 方法偶现崩溃

java.lang.NullPointerException: Attempt to invoke virtual method 'void com.intel.webrtc.conference.SignalingChannel.sendMsg(java.lang.String, org.json.JSONObject, io.socket.client.Ack)' on a null object reference
at com.intel.webrtc.conference.ConferenceClient$9.run(ConferenceClient.java:559)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
 
推测原因,可能是因为我们的服务器会在会议结束时关闭会议。然后同时调用了 ConferenceClient.leave()方法出现的。
public void onRoomDisconnected() {
    CheckCondition.DCHECK(this.callbackExecutor);
    this.changeRoomStatus(ConferenceClient.RoomStates.DISCONNECTED);
    this.callbackExecutor.execute(new Runnable() {
        public void run() {
            ConferenceClient.this.closeInternal();
            Iterator var1 = ConferenceClient.this.observers.iterator();

            while(var1.hasNext()) {
                ConferenceClient.ConferenceClientObserver observer = (ConferenceClient.ConferenceClientObserver)var1.next();
                observer.onServerDisconnected();
            }

        }
    });
}
private void closeInternal() {
    Iterator var1 = this.pcChannels.keySet().iterator();

    while(var1.hasNext()) {
        String key = (String)var1.next();
        ((ConferencePeerConnectionChannel)this.pcChannels.get(key)).dispose();
    }

    this.pcChannels.clear();
    this.subCallbacks.clear();
    this.pubCallbacks.clear();
    this.signalingChannel = null;
    this.conferenceInfo = null;
    this.joinCallback = null;
}

由于我们的业务是多人会议,客户端不知道会议已经结束,会议结束由服务器业务控制,所以每个成员退出会议都会调用ConferenceClient.leave()方法。

下面是leave方法的实现,发现存在线程同步问题。希望下个版本能够解决。

public void leave() {
    if (this.checkRoomStatus(ConferenceClient.RoomStates.DISCONNECTED)) {
        Log.w("ICS", "Wrong room status when leave.");
    } else {
        CheckCondition.DCHECK(this.signalingChannel);
        this.sendSignalingMessage("logout", (JSONObject)null, new Ack() {
            public void call(Object... args) {
                CheckCondition.DCHECK(ConferenceClient.this.extractMsg(0, args).equals("ok"));
                ConferenceClient.this.signalingChannel.disconnect();
            }
        });
    }
}
0 Kudos
1 Reply
He_Z_Intel
Employee
62 Views

谢谢反应问题 我们会尽快找出并修复问题。

Reply