[jitsi-dev] Jitsi-Android Camera object and the preview surface


Hi all,

I've found an issue with the preview surface being unavailable when local
camera is started in Jitsi-Android.

It's supposed to be set by static method
And it's done in VideoCallActivity by handler bound to "surfaceCreated"
event of previewDisplay member. This event is generated when the surface is
set to visible after "local video added" event. But the problem is that
this event occurs after the camera has been already started with null
surface causing the whole Android media system to crash.

After some research I came to conslusion that local video events are
useless in this Android situation. This is because the surface must be
ready before "local video added" event. Also it must not be released on
"local video removed" event, beacuse the camera is not stopped yet at this

As another workaround I've implemented an interface "SurfaceProvider". It's
notified before setPreviewDisplay is called so that the view is set to
visible. Later just before the camera is stopped it's notified to hide the
view. Local video events are ignored and it's working fine this way.

But the problem is that it is also static member of
.protocol.mediarecorder.DataSource (I register it as a static member). I
thought that maybe it will be more elegant to create "surface provider"
interface and register it in
org.jitsi.impl.neomedia.device.MediaRecorderSystem, but I am not that much
familiar with JMF architecture. Could you please provide some guidance ? Or
other ideas for solving this problem ?