I'm trying to send video of screen capture to mediasoup with the help of WebRTC. There is a class for it in the WebRTC library: ScreenCapturerAndroid. It works, but the performance on the some devices is really bad. Especially if I use HD or better display resolutions.
On stackoverflow I've found a suggestion to call setEnableVideoHwAcceleration(true) and setVideoHwAccelerationOptions(). But in the newer versions of WebRTC library the methods have been removed .
Here is my code:
// ...
PeerConnectionFactory.Builder builder = PeerConnectionFactory.builder();
builder.setOptions(null);
EglBase.Context eglContext = EglUtils.getRootEglBaseContext();
VideoEncoderFactory encoderFactory =
new DefaultVideoEncoderFactory(
eglContext, true /* enableIntelVp8Encoder */, true);
PeerConnectionFactory.InitializationOptions initializationOptions =
PeerConnectionFactory.InitializationOptions.builder(context)
// .setEnableVideoHwAcceleration(true) // <-- does not work any more
.createInitializationOptions();
PeerConnectionFactory.initialize(initializationOptions);
mPeerConnectionFactory =
builder
.setVideoEncoderFactory(encoderFactory)
.createPeerConnectionFactory();
My question is: how can be video hardware acceleration enabled for screen capturing using the newer WebRTC library versions.