|Subject:||Re: [Linphone-developers] Problem with camera on Android with Samsung tablets|
|Date:||Fri, 17 Apr 2020 11:13:39 +0200|
|User-agent:||Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0|
You are using the legacy capture filter. We recommend you to switch to Camera2 capture filter implementation that does support what you need.
Sylvain Berfini Software Engineer @ Belledonne Communications
After further investigation, it appears the MSAndroidTextureDisplay filter was installed because my code was using Core.usePreviewWindow(true). It's kinda confusing that you need to provide 2 separate surfaces for local/remote videos, but usePreviewWindow is false. I suppose usePreviewWindow is mostly useful on non-Android platforms.
So in the end, the only thing needed was a way to handle a raw Surface object in AndroidVideoApi5JniWrapper.setPreviewDisplaySurface(). Is there a chance such change will make its way upstream? If course, if there's a better way to do this, I'm all ears.
On Thu, Apr 16, 2020 at 5:01 PM Michael Goffioul <address@hidden> wrote:
it turns out the reason the webcam is not started on the Samsung tablets is because Camera.setPreviewDisplay()/Camera.setPreviewTexture() is never called. Indeed, the case of providing a Surface object is not covered by this code:https://github.com/BelledonneCommunications/mediastreamer2/blob/master/java/src/org/linphone/mediastream/video/capture/AndroidVideoApi5JniWrapper.java#L129-L148
For the Android-x86 device, having a preview surface is not a requirement, but for the Samsung tablets, it's a no-go.
Given that Camera.setPreviewDisplay(surfaceHolder) is just the same as Camera.setPreviewSurface(surfaceHolder.getSurface()), but the latter is hidden API, I worked around the issue with the attached patch, which implements a trivial SurfaceHolder just for the sake of going through the Camera API.
With this change, the Samsung tablet webcam started to work. However, I noticed a huge amount of EGL errors generated (on the Android-x86 device). After tracing the code, I realized that there seemed to be 2 components trying to draw on the same Surface object:- the Camera preview- the MSAndroidTextureDisplay filterHonestly, I don't know why this is happening. It doesn't make sense to have the MSAndroidTextureDisplay filter trying to draw on the Surface, as the Camera API will take care of that. As a temporary ugly hack, I came up with the second part of the patch, which disable the filter for the webcam stream. It's unlikely to be the right solution, in particular this piece of code makes me think there shouldn't be a MSAndroidTextureDisplay filter installed:https://github.com/BelledonneCommunications/mediastreamer2/blob/master/src/voip/videostream.c#L1814-L1817
Could any linphone dev comment on the above?
On Wed, Apr 15, 2020 at 1:53 PM Michael Goffioul <address@hidden> wrote:
I'm using linphone-android SDK (org.linphone:linphone-sdk-android:4.3+) to build an audio/video SIP app, and I'm having problems with the webcam feed on Samsung tablets.
Linphone is used in an Android service. A client application binds to the service and interact with it through Android IPC. When the call is initially connected, video is disabled, and no native WindowId has been set yet. When the clients request to turn on video, the service executes the following:
linphoneCall.enableCamera(true);CallParams params = mLinphoneCore.createCallParams(linphoneCall);params.enableVideo(true);linphoneCall.update(params);
The service then notifies the client (through IPC) that video is now active. The client creates 2 SurfaceView, and provides the underlying Surface objects to the service (again through IPC, Surface is parcelable). When the service receives the Surface objects, it executes:
AFAIK AndroidPlatformHelper can deal with raw surfaces provided.
This constructs works fine on an Intel device running Android-x86 (webcam is started, displayed locally and sent to remote party). But it doesn't work on 2 Samsung tablets I have: TabE/Android-7.1.1 and TabA/Android-8.1. I can see in the logs that the camera is initialized, but no preview starts and no data is sent to remote party.
I can provide full logs, if it helps. Any idea or suggestion would be welcome.
_______________________________________________ Linphone-developers mailing list address@hidden https://lists.nongnu.org/mailman/listinfo/linphone-developers
|[Prev in Thread]||Current Thread||[Next in Thread]|