Start a new topic
Solved

SIGSEGV when using camera 1 api with native plugin

Hi,

I'm trying to use the customCamera sample on a Huawei P7, and i'm unable to use camera 1 api, the plugin crashes when rendering frames:


thread #50: tid = 6651, 0x4abce2b4 libGLES_mali.so, name = 'GLThread 1155', stop reason = signal SIGSEGV: invalid address (fault address: 0x4e4f2108)
  frame #0: 0x4abce2b4 libGLES_mali.so
  frame #1: 0x4abe72c0 libGLES_mali.so
  frame #2: 0x4abe98cc libGLES_mali.so
  frame #3: 0x4abea370 libGLES_mali.so`_mali_convert_texture + 1032
  frame #4: 0x4ab98d90 libGLES_mali.so
  frame #5: 0x4ab7729c libGLES_mali.so
  frame #6: 0x4ab793bc libGLES_mali.so
  frame #7: 0x4abb50e0 libGLES_mali.so
  frame #8: 0x4ab73a5c libGLES_mali.so`glTexImage2D + 140
  frame #9: 0x4c1e58b2 libwikitudePlugins.so`YUVFrameInputPlugin::updateFrameTexturesData(int, int, unsigned char const*) + 170
  frame #10: 0x4c1e329c libwikitudePlugins.so`YUVFrameInputPlugin::render() + 216
  frame #11: 0x4c1e29a4 libwikitudePlugins.so`YUVFrameInputPlugin::startRender() + 88
  frame #12: 0x5016238e libarchitect.so`wikitude::sdk_foundation::impl::PluginManager::iterateEnabledPlugins(std::function<void (std::shared_ptr<wikitude::sdk::impl::Plugin> const&)>) + 62
  frame #13: 0x501624c4 libarchitect.so`wikitude::sdk_foundation::impl::PluginManager::startRenderPlugins() + 52
  frame #14: 0x5011ebb2 libarchitect.so`wikitude::sdk_core::impl::ArchitectEngine::architectLoop() + 366
  frame #15: 0x5013d920 libarchitect.so`gameplay::Game::frame() + 144
  * frame #16: 0x5012c21a libarchitect.so`wikitude::android_sdk::impl::ArchitectRendererInterface::drawFrame() + 54


works on a samsung S5.

(Just commented wikitudeCamera2 usage in CustomCameraActivity.java, using sdk 6.0.1)


Thanks



Hello Laurent,

Could you please send us the console log error you are getting so that we can understand what the problem is? Also send us the following information:
- Are you using the JS API?
- Are you using any of our Extensions (Titanium, Cordova, Xamarin, Unity)? If yes, which version are you using?
- is this happening with the sample app or in your own app?

Thanks
Eva

 

Hi,

This issue happens both when using the JS SDK or the native SDK.
I don't use any extension, just the CustomCamera example.
It is happening with the sample app, I didn't modify the native code, just forced the use of camera 1 api (WikitudeCamera instead of WikitudeCamera2) in CustomCameraActivity.java.

this issue happens when I run the app on a Huawei P7, also reproduced on a sony Xperia E5 (works on Samsung S5, S5 neo, S6 and Wiko UFEEL Prime)

Please find the logcat content in attachment.

Regards,
Laurent

 

txt

Hi Laurent,


sorry for the late reply.

Does this issue also happen on samples other than the custom camera?

Does this happen with the simple input plugin sample (Included with SDK 6.1)?


In order to track this issue down i created a sample app build including some logs, it would be great if you could run this on your P7 and send me the logs.


Best Regards,

Alex

Hi Alex,
This issue happens on both custom camera and input plugin sample.

 

Please find the logs attached. (Entered custom camera sample, then inputplugin sample)


Regards,

Laurent

txt

Hi Laurent,


thank you for for testing the app.


I built another app with other logs, to further track it down.

This version will also store a camera frame in ExternalStorage/wikitude_cam_frame when running the CustomCamera sample.


Please run the CustomCamera and SimpleInputPlugin samples and send me the logs and the camera frame.



Best Regards,

Alex

Hi Alex,


Please find the logs and the frame in attachment.


Thanks,

Laurent


txt
(18.6 KB)

Hi Laurent,


it seems that the frame is broken (640x480 NV21 frame should be 460KB not 37KB). This frame was stored in CustomCameraActivity onPreviewFrame of the WikitudeCamera before it was passed to the SDK which leads me to think that this is not an issue of the InputPlugin or of the SDK but rather an issue of the camera implementation in our sample app. 


Because of this I would advise you to try to find the issue in the WikitudeCamera or try or own camera implementation. 


Best Regards,

Alex


Hi,

The issue was in wikitudeCamera.java, in the method getCameraSize():
this method returns the first available preview size that is smaller than desired preview size.
Most devices will return a list of preview sizes sorted in descending order, so the returned size will be the good one. But on some devices (Sony Xperia E5 or Huawei P7 for instance), the camera api returns a list sorted in ascending order, so the returned size is very small (176x144), and as the size is fixed in the inputplugin, it will go out of the buffer...

I think this method should return a size that is equal to the desired one, as the SDK doesn't support other resolutions than 640x480, 1280x720 and 1920x1080, so opening preview with another size will lead in bad behaviour (crash smaller, part of frame ignored if bigger..)

I would be nice if this fix is reported in your examples.

Regards,
Laurent





 

Hi Laurent, 


thank you for reporting this, we will fix it in our sample app. 


The SDK can handle frame resolutions other than 640x480, 1280x720 and 1920x1080 if you are using the InputPlugin, you just have to set it by using InputPlugin.getFrameSettings.setInputFrameSize({width, height}).

In the case of our samples this is always set to 640x480 instead of the actual camera frame size which should be causing this crash.


Best Regards,

Alex

Login or Signup to post a comment