简体   繁体   English

在Android Webrtc上生成本地SDP报价时发生“ EGL上下文未设置”错误

[英]“ EGL context not set ” Error Occurs while generating local SDP offer on android Webrtc

Can you please check where i went wrong . 你能检查我哪里出问题了。 Below is the method in which i was setting setVideoHwAccelerationOptions . 以下是我设置setVideoHwAccelerationOptions的方法。

public void setCamera() {

    factory.setVideoHwAccelerationOptions(rootEglBase.getEglBaseContext(), rootEglBase.getEglBaseContext());
    localMS = factory.createLocalMediaStream("ARDAMS");

    if (pcParams.videoCallEnabled) {

        getVideoCapturer();

        videoSource = factory.createVideoSource(videoCapturer);
        videoCapturer.startCapture(pcParams.videoWidth, pcParams.videoHeight, pcParams.videoFps);
        videoTrack = factory.createVideoTrack("ARDAMSv0", videoSource);
        videoTrack.setEnabled(true);

        localMS.addTrack(videoTrack);

    }

    audioSource = factory.createAudioSource(new MediaConstraints());
    audioTrack = factory.createAudioTrack("ARDAMSa0", audioSource);
    localMS.addTrack(audioTrack);

    mListener.onLocalStream(localMS, true);

}

We have pass proper EGL context to PeerConnectionFactory.setVideoHwAccelerationOptions before calling PeerConnectionFactory.createVideoSource. 在调用PeerConnectionFactory.createVideoSource之前,我们已经将适当的EGL上下文传递给PeerConnectionFactory.setVideoHwAccelerationOptions。

Below is code for that. 下面是该代码。

factory.setVideoHwAccelerationOptions(rootEglBase.getEglBaseContext(), rootEglBase.getEglBaseContext());
localMS = factory.createLocalMediaStream("ARDAMS");

if (pcParams.videoCallEnabled) {

    getVideoCapturer();

    videoSource = factory.createVideoSource(videoCapturer);
    videoCapturer.startCapture(pcParams.videoWidth, pcParams.videoHeight, pcParams.videoFps);
    videoTrack = factory.createVideoTrack("ARDAMSv0", videoSource);
    videoTrack.setEnabled(true);

    localMS.addTrack(videoTrack);

}

audioSource = factory.createAudioSource(new MediaConstraints());
audioTrack = factory.createAudioTrack("ARDAMSa0", audioSource);
localMS.addTrack(audioTrack);

mListener.onLocalStream(localMS, true);        

Eglcontext is created on the activity where your SurfaceViewRenderer is created. 在创建SurfaceViewRenderer的活动上创建Eglcontext。 and it is passed as an argument to setVideoHwAccelerationOptions method. 并将其作为参数传递给setVideoHwAccelerationOptions方法。

below line shows how to create an EGL context . 下一行显示了如何创建EGL上下文。

rootEglBase = EglBase.create(); 

Please refer to below link for details: https://github.com/njovy/AppRTCDemo 请参阅以下链接以获取详细信息: https : //github.com/njovy/AppRTCDemo

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM