Log in or register to post comments

Crash when turning camera on and off

November 8, 2011 - 2:06pm #1

I'm using an iPod Touch 4th Gen iOS 4.3.3, and I'm having trouble with turning the iPod camera on and off. I am enabling and disabling the TrackerBehaviour on the main camera, which works a few times but then I get an EXC_BAD_ACCESS crash. I tried creating a fresh project with only the Qualcomm AR package imported and then I made a script to turn the camera on and off by tapping the screen. It seems a little more stable, but still crashes after 5-6 times of turning it on and off. Here is the debug log from X-Code:

2011-11-08 14:43:23.721 artest[5933:707] -> registered mono modules 0xec1e94
-> applicationDidFinishLaunching()
QCAR Extension version 1.0.6
2011-11-08 14:43:23.845 artest[5933:707] INFO: QCAR SDK version 1.0.0

2011-11-08 14:43:36.454 artest[5933:707] INFO: http response: 0

2011-11-08 14:43:37.204 artest[5933:707] INFO: Tracker starts loading

2011-11-08 14:43:37.228 artest[5933:707] INFO: Found config.xml

2011-11-08 14:43:37.299 artest[5933:707] INFO: Found config.xml

2011-11-08 14:43:37.307 artest[5933:707] INFO: Tracker finished loading (no errors)

Renderer: PowerVR SGX 535
Vendor: Imagination Technologies
Version: OpenGL ES 2.0 IMGSGX535-58.6
GL_OES_depth_texture GL_OES_depth24 GL_OES_fbo_render_mipmap GL_OES_mapbuffer GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_float GL_OES_texture_half_float GL_OES_vertex_array_object GL_EXT_blend_minmax GL_EXT_discard_framebuffer GL_EXT_read_format_bgra GL_EXT_shader_texture_lod GL_EXT_texture_filter_anisotropic GL_APPLE_framebuffer_multisample GL_APPLE_rgb_422 GL_APPLE_texture_format_BGRA8888 GL_APPLE_texture_max_level GL_IMG_read_format GL_IMG_texture_compression_pvrtc
Creating OpenGLES2.0 graphics device
Non platform assembly: data-0x6bb8000 (this message is harmless)
Non platform assembly: data-0x6b59000 (this message is harmless)
Non platform assembly: /private/var/mobile/Applications/8430B85F-531E-48EC-9ED7-AA039254D66F/nerf.app/Data/Managed/System.dll (this message is harmless)
Non platform assembly: /private/var/mobile/Applications/8430B85F-531E-48EC-9ED7-AA039254D66F/nerf.app/Data/Managed/Mono.Security.dll (this message is harmless)
Setting Unity version 3.4.1
StartQCAR

(Filename: /Applications/buildAgent/work/842f9557127e852/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 34)

cameraDeviceInitCamera
cameraDeviceGetVideoMode
viewport:
(left:-40.00, top:0.00, width:720.00, height:960.00)

(Filename: /Applications/buildAgent/work/842f9557127e852/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 34)

cameraDeviceSelectVideoMode
cameraDeviceStartCamera
2011-11-08 14:43:39.499 artest[5933:707] CameraImpl: setting focus mode 2 is not supported
2011-11-08 14:43:39.505 artest[5933:707] CameraImpl: setting torch mode 0 is not supported
startTracker
projection:
3.26246 0.00000 0.00000 0.00000
0.00000 2.44353 0.00417 0.00000
0.00000 0.00000 -1.00080 -4.00160
0.00000 0.00000 -1.00000 0.00000

(Filename: /Applications/buildAgent/work/842f9557127e852/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 34)

Absolute number of trackables: 1

(Filename: /Applications/buildAgent/work/842f9557127e852/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 34)

-> force accelerometer registration
-> applicationDidBecomeActive()
stopTracker
cameraDeviceStopCamera
cameraDeviceDeinitCamera
cameraDeviceInitCamera
cameraDeviceGetVideoMode
viewport:
(left:-40.00, top:0.00, width:720.00, height:960.00)

(Filename: /Applications/buildAgent/work/842f9557127e852/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 34)

cameraDeviceSelectVideoMode
cameraDeviceStartCamera
2011-11-08 14:43:43.147 artest[5933:707] CameraImpl: setting focus mode 2 is not supported
2011-11-08 14:43:43.150 artest[5933:707] CameraImpl: setting torch mode 0 is not supported
startTracker
stopTracker
cameraDeviceStopCamera
cameraDeviceDeinitCamera
cameraDeviceInitCamera
cameraDeviceGetVideoMode
viewport:
(left:-40.00, top:0.00, width:720.00, height:960.00)

(Filename: /Applications/buildAgent/work/842f9557127e852/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 34)

cameraDeviceSelectVideoMode
cameraDeviceStartCamera
2011-11-08 14:43:44.598 artest[5933:707] CameraImpl: setting focus mode 2 is not supported
2011-11-08 14:43:44.601 artest[5933:707] CameraImpl: setting torch mode 0 is not supported
startTracker
stopTracker
cameraDeviceStopCamera
cameraDeviceDeinitCamera
cameraDeviceInitCamera
cameraDeviceGetVideoMode
viewport:
(left:-40.00, top:0.00, width:720.00, height:960.00)

(Filename: /Applications/buildAgent/work/842f9557127e852/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 34)

cameraDeviceSelectVideoMode
cameraDeviceStartCamera
2011-11-08 14:43:46.089 artest[5933:707] CameraImpl: setting focus mode 2 is not supported
2011-11-08 14:43:46.093 artest[5933:707] CameraImpl: setting torch mode 0 is not supported
startTracker
stopTracker
cameraDeviceStopCamera
[Switching to process 15619 thread 0x0]
[Switching to process 15619 thread 0x0]

Re: Crash when turning camera on and off

November 10, 2011 - 9:00pm #4

Could you possibly send us a project that exhibits this behavior? You can send to

.

Thanks!

- Kim

Re: Crash when turning camera on and off

November 10, 2011 - 2:18pm #3

Thanks for looking into this, sorry I didn't get back to you sooner. Your example is very similar to what I am doing; enabling and disabling the TrackerBehaviour. The problem seems to randomly appear depending on the project, as I have created other test projects and the problem did not happen in each project, but the projects where I had problems, it would consistently happen after only two or three times turning the camera on and off.

Here is a screenshot of what I see in Xcode when it crashes

Re: Crash when turning camera on and off

November 8, 2011 - 7:22pm #2

I'm testing this with a 4th Gen iPod Touch running 4.2.2, and can't seem to reproduce the issue. I started with the ImageTargets sample and added the following script to the ARCamera:

using UnityEngine;
using System.Collections;

// Attach this to the ARCamera
public class EnablerDisablerScript : MonoBehaviour
{
    void OnGUI ()
    {
        if (GUI.Button(new Rect(20,40,120,60), "disable tracker"))
        {
            TrackerBehaviour tracker =
                (TrackerBehaviour)UnityEngine.Object.FindObjectOfType(
                                                    typeof(TrackerBehaviour));
            
            tracker.enabled = false;
        }

        if (GUI.Button(new Rect(160,40,120,60), "enable tracker"))
        {
            TrackerBehaviour tracker =
                (TrackerBehaviour)UnityEngine.Object.FindObjectOfType(
                                                    typeof(TrackerBehaviour));
            
            tracker.enabled = true;
        }
    }
}

I toggled the TrackerBehaviour on and off a few dozen times, without issue. Are you doing something different here?

- Kim

Log in or register to post comments