Reputation: 111
Can you please check where i went wrong . Below is the method in which i was setting 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);
}
Upvotes: 0
Views: 387
Reputation: 111
We have pass proper EGL context to PeerConnectionFactory.setVideoHwAccelerationOptions before calling PeerConnectionFactory.createVideoSource.
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. and it is passed as an argument to setVideoHwAccelerationOptions method.
below line shows how to create an EGL context .
rootEglBase = EglBase.create();
Please refer to below link for details: https://github.com/njovy/AppRTCDemo
Upvotes: 2