Reputation: 5614
Everything else in my app seems fine, both remote and local streams display just fine if I'm using Camera1
API. But, when I try and use the Camera2
API, the local video stream doesn't show anymore, a black screen shows instead. The local stream is still being displayed on the remote end though, and there's no error messages in the log either. The API is the only thing I changed in my code. Anyone knows what's going on here?
I came across a similar problem here, but it's outdated and not testable as setVideoHwAccelerationOptions()
has been depreciated and the related stuff is being handled by coded factories as described here.
Here's my code for building these factories, in case that's helpful:
final VideoEncoderFactory encoderFactory;
final VideoDecoderFactory decoderFactory;
encoderFactory = new DefaultVideoEncoderFactory(
rootEglBase.getEglBaseContext(), true /* enableIntelVp8Encoder */, false);
decoderFactory = new DefaultVideoDecoderFactory(rootEglBase.getEglBaseContext());
Upvotes: 0
Views: 326
Reputation: 5614
Problem solved! Turns out all of the camera and rendering related stuff has to share a same EglBase
instance and its context
. I created multiple instances while initializing the connection.
As for the reason why local video stream doesn't show only when using Camera2
API, I suppose is because Camera2Enumerator
is the one that requires a context, likely EglBaseContext
, whereas Camera1
doesn't require it. (I'm not sure about this one, correct me if I'm wrong.)
Anyways, TL;DR: check the code and make sure you are using a single EglBase
instance for all your related operations.
Upvotes: 1