gpt4 book ai didi

Java Android WebRTC提供创建抛出错误和Ice Gathering或trickling没有发生

转载 作者:行者123 更新时间:2023-12-04 23:50:56 25 4
gpt4 key购买 nike

我正在使用 Gradle 依赖项 implementation 'org.webrtc:google-webrtc:1.0.30039'
这是错误:

E/rtc: Fatal error in: gen/sdk/android/generated_metrics_jni/../../../../../../../../usr/local/google/home/sakal/code/webrtc-aar-release/src/sdk/android/src/jni/jni_generator_helper.h, line 94 last system error: 0 Check failed: !env->ExceptionCheck() A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 11556 (network_thread ), pid 11515 (est.applicatoin)



onSignalingChange: HAVE_LOCAL_OFFER 是异常前的最后一次日志调用。

创建了一个 SDP,但没有发生 ICE 滴流,即 OnIceGathering OnIce候选人根本没有被调用。

Java Activity 代码:
public class MainActivity extends AppCompatActivity {
private static final String TAG = "MainActivity";
DataChannel mainDataChannel;
PeerConnection mainPeerConnection;
PeerConnectionFactory factory;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

initializePeerConnectionFactory();
initializeMyPeerConnection(); // Connection Initialization.
startConnection(); //Getting the offer


private void initializePeerConnectionFactory() {

PeerConnectionFactory.InitializationOptions initializationOptions =
PeerConnectionFactory.InitializationOptions.builder(this)
.setEnableInternalTracer(true)
.createInitializationOptions();
PeerConnectionFactory.initialize(initializationOptions);

PeerConnectionFactory.Options options = new PeerConnectionFactory.Options();
factory = PeerConnectionFactory.builder()
.setOptions(options)
.createPeerConnectionFactory();
}

private void startConnection() {
Log.d(TAG, "startConnection: Starting Connection...");
//CreateOffer fires the request to get ICE candidates and finish the SDP. We can listen to all these events on the corresponding observers.
mainPeerConnection.createOffer(new SimpleSdpObserver() {
@Override
public void onCreateSuccess(SessionDescription sessionDescription) {
Log.d(TAG, "onCreateSuccess: " + sessionDescription.description);
mainPeerConnection.setLocalDescription(new SimpleSdpObserver(), sessionDescription);
}

@Override
public void onCreateFailure(String s) {
Log.e(TAG, "onCreateFailure: FAILED:" + s);
}
}, new MediaConstraints());
Log.d(TAG, "startConnection: Start Connection end");
}

private void initializeMyPeerConnection() {
Log.d(TAG, "initializeMyPeerConnection: Starting Initialization...");
mainPeerConnection = createPeerConnection(factory);

mainDataChannel = mainPeerConnection.createDataChannel("sendDataChannel", new DataChannel.Init());//Setting the data channel.
mainDataChannel.registerObserver(new DataChannel.Observer() {
@Override
public void onBufferedAmountChange(long l) {

}

@Override
public void onStateChange() {
//Data channel state change
Log.d(TAG, "onStateChange: " + mainDataChannel.state().toString());
}

@Override
public void onMessage(DataChannel.Buffer buffer) {
Toast.makeText(MainActivity.this, "Got the message!", Toast.LENGTH_SHORT).show();
}
});
Log.d(TAG, "initializeMyPeerConnection: Finished Initializing.");
}

private PeerConnection createPeerConnection(PeerConnectionFactory factory) {
List<PeerConnection.IceServer> iceServers = new LinkedList<>();
iceServers.add(PeerConnection.IceServer.builder("stun:stun.l.google.com:19302").createIceServer());
PeerConnection.RTCConfiguration rtcConfiguration = new PeerConnection.RTCConfiguration(iceServers);
PeerConnection.Observer pcObserver = new MyPeerConnectionObserver(TAG, mainPeerConnection);

return factory.createPeerConnection(rtcConfiguration, pcObserver);
}

}

最佳答案

我遇到了同样的错误并通过添加这一行来解决它

android.enableDexingArtifactTransform.desugaring=false
gradle.properties文件

关于Java Android WebRTC提供创建抛出错误和Ice Gathering或trickling没有发生,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61954958/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com