应用程序在关闭对等连接appRTC android时崩溃

问题描述

我已经在我的应用程序中实现了appRTC,但是将其流程更改为由一位主持人(例如会议会议等)邀请多位来宾。但是我面临的问题是当我与主机断开连接时,应用程序崩溃了。它还显示了与SQLite和约束有关的日志上的不同怪异异常。我已经为此工作了一个星期,但是什么都找不到。 这是我这次得到的。

2020-08-11 18:10:01.856 19916-19916 /? E / SQLiteDatabase:无法打开数据库“ /data/user/0/com.facebook.appmanager/databases/androidx.work.workdb”。 android.database.sqlite.SQLiteCantOpenDatabaseException:未知错误(代码14):无法打开数据库

我用来关闭对等连接的代码如下:

private void disconnect() {
    try{
        if (appRtcClient != null) {
            try{
                appRtcClient.disconnectFromRoom();
                appRtcClient = null;
            }catch (Exception e){
                e.printStackTrace();
            }
        }

        if (FirebaseRTCClient.myId.equals("host")){
            activityRunning = false;
            if (appRtcClient != null) {
                try{
                    appRtcClient.disconnectFromRoom();
                    appRtcClient = null;
                }catch (Exception e){
                    e.printStackTrace();
                }
            }
            try {
                for (int i = 0; i<peerConnectionClientsList.size(); i++){
                    if (peerConnectionClientsList.get(i) != null) {
                        peerConnectionClientsList.get(i).close();
                        peerConnectionClient = null;
                    }
                }
            }catch (Exception e){
                Toast.makeText(this,""+e.getMessage(),Toast.LENGTH_SHORT).show();
            }


            if (localRender != null) {
                localRender.release();
                localRender = null;
            }
            if (videoFileRenderer != null) {
                videoFileRenderer.release();
                videoFileRenderer = null;
            }
            if (remoteRenderScreen != null) {
                remoteRenderScreen.release();
                remoteRenderScreen = null;
            }
            if (audioManager != null) {
                audioManager.close();
                audioManager = null;
            }
            if (iceConnected && !isError) {
                setResult(RESULT_OK);
            } else {
                setResult(RESULT_CANCELED);
            }
            finish();
        }
    }catch (Exception e){
        Toast.makeText(this,"Disconnect Error: "+e.getMessage(),Toast.LENGTH_SHORT).show();
    }
}

和closeInternal():

public void closeInternal() {
try{
  if (factory != null && peerConnectionParameters.aecDump) {
    factory.stopAecDump();
  }
  Log.d(TAG,"Closing peer connection.");
  statsTimer.cancel();

    try{
        for (int i = 0; i<peerConnectionList.size(); i++){
            if (peerConnectionList.get(i)!=null){
                peerConnectionList.get(i).close();
                peerConnection = null;
                pcConstraints=null;
            }
        }
    }catch (Exception e){
        Toast.makeText(context,Toast.LENGTH_SHORT).show();
    }


Log.d(TAG,"Closing audio source.");
if (audioSource != null) {
  audioSource.dispose();
  audioSource = null;
}
Log.d(TAG,"Closing video source.");
if (videoSource != null) {
  videoSource.dispose();
  videoSource = null;
}
  options = null;
  Log.d(TAG,"Closing peer connection done.");
  events.onPeerConnectionClosed();
  PeerConnectionFactory.stopInternalTracingCapture();
  PeerConnectionFactory.shutdownInternalTracer();
}catch (Exception e){
  Toast.makeText(context,Toast.LENGTH_SHORT).show();
}
  }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...