[discuss-webrtc] Problems rendering local stream when using Camera2 on Android

548 views
Skip to first unread message

Saúl Ibarra Corretgé

unread,
Jul 7, 2017, 10:15:32 AM7/7/17
to discuss...@googlegroups.com
Hola!

I’ve been working on updating the React Native WebRTC plugin to use the Camera2 API on Android, but I’m running into a weird problem, and I’m in need of some help. Local streams are not properly rendered, they just show a black. Remote streams render fine.

AFACT I have done everything just like the demo app:

- configured the PeerConnectionFactory to use HW acceleration
- pass the EGL contexts to the factory to enable HW codecs
- create the video capturer using the Camera2Enumerator
- …

At this point, remote video renders correctly, and the remote party can see my video, but the local view is just black. Using the same code, but with the Camera1Eumerator / capturer, local video renders correctly.

So, is there any extra setup required to have a local stream rendered in a SurfaceViewRenderer? I can’t find anything suggesting this in the demo app’s source :-S

Any help would be appreciated.


Cheers,

--
Saúl

Saúl Ibarra Corretgé

unread,
Jul 7, 2017, 12:14:19 PM7/7/17
to discuss...@googlegroups.com
Made an M60 build, and everything in the logs suggests video should be rendered, but nope: https://gist.github.com/saghul/840b47f36a919811bc2cdc24fd00743b

--
Saúl

Saúl Ibarra Corretgé

unread,
Jul 10, 2017, 8:31:33 AM7/10/17
to discuss...@googlegroups.com
Finally solved it! For posterity, I’ll leave what the problem was here.

The problem is that I was calling factory.setVideoHwAccelerationOptions too late. It was being called *after* factory.createVideoSource. This is problematic because it uses the localEglContext that was passed to setVideoHwAccelerationOptions.

In order for rendering to work properly the contexts passed to both functions must come from the same base.


Cheers,
--
Saúl

Jack Zhang

unread,
Jan 20, 2019, 10:07:01 AM1/20/19
to discuss-webrtc
Hey, so now that the setVideoHwAccelerationOptions is gone, do you still face the problem? If so, how did you solve it, thanks.
Reply all
Reply to author
Forward
0 new messages