Search Unity

NatDevice - Media Device API

Discussion in 'Assets and Asset Store' started by Lanre, Dec 17, 2015.

?

Should we add exposure controls in v1.3? This means dropping support for iOS 7

Poll closed Jun 10, 2016.
  1. Yes

    9 vote(s)
    75.0%
  2. No

    3 vote(s)
    25.0%
  1. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    When the preview is started, it takes some memory. But there shouldn't be any memory accumulating across calls to StartPreview and StopPreview. Can you share a screenshot of the memory profiler in Xcode?
     
  2. DongHweLee

    DongHweLee

    Joined:
    Aug 1, 2018
    Posts:
    9
    Thanks for the reply. But I do not have StartPreview and StopPreview in my NatCam.
    The version I have is 2.0f4.
    I will upload the screenshot again when I'm ready.
     

    Attached Files:

  3. DongHweLee

    DongHweLee

    Joined:
    Aug 1, 2018
    Posts:
    9

    When using NatCam on iOS, I need to alternate between pause () and play (). What functions do I need to call to avoid memory leaks? Could you give me your mail? It is a little urgent problem.
     
  4. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    Upgrade to NatCam 2.1 on the Asset Store. We don't provide support for older versions of our API's. You can email me here.
     
  5. DongHweLee

    DongHweLee

    Joined:
    Aug 1, 2018
    Posts:
    9
    Okay. I will apply the new version.

    However, to use the new natcam version, I need to use Unity 2018.2.14 or later. I am using 2018.1.9f1. How should this be handled?

    Unity version upgrade seems to be hard to match photon version.
     
  6. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    You should be able to download NatCam anyway. NatCam works with Unity versions as old as 5.3.
     
  7. DongHweLee

    DongHweLee

    Joined:
    Aug 1, 2018
    Posts:
    9
    Ok Thank You!
     
    Lanre likes this.
  8. DongHweLee

    DongHweLee

    Joined:
    Aug 1, 2018
    Posts:
    9
    NatCam is updated as you said. Thank you very much. However, if you use the rear camera on iOS, please confirm that the picture is not taken and the purple screen appears. This is the result from minicam.scene.
     
  9. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    What is your photo resolution? If it's too big to fit into a GPU texture, then you'll see a purple screen.
     
  10. DongHweLee

    DongHweLee

    Joined:
    Aug 1, 2018
    Posts:
    9
    I am using the resolution of the back camera of the iPhone x.

    If so, should the resolution of the rear camera be lowered?

    There was no problem using the front camera.
     
  11. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    Yes, you will probably want to reduce the photo resolution on the rear camera.
     
  12. DongHweLee

    DongHweLee

    Joined:
    Aug 1, 2018
    Posts:
    9
    thank you
     
  13. DongHweLee

    DongHweLee

    Joined:
    Aug 1, 2018
    Posts:
    9
    public void SwitchCamera () {
    // Switch camera
    if (NatCam.Camera.IsFrontFacing)
    {
    NatCam.StartPreview(DeviceCamera.RearCamera, OnStart);
    DeviceCamera.RearCamera.PhotoResolution = new Vector2Int(1920, 1080);
    DeviceCamera.RearCamera.PreviewResolution = new Vector2Int(1920, 1080);
    }
    else
    {
    NatCam.StartPreview(DeviceCamera.FrontCamera, OnStart);

    }


    }

    What if you set the resolution yourself when switching to the rear camera? As above.
     
  14. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    The resolution has to be set before StartPreview is called.
     
  15. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,085
    How do you enable torch mode?
     
  16. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,085
    How do you set NatCam to portrait mode? Or to auto detect the phone orientation? Or be based on Unity's orientation
     
  17. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    DeviceCamera.TorchEnabled.
    NatCam handles device rotation and autorotation by itself. You cannot change it.
     
    ina likes this.
  18. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,085
    How does NatCam determine device rotation? Is it based on Unity's global device rotation?
     
  19. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    It's based on Screen.orientation.
     
  20. tantanix

    tantanix

    Joined:
    Nov 20, 2013
    Posts:
    10
    Hi,

    NatCam 2.1.3
    Android Device: Android 8
    Unity version: 2018.3.4f1
    Min API Level: 24
    Target API Level: highest installed

    I've been getting Android errors suddenly:

    Code (CSharp):
    1. java.lang.SecurityException: validateClientPermissionsLocked:1101: Caller "com.company.appname" (PID 10081, UID 24250) cannot open camera "0" without camera permission
    2.  
    3. at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:699)
    4. at android.hardware.camera2.CameraManager.openCameraDeviceUserAsync(CameraManager.java:391)
    5. at android.hardware.camera2.CameraManager.openCameraForUid(CameraManager.java:517)
    6. at android.hardware.camera2.CameraManager.openCamera(CameraManager.java:481)
    7. at com.yusufolokoba.natcam.DeviceCamera.openCamera(DeviceCamera.java:525)
    8. at com.yusufolokoba.natcam.DeviceCamera.startPreview(DeviceCamera.java:412)
    9. at com.yusufolokoba.natcam.NatCam.startPreview(NatCam.java:73)
    10. at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
    11. at com.unity3d.player.UnityPlayer.c(Unknown Source:0)
    12. at com.unity3d.player.UnityPlayer$e$2.queueIdle(Unknown Source:72)
    13. at android.os.MessageQueue.next(MessageQueue.java:394)
    14. at android.os.Looper.loop(Looper.java:142)
    15. at com.unity3d.player.UnityPlayer$e.run(Unknown Source:32)
     
  21. XRSoftServeInc

    XRSoftServeInc

    Joined:
    Jan 23, 2019
    Posts:
    3
    Hello everyone,

    I've got the next issue

    NatCam 2.1.3
    Unity 2018.3.5f1
    API Level 22
    Device: Epson Moverio BT-300 (Android 5.1.1)

    Using NatCam preview:
    Code (CSharp):
    1. 02-26 20:16:51.810: E/CameraDeviceClient(2737): submitRequestList: Camera 0: Tried to submit a request with a surface that we have not called createStream on
    2. 02-26 20:16:51.812: A/HandlerDispatcher(5583): IllegalArgumentException while invoking public abstract void android.hardware.camera2.CameraCaptureSession$StateCallback.onConfigured(android.hardware.camera2.CameraCaptureSession)
    3. 02-26 20:16:51.812: A/HandlerDispatcher(5583): java.lang.IllegalArgumentException: Bad argument passed to camera service
    4. 02-26 20:16:51.812: A/HandlerDispatcher(5583):     at android.hardware.camera2.utils.CameraBinderDecorator.throwOnError(CameraBinderDecorator.java:114)
    5. 02-26 20:16:51.812: A/HandlerDispatcher(5583):     at android.hardware.camera2.utils.CameraBinderDecorator$CameraBinderDecoratorListener.onAfterInvocation(CameraBinderDecorator.java:73)
    6. 02-26 20:16:51.812: A/HandlerDispatcher(5583):     at android.hardware.camera2.utils.Decorator.invoke(Decorator.java:81)
    7. 02-26 20:16:51.812: A/HandlerDispatcher(5583):     at android.hardware.camera2.impl.CameraDeviceImpl.submitCaptureRequest(CameraDeviceImpl.java:617)
    8. 02-26 20:16:51.812: A/HandlerDispatcher(5583):     at android.hardware.camera2.impl.CameraDeviceImpl.setRepeatingRequest(CameraDeviceImpl.java:663)
    9. 02-26 20:16:51.812: A/HandlerDispatcher(5583):     at android.hardware.camera2.impl.CameraCaptureSessionImpl.setRepeatingRequest(CameraCaptureSessionImpl.java:204)
    10. 02-26 20:16:51.812: A/HandlerDispatcher(5583):     at com.yusufolokoba.natcam.DeviceCamera$3$1.onConfigured(DeviceCamera.java:452)
    11. 02-26 20:16:51.812: A/HandlerDispatcher(5583):     at android.hardware.camera2.dispatch.InvokeDispatcher.dispatch(InvokeDispatcher.java:39)
    12. 02-26 20:16:51.812: A/HandlerDispatcher(5583):     at android.hardware.camera2.dispatch.HandlerDispatcher$1.run(HandlerDispatcher.java:65)
    13.  
    Googling strings
    "Bad argument passed to camera service"
    and
    "Tried to submit a request with a surface that we have not called createStream on"
    I found this thread https://stackoverflow.com/questions/32516539/android-camera2-bad-argument-passed-to-camera-service
    But that doesn't help me using Unity.

    I've also tested the same APK on the Samsung S7 with Android 8 and that works great, but I really need to get results using BT-300.

    Any suggestions?
     
  22. jose_pedro_didimo

    jose_pedro_didimo

    Joined:
    May 2, 2018
    Posts:
    15
    Hi, I am facing issues while building for iOS (arm64): "Duplicate symbols for architecture arm64"
    My app uses NatCorder, NatShare and NatCam.

    duplicate symbol _OBJC_CLASS_$_RenderDispatch in:
    NatCamRenderDispatch.o
    libNatRender.a(RenderDispatch.o)

    duplicate symbol _OBJC_METACLASS_$_RenderDispatch in:
    NatCamRenderDispatch.o
    libNatRender.a(RenderDispatch.o)

    duplicate symbol _OBJC_IVAR_$_RenderDispatch.queue in:
    NatCamRenderDispatch.o
    libNatRender.a(RenderDispatch.o)

    duplicate symbol _OBJC_CLASS_$_RenderContext in:
    libNatRender.a(RenderContext.o)
    libNatCamRenderPipeline.a(RenderContext.o)

    duplicate symbol _OBJC_METACLASS_$_RenderContext in:
    libNatRender.a(RenderContext.o)
    libNatCamRenderPipeline.a(RenderContext.o)

    duplicate symbol _OBJC_IVAR_$_RenderContext._trigger in:
    libNatRender.a(RenderContext.o)
    libNatCamRenderPipeline.a(RenderContext.o)

    duplicate symbol _OBJC_IVAR_$_RenderContext.stopped in:
    libNatRender.a(RenderContext.o)
    libNatCamRenderPipeline.a(RenderContext.o)

    duplicate symbol _OBJC_CLASS_$_TransferContext in:
    libNatRender.a(TransferContext.o)
    libNatCamRenderPipeline.a(TransferContext.o)

    duplicate symbol _OBJC_METACLASS_$_TransferContext in:
    libNatRender.a(TransferContext.o)
    libNatCamRenderPipeline.a(TransferContext.o)

    duplicate symbol _OBJC_CLASS_$_RenderTrigger in:
    libNatRender.a(RenderTrigger.o)
    libNatCamRenderPipeline.a(RenderTrigger.o)

    duplicate symbol _OBJC_METACLASS_$_RenderTrigger in:
    libNatRender.a(RenderTrigger.o)
    libNatCamRenderPipeline.a(RenderTrigger.o)

    duplicate symbol _OBJC_IVAR_$_RenderTrigger.fence in:
    libNatRender.a(RenderTrigger.o)
    libNatCamRenderPipeline.a(RenderTrigger.o)

    ld: 13 duplicate symbols for architecture arm64


    Can you help, please?
     
  23. jose_pedro_didimo

    jose_pedro_didimo

    Joined:
    May 2, 2018
    Posts:
    15
    Hi, any chance you can provide a new lib that works with all your plugins together?
     
  24. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    You need to grant the app camera permissions.
     
  25. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    Issues like this are device-specific due to the OEM's implementation of the Android spec. There isn't anything we can do on our end since we're following the Android implementation of the camera2 API spec.
     
  26. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    Check the NatCorder README on how to resolve these errors.
     
  27. XRSoftServeInc

    XRSoftServeInc

    Joined:
    Jan 23, 2019
    Posts:
    3
    Thanks for the answer!
    So I have another way to solve this. Previously I tested the NatCam on this device and the app worked fine. Can I get the older version of NatCam (before camera2 used)?
     
  28. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    Email me with your invoice number. I should mention that we don't provide support for older versions of our API.
     
  29. jose_pedro_didimo

    jose_pedro_didimo

    Joined:
    May 2, 2018
    Posts:
    15
    Hi Lanre, I followed the instructions on NatCorder's ReadMe file but errors persist. Am I missing something?

    Undefined symbols for architecture arm64:
    "_OBJC_CLASS_$_GLTransferContext", referenced from:
    objc-class-ref in libNatCorder.a(NatCorder.o)
    "_OBJC_CLASS_$_MTLTransferContext", referenced from:
    objc-class-ref in libNatCorder.a(NatCorder.o)
    "_OBJC_CLASS_$_GLRenderContext", referenced from:
    objc-class-ref in libNatCorder.a(NatCorder.o)

    ld: symbol(s) not found for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
     
  30. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    It looks like you are using a much older version of NatCorder. Upgrade to 1.4 on the Asset Store and let me know if you face any issues there.
     
  31. wxxhrt

    wxxhrt

    Joined:
    Mar 18, 2014
    Posts:
    163
    Hi @Lanre

    I'm trying to get multiple USB webcams working on an Nvidia Shield TV box, the app detects both cameras but when turning the second camera on the first goes blank. Might your asset help?
     
  32. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    NatCam doesn't (currently) support running more than one camera. The pipeline is designed with this restriction.
     
  33. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    NatCam 2.2.0 is out!

    And with it comes an updated front-end API which is designed to be more device-oriented. In a nutshell, everything now happens on the `DeviceCamera`: camera properties, starting and stopping the preview, capturing photos, and so on. The new API is leaner (exposing only one class that can be used for every single thing) and more intuitive to use. Upgrade to 2.2.0 today!
     
    rattlesnake likes this.
  34. PiroKun

    PiroKun

    Joined:
    Nov 12, 2012
    Posts:
    27
    Hi! I just download the new version, but the VR passthrough sample doesn't work. Do you have an updated sample? Thanks!
     
  35. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    That example has been archived a long time ago. We aren't updating it anymore.
     
  36. olpk04

    olpk04

    Joined:
    Jun 27, 2017
    Posts:
    1
    Hi!How can I use the telephoto camera on iPhone 7 plus,or how to get the depth map with NatCam?Thanks!
     
  37. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    NatCam doesn't support telephoto or depth on iOS.
     
  38. rattlesnake

    rattlesnake

    Joined:
    Jul 18, 2013
    Posts:
    138
    That is weird because, with an old project updated, natCam 2.2.0 is working.
    But when I create a new unity project from scratch and import natCam 2.2.0, then it only displays a white screen with no errors.

    Tested with :
    OnePlus 5 + Unity 2018.3.8f1

    I checked the player settings and every thing look OK.
    Any idea ?

    Thx
    Seb
     
  39. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    Permissions! I'm adding a permissions API in the next minor update.
     
    rattlesnake likes this.
  40. rattlesnake

    rattlesnake

    Joined:
    Jul 18, 2013
    Posts:
    138
    Thank you !
    Could you also have a look to the mail I send you (blackScreen when rotating my OnePlus 5)

    Thx
     
    Lanre likes this.
  41. xteamsoftware

    xteamsoftware

    Joined:
    Jan 7, 2016
    Posts:
    6
    hello,

    I'm using natCam and with the last update ( 2.2.0 ) there have been some small issues, for example I can't activate the torch.
     
  42. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    Can you share your code? What other small issues are you facing?
     
  43. xteamsoftware

    xteamsoftware

    Joined:
    Jan 7, 2016
    Posts:
    6
    Code (CSharp):
    1. public void TorchOn()
    2.     {
    3.         if (deviceCamera == null)
    4.             return;
    5.  
    6.         if (deviceCamera.IsRunning == false)
    7.             return;
    8.  
    9.         // Switch camera
    10.         if (deviceCamera.IsTorchSupported == true )
    11.         {
    12.             deviceCamera.TorchEnabled = true;
    13.         }
    14.     }
    in the previous version it worked.

    Also issues:
    - if I switch the camera (usually after 2 attempts) the preview becomes completely black or white (I also tried your example MiniCam, same result )
    - if I put the app on pause

    03-12 15:18:52.372: E/Unity(17107): AndroidJavaException: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.hardware.camera2.CameraCaptureSession.stopRepeating()' on a null object reference
    03-12 15:18:52.372: E/Unity(17107): java.lang.NullPointerException: Attempt to invoke virtual method 'void android.hardware.camera2.CameraCaptureSession.stopRepeating()' on a null object reference
    03-12 15:18:52.372: E/Unity(17107): at com.yusufolokoba.natcam.DeviceCamera.stopPreview(DeviceCamera.java:464)
    03-12 15:18:52.372: E/Unity(17107): at UnityEngine.AndroidJNISafe.CheckException () [0x00091] in <b6d510486de34305839d30de90e040c0>:0
    03-12 15:18:52.372: E/Unity(17107): at UnityEngine.AndroidJNISafe.CallVoidMethod (System.IntPtr obj, System.IntPtr methodID, UnityEngine.jvalue[] args) [0x00011] in <b6d510486de34305839d30de90e040c0>:0
    03-12 15:18:52.372: E/Unity(17107): at UnityEngine.AndroidJavaObject._Call (System.String methodName, System.Object[] args) [0x00036] in <b6d510486de34305839d30de90e040c0>:0
    03-12 15:18:52.372: E/Unity(17107): at UnityEngine.AndroidJavaObject.Call (System.String methodName, System.Object[] args) [0x00001] in <b6d510486de34305839d30de90e040c0>:0
    03-12 15:18:52.372: E/Unity(17107): at NatCam.Platforms.DeviceCameraAndroid.<StopPrevi
     
  44. inphantryderek

    inphantryderek

    Joined:
    Feb 7, 2019
    Posts:
    1
    I downloaded NatCam last night. I get the same error any time I call StopPreview() on android using the front facing cam (haven't tried back, I only need front). I even tried this:

    if (deviceCamera )
    {
    deviceCamera.StopPreview();
    }

    E/Unity: AndroidJavaException: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.hardware.camera2.CameraCaptureSession.stopRepeating()' on a null object reference
    java.lang.NullPointerException: Attempt to invoke virtual method 'void android.hardware.camera2.CameraCaptureSession.stopRepeating()' on a null object reference
    at com.yusufolokoba.natcam.DeviceCamera.stopPreview(DeviceCamera.java:464)
    at UnityEngine.AndroidJNISafe.CheckException () [0x00091] in <f26f94777f344cbf82b24a96909a79dd>:0
    at UnityEngine.AndroidJNISafe.CallVoidMethod (System.IntPtr obj, System.IntPtr methodID, UnityEngine.jvalue[] args) [0x00011] in <f26f94777f344cbf82b24a96909a79dd>:0
    at UnityEngine.AndroidJavaObject._Call (System.String methodName, System.Object[] args) [0x00036] in <f26f94777f344cbf82b24a96909a79dd>:0
    at UnityEngine.AndroidJavaObject.Call (System.String methodName, System.Object[] args) [0x00001] in <f26f94777f344cbf82b24a96909a79dd>:0
    at NatCam.Platforms.DeviceCameraAndroid.<StopPrevi





    Also, Separate problem on Android: When I turn it to landscape, the video disappears (black screen). When I rotate back, still nothing.
     
  45. noname77

    noname77

    Joined:
    Oct 6, 2015
    Posts:
    9
    Hi @Lanre,

    I have just bought your plugin. It seems to be suitable for my needs when testing in Unity Editor, but when trying on the first device i own (Samsung Galaxy Note 3, running Lineage), i get white screen only. Happens for both unmodified GreyCam and MiniCam examples. Logs show that the issue might have to do with RenderScript.

    Any ideas?

    Logcat:


    03-14 16:06:07.590 26454 26454 D vndksupport: Loading /vendor/lib/hw/android.hardware.graphics.mapper@2.0-impl.so from current namespace instead of sphal namespace.
    03-14 16:06:07.591 26454 26454 D vndksupport: Loading /vendor/lib/hw/gralloc.msm8974.so from current namespace instead of sphal namespace.
    03-14 16:06:07.626 613 1009 W UsageStatsService: Event reported without a package name
    03-14 16:06:07.685 1170 26899 W ctxmgr : [PhoneLockProducer]Got same value as before for phonelock (isLocked=false)
    03-14 16:06:07.692 1445 1542 I libnfc_nci: [INFO:NativeNfcManager.cpp(264)] nfaConnectionCallback: NFA_POLL_DISABLED_EVT: status = 0
    03-14 16:06:07.703 1445 1445 I libnfc_nci: [INFO:NativeNfcManager.cpp(1226)] nfcManager_enableDiscovery: exit
    03-14 16:06:07.778 26454 26470 I Unity : SystemInfo CPU = ARMv7 VFPv3 NEON, Cores = 4, Memory = 2826mb
    03-14 16:06:07.778 26454 26470 I Unity : SystemInfo ARM big.LITTLE configuration: 4 big (mask: 0xf), 0 little (mask: 0x0)
    03-14 16:06:07.781 26454 26470 I Unity : ApplicationInfo com.company.natcamtest version 1.0 build 2b5eee12-c9ad-4040-8e6d-aefcef63ef89
    03-14 16:06:07.781 26454 26470 I Unity : Built from '2018.3/staging' branch, Version '2018.3.8f1 (fc0fe30d6d91)', Build type 'Release', Scripting Backend 'mono', CPU 'armeabi-v7a'
    03-14 16:06:08.026 833 1083 W Adreno-EGL: <qeglDrvAPI_eglGetConfigAttrib:607>: EGL_BAD_ATTRIBUTE
    03-14 16:06:08.048 26454 26470 I Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: EGL 1.4 QUALCOMM build: Nondeterministic_AU_msm8974_LA.BF.1.1.3_RB1__release_AU (I741a3d36ca)
    03-14 16:06:08.048 26454 26470 I Adreno-EGL: OpenGL ES Shader Compiler Version: E031.29.00.00
    03-14 16:06:08.048 26454 26470 I Adreno-EGL: Build Date: 04/04/16 Mon
    03-14 16:06:08.048 26454 26470 I Adreno-EGL: Local Branch: mybranch19053788
    03-14 16:06:08.048 26454 26470 I Adreno-EGL: Remote Branch: quic/LA.BF.1.1.3_rb1.12
    03-14 16:06:08.048 26454 26470 I Adreno-EGL: Local Patches: NONE
    03-14 16:06:08.048 26454 26470 I Adreno-EGL: Reconstruct Branch: NOTHING
    03-14 16:06:08.055 26454 26470 I ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
    03-14 16:06:08.055 26454 26470 I ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
    03-14 16:06:08.055 26454 26470 W Adreno-EGL: <qeglDrvAPI_eglCreateContext:2469>: EGL_BAD_MATCH
    03-14 16:06:08.056 26454 26470 W Adreno-EGL: <qeglDrvAPI_eglGetConfigAttrib:607>: EGL_BAD_ATTRIBUTE
    03-14 16:06:08.056 26454 26470 I chatty : uid=10143(com.company.natcamtest) UnityMain identical 2 lines
    03-14 16:06:08.082 26454 26470 W Adreno-EGL: <qeglDrvAPI_eglGetConfigAttrib:607>: EGL_BAD_ATTRIBUTE
    03-14 16:06:08.084 26454 26470 D vndksupport: Loading /vendor/lib/hw/gralloc.msm8974.so from current namespace instead of sphal namespace.
    03-14 16:06:08.110 26454 26470 D Unity : GL_AMD_compressed_ATC_texture GL_AMD_performance_monitor GL_AMD_program_binary_Z400 GL_EXT_debug_label GL_EXT_debug_marker GL_EXT_discard_framebuffer GL_EXT_robustness GL_EXT_texture_format_BGRA8888 GL_EXT_texture_type_2_10_10_10_REV GL_NV_fence GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_depth24 GL_OES_EGL_image GL_OES_EGL_sync GL_OES_EGL_image_external GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_fragment_precision_high GL_OES_get_program_binary GL_OES_packed_depth_stencil GL_OES_depth_texture_cube_map GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_vertex_type_10_10_10_2 GL_OES_vertex_array_object GL_QCOM_alpha_test GL_QCOM_binning_control GL_QCOM_driver_control GL_QCOM_perfmon_global_mode GL_QCOM_extended_get GL_QCOM_extended_get2 GL_QCOM_tiled_rendering GL_QCOM_writeonly_rendering GL_EXT_sRGB GL_EXT_sRGB_write_control GL_EXT
    03-14 16:06:08.110 26454 26470 D Unity : _texture_sRGB_decode GL_EXT_texture_filter_anisotropic GL_EXT_multisampled_render_to_texture GL_EXT_color_buffer_float GL_EXT_color_buffer_half_float GL_EXT_disjoint_timer_query
    03-14 16:06:08.318 26454 27894 W AudioTrack: Use of stream types is deprecated for operations other than volume control
    03-14 16:06:08.318 26454 27894 W AudioTrack: See the documentation of AudioTrack() for what to use instead with android.media.AudioAttributes to qualify your playback use case
    03-14 16:06:09.593 26454 26470 V MediaRouter: Adding route: RouteInfo{ name=Phone, description=null, status=null, category=RouteCategory{ name=System types=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO groupable=false }, supportedTypes=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO , presentationDisplay=null }
    03-14 16:06:09.601 26454 26470 V MediaRouter: Selecting route: RouteInfo{ name=Phone, description=null, status=null, category=RouteCategory{ name=System types=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO groupable=false }, supportedTypes=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO , presentationDisplay=null }
    03-14 16:06:12.063 26454 27873 D NetworkSecurityConfig: No Network Security Config specified, using platform default
    03-14 16:06:12.153 26454 26470 D RenderScript HIDL Adaptation: IRenderScriptDevice::getService()
    03-14 16:06:12.157 26454 26470 D vndksupport: Loading /vendor/lib/hw/android.hardware.renderscript@1.0-impl.so from current namespace instead of sphal namespace.
    03-14 16:06:12.178 26454 26470 D RenderScript HIDL Adaptation: IRenderScriptDevice::getService() returned 0x8b5b9930
    03-14 16:06:12.178 26454 26470 D RenderScript HIDL Adaptation: HIDL successfully loaded.
    03-14 16:06:12.685 3445 22607 I EventLogSendingHelper: Sending log events.
    03-14 16:06:13.776 26454 27894 W AudioTrack: releaseBuffer() track 0x91269980 disabled due to previous underrun, restarting
    03-14 16:06:13.791 26454 27921 W Adreno-RS: <rsdSetCacheDir:788>: No cacheDir provided
    03-14 16:06:13.791 26454 27921 W Adreno-RS: <rsdSetCacheDir:805>: Caching & Profiling encountered errors!
    03-14 16:06:13.796 26454 27921 V RenderScript: Successfully loaded runtime: libRSDriver_adreno.so
    03-14 16:06:13.799 26454 26470 D : Successfully queried cache dir: /data/user_de/0/com.company.natcamtest/code_cache
    03-14 16:06:13.799 26454 26470 D RenderScript: Setting cache dir: /data/user_de/0/com.company.natcamtest/code_cache
    03-14 16:06:13.810 26454 26470 I CameraManagerGlobal: Connecting to camera service
    03-14 16:06:13.830 26454 26470 V Unity : NatCam: Changed camera 0 preview resolution to 1280x720
    03-14 16:06:13.830 26454 26470 V Unity : NatCam: Changed camera 0 photo resolution to 1440x1080
    03-14 16:06:13.830 26454 26470 D Unity : NatCam: Changed camera 0 framerate to 121
    03-14 16:06:13.839 26454 26470 V Unity : NatCam: Changed camera 1 preview resolution to 1280x720
    03-14 16:06:13.840 26454 26470 V Unity : NatCam: Changed camera 1 photo resolution to 1920x1080
    03-14 16:06:13.840 26454 26470 D Unity : NatCam: Changed camera 1 framerate to 30
    03-14 16:06:13.873 26454 26470 V Unity : NatCam: Changed camera 0 preview resolution to 640x480
    03-14 16:06:13.948 26454 26470 W Adreno-EGL: <qeglDrvAPI_eglQueryContext:4370>: EGL_BAD_ATTRIBUTE
    03-14 16:06:13.954 26454 26470 W Adreno-EGL: <qeglDrvAPI_eglQueryContext:4370>: EGL_BAD_ATTRIBUTE
    03-14 16:06:13.964 26454 27946 W Adreno-EGL: <qeglDrvAPI_eglGetConfigAttrib:607>: EGL_BAD_ATTRIBUTE
    03-14 16:06:13.966 26454 27946 D vndksupport: Loading /vendor/lib/hw/gralloc.msm8974.so from current namespace instead of sphal namespace.
    03-14 16:06:13.970 26454 27921 E RenderScript: Unable to open shared library (/data/user_de/0/com.company.natcamtest/code_cache/com.android.renderscript.cache/librs.natcam.so): (null)
    03-14 16:06:13.971 26454 27921 V RenderScript: Invoking /system/bin/bcc with args '/system/bin/bcc -unroll-runtime -scalarize-load-store -rs-global-info -rs-global-info-skip-constant -o natcam -output_path /data/user_de/0/com.company.natcamtest/code_cache/com.android.renderscript.cache -bclib /system/lib/libclcore_neon.bc -mtriple armv7-none-linux-gnueabi -O 3 -plugin libbccQTI.so -fPIC -embedRSInfo /data/user_de/0/com.company.natcamtest/code_cache/com.android.renderscript.cache/natcam.bc -build-checksum 8365d807'
    03-14 16:06:13.990 26454 27946 V Unity : NatRender: Created ES3 GLRenderContext
    03-14 16:06:14.061 26454 27921 E RenderScript: Child process "/system/bin/bcc" terminated with status 256
    03-14 16:06:14.061 26454 27921 E RenderScript: bcc: FAILS to compile 'natcam'
    03-14 16:06:14.349 26454 26470 E Unity : AndroidJavaException: android.renderscript.RSRuntimeException: Loading of ScriptC script failed.
    03-14 16:06:14.349 26454 26470 E Unity : android.renderscript.RSRuntimeException: Loading of ScriptC script failed.
    03-14 16:06:14.349 26454 26470 E Unity : at android.renderscript.ScriptC.<init>(ScriptC.java:82)
    03-14 16:06:14.349 26454 26470 E Unity : at com.yusufolokoba.natcam.ScriptC_natcam.<init>(ScriptC_natcam.java:37)
    03-14 16:06:14.349 26454 26470 E Unity : at com.yusufolokoba.natcam.DeviceCamera.startPreview(DeviceCamera.java:411)
    03-14 16:06:14.349 26454 26470 E Unity : at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
    03-14 16:06:14.349 26454 26470 E Unity : at com.unity3d.player.UnityPlayer.c(Unknown Source:0)
    03-14 16:06:14.349 26454 26470 E Unity : at com.unity3d.player.UnityPlayer$e$2.queueIdle(Unknown Source:72)
    03-14 16:06:14.349 26454 26470 E Unity : at android.os.MessageQueue.next(MessageQueue.java:395)
    03-14 16:06:14.349 26454 26470 E Unity : at android.os.Looper.loop(Looper.java:160)
    03-14 16:06:14.349 26454 26470 E Unity : at com.unity3d.player.UnityPlayer$e.run(Unknown Source:32)
    03-14 16:06:14.349 26454 26470 E Unity : at UnityEngine.AndroidJNISafe.CheckException () [0x00091] in <b6d510486de34305839d30de90e040c0>:0
    03-14 16:06:14.349 26454 26470 E Unity : at UnityEngine.AndroidJNISafe.CallVoidMethod (System.IntPtr obj, System.IntPtr methodID, UnityEngine.jvalue[] args) [0x00011] in <b6d510486de34305839d30de90e040c0>:0
    03-14 16:06:14.349 26454 26470 E Unity : at UnityEngine.AndroidJav
    03-14 16:06:17.718 3445 3572 I WorkerManager: Disposing handler for worker [searchplate] (manager: 7051eee, handler: 2618b28)
    03-14 16:06:22.566 613 1580 I ActivityManager: Killing 26389:com.android.keychain/1000 (adj 906): empty #17
    03-14 16:06:22.582 613 656 W libprocessgroup: kill(-26389, 9) failed: No such process
    03-14 16:06:22.627 613 656 W libprocessgroup: kill(-26389, 9) failed: No such process
    03-14 16:06:22.628 613 656 I libprocessgroup: Successfully killed process cgroup uid 1000 pid 26389 in 53ms
    03-14 16:06:22.637 322 322 I Zygote : Process 26389 exited due to signal (9)
    03-14 16:06:26.781 613 23917 D WificondControl: Scan result ready event
    03-14 16:06:26.790 613 669 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: true
    03-14 16:06:32.064 27377 27667 E EventSender: at abzr.a(SourceFile:126)
    03-14 16:06:32.064 27377 27667 E EventSender: at io.reactivex.internal.operators.mixed.ObservableConcatMapCompletable$ConcatMapCompletableObserver.a(SourceFile:265)
    03-14 16:06:32.064 27377 27667 E EventSender: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    03-14 16:06:39.385 26454 26463 W System : A resource failed to call destroy.
    03-14 16:06:42.463 26454 26470 E Unity : AndroidJavaException: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.hardware.camera2.CameraCaptureSession.stopRepeating()' on a null object reference
    03-14 16:06:42.463 26454 26470 E Unity : java.lang.NullPointerException: Attempt to invoke virtual method 'void android.hardware.camera2.CameraCaptureSession.stopRepeating()' on a null object reference
    03-14 16:06:42.463 26454 26470 E Unity : at com.yusufolokoba.natcam.DeviceCamera.stopPreview(DeviceCamera.java:464)
    03-14 16:06:42.463 26454 26470 E Unity : at com.unity3d.player.UnityPlayer.nativePause(Native Method)
    03-14 16:06:42.463 26454 26470 E Unity : at com.unity3d.player.UnityPlayer.l(Unknown Source:0)
    03-14 16:06:42.463 26454 26470 E Unity : at com.unity3d.player.UnityPlayer$22.run(Unknown Source:2)
    03-14 16:06:42.463 26454 26470 E Unity : at android.os.Handler.handleCallback(Handler.java:873)
    03-14 16:06:42.463 26454 26470 E Unity : at android.os.Handler.dispatchMessage(Handler.java:99)
    03-14 16:06:42.463 26454 26470 E Unity : at android.os.Looper.loop(Looper.java:193)
    03-14 16:06:42.463 26454 26470 E Unity : at com.unity3d.player.UnityPlayer$e.run(Unknown Source:32)
    03-14 16:06:42.463 26454 26470 E Unity : at UnityEngine.AndroidJNISafe.CheckException () [0x00091] in <b6d510486de34305839d30de90e040c0>:0
    03-14 16:06:42.463 26454 26470 E Unity : at UnityEngine.AndroidJNISafe.CallVoidMethod (System.IntPtr obj, System.IntPtr methodID, UnityEngine.jvalue
    03-14 16:06:42.539 26454 27894 D AudioTrack: stop() called with 793600 frames delivered
    03-14 16:06:42.736 1445 1542 I libnfc_nci: [INFO:NativeNfcManager.cpp(264)] nfaConnectionCallback: NFA_POLL_DISABLED_EVT: status = 0
    03-14 16:06:42.737 1445 28090 I libnfc_nci: [INFO:NativeNfcManager.cpp(1263)] nfcManager_disableDiscovery: exit
    03-14 16:07:00.126 4581 28160 D com.gsamlabs.bbm.lib.NotifyingService: ===:76:4096:28.9:2
    03-14 16:07:02.085 27377 27667 E EventSender: at abzr.a(SourceFile:126)
    03-14 16:07:02.085 27377 27667 E EventSender: at io.reactivex.internal.operators.mixed.ObservableConcatMapCompletable$ConcatMapCompletableObserver.a(SourceFile:265)
    03-14 16:07:02.085 27377 27667 E EventSender: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    03-14 16:07:32.085 27377 27667 E EventSender: at abzr.a(SourceFile:126)
    03-14 16:07:32.085 27377 27667 E EventSender: at io.reactivex.internal.operators.mixed.ObservableConcatMapCompletable$ConcatMapCompletableObserver.a(SourceFile:265)
    03-14 16:07:32.085 27377 27667 E EventSender: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    03-14 16:08:02.095 27377 27667 E EventSender: at abzr.a(SourceFile:126)
    03-14 16:08:02.095 27377 27667 E EventSender: at io.reactivex.internal.operators.mixed.ObservableConcatMapCompletable$ConcatMapCompletableObserver.a(SourceFile:265)
    03-14 16:08:02.095 27377 27667 E EventSender: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    03-14 16:08:23.711 1288 23638 E SQLiteCastStore: Skip saving CastDeviceInfo: "Nearby device" (__cast_nearby___V_e0266666-dcce-40e0-9c72-70bcdb66f74d)
    03-14 16:08:32.079 27377 27667 E EventSender: at abzr.a(SourceFile:126)
    03-14 16:08:32.079 27377 27667 E EventSender: at io.reactivex.internal.operators.mixed.ObservableConcatMapCompletable$ConcatMapCompletableObserver.a(SourceFile:265)
    03-14 16:08:32.079 27377 27667 E EventSender: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    03-14 16:09:02.103 27377 27667 E EventSender: at abzr.a(SourceFile:126)
    03-14 16:09:02.103 27377 27667 E EventSender: at io.reactivex.internal.operators.mixed.ObservableConcatMapCompletable$ConcatMapCompletableObserver.a(SourceFile:265)
    03-14 16:09:02.103 27377 27667 E EventSender: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    03-14 16:09:04.145 1170 26897 I GCoreUlr: Successfully inserted 1 locations
    03-14 16:09:07.822 1170 26897 I GCoreUlr: DispatchingService.updateActiveState+PowerModeReceiver: Ensuring that reporting is active for [account#3#]
    03-14 16:09:07.844 1170 26897 I GCoreUlr: GMS FLP location updates requested: {"description":"stationary","newRequest":true,"samplePeriodMs":2160000,"sampleReason":"stationary","sampleSource":"internal","timestampMs":1552576147722}
    03-14 16:09:07.908 1170 26897 I GCoreUlr: Successfully inserted 1 locations
    03-14 16:09:21.862 613 613 W system_server: Long monitor contention with owner PhotonicModulator (793) at void com.android.server.power.PowerManagerService$1.onDisplayStateChange(int)(PowerManagerService.java:2669) waiters=1 in void com.android.server.power.PowerManagerService.startUidChangesInternal() for 449ms
    03-14 16:09:21.926 372 372 W wificond: Copy constructor is only used for unit tests
    03-14 16:09:21.926 372 372 W wificond: Failed to get NL80211_ATTR_EXT_FEATURES
    03-14 16:09:21.926 372 372 W wificond: Copy constructor is only used for unit tests
    03-14 16:09:21.926 372 372 W wificond: Failed to get NL80211_ATTR_EXT_FEATURES
    03-14 16:09:21.971 1445 1542 I libnfc_nci: [INFO:NativeNfcManager.cpp(264)] nfaConnectionCallback: NFA_POLL_DISABLED_EVT: status = 3
    03-14 16:09:22.001 1445 28275 I libnfc_nci: [INFO:NativeNfcManager.cpp(1226)] nfcManager_enableDiscovery: exit
    03-14 16:09:22.238 1170 26899 W ctxmgr : [NetworkStateProducer]No state change for network connection context
    03-14 16:09:23.143 833 833 E FalsingLog: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4426)
    03-14 16:09:23.143 833 833 E FalsingLog: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4426)
    03-14 16:09:23.143 833 833 E FalsingLog: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4426)
    03-14 16:09:23.143 833 833 E FalsingLog: at android.os.MessageQueue.next(MessageQueue.java:326)
    03-14 16:09:23.668 1288 26444 D BluetoothAdapter: isLeEnabled(): ON
    03-14 16:09:25.080 1288 26444 W AdaptiveDiscoveryWorker: Exiting Adaptive Discovery. Current NetworkInfo is NULL.
    03-14 16:09:25.263 613 653 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver
    03-14 16:09:25.263 613 653 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver


    Best,
    nnm
     
  46. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    What device are you running on? Also, is `deviceCamera.IsTorchSupported` true?
    I'm looking into this.
    I'll check this out too.
     
  47. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    You need to check that the device camera is running. NatCam doesn't check for you, so if the preview isn't running but you still call StopPreview, you can expect an exception.
    This is a known issue. I'm working on a fix for the next minor update.
     
  48. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    We have no guarantees for non-official Android builds. Officially, the highest supported Note 3 Android version is 5.0. This is below NatCam's requirement, 6.0. Seems that Lineage OS has a faulty RenderScript implementation.
     
  49. xteamsoftware

    xteamsoftware

    Joined:
    Jan 7, 2016
    Posts:
    6
    Hi,

    I tested it on a samsung s6 and samsung s7.

    yes deviceCamera.IsTorchSupported is true, I used an if statement before activate the torch.

    At the first time the torch is activated for one second then the torch turns off automatically. If I tried to activate torch a second time this errors appear ( I try to move deviceCamera.TorchEnabled = true; after and before StartPreview, but same result ):

    03-17 15:08:59.580: E/Unity(15452): NatCam Error: Failed to set camera 0 torch mode
    03-17 15:08:59.580: E/Unity(15452): android.hardware.camera2.CameraAccessException: CAMERA_IN_USE (4): setTorchMode:1606: Torch for camera "0" is not available due to an existing camera user
    03-17 15:08:59.580: E/Unity(15452): at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:634)
    03-17 15:08:59.580: E/Unity(15452): at android.hardware.camera2.CameraManager$CameraManagerGlobal.setTorchMode(CameraManager.java:883)
    03-17 15:08:59.580: E/Unity(15452): at android.hardware.camera2.CameraManager.setTorchMode(CameraManager.java:495)
    03-17 15:08:59.580: E/Unity(15452): at com.yusufolokoba.natcam.DeviceCamera.setTorchEnabled(DeviceCamera.java:329)
    03-17 15:08:59.580: E/Unity(15452): at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
    03-17 15:08:59.580: E/Unity(15452): at com.unity3d.player.UnityPlayer.c(Unknown Source)
    03-17 15:08:59.580: E/Unity(15452): at com.unity3d.player.UnityPlayer$e$2.queueIdle(Unknown Source)
    03-17 15:08:59.580: E/Unity(15452): at android.os.MessageQueue.next(MessageQueue.java:392)
    03-17 15:08:59.580: E/Unity(15452): at android.os.Looper.loop(Looper.java:136)
    03-17 15:08:59.580: E/Unity(15452): at com.unity3d.player.UnityPlayer$e.run(Unknown Source)
    03-17 15:08:59.580: E/Unity(15452): Caused by: android.os.ServiceSpecificException: setTorchMode:1606: Torch for camera "0" is not available due to an existing camera user
    03-17 15:08:59.580: E/Unity(15452): at android.os.Parcel.readException(Parcel.java:1707)
    03-17 15:08:59.580: E/Unity(15452): at android.os.Parcel.readException(Parcel.java:1646)[/QUOTE]
     
  50. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    In my experience, this is a bug in camera2. The torch flickers instead of staying on.
    Apparently when the preview is running, turning on the torch must be done a different way. I'll implement it and see how it works.