Log in or register to post comments

QCAR in modal VC

October 19, 2011 - 2:34pm #1

For an app I'm working I display a modal view controller which shows my QCAR view. The app crashes quite a bit, especially when displaying the modal vc and starting up qcar or when dismissing and stopping QCAR. Should I be re-initing and loading the trackers every time I bring up the modal vc, not sure what the correct order of operations is. The most common crash I get is below:

Thread 2 name: Dispatch queue: com.qualcomm.QCAR.videoqueue
Thread 2 Crashed:
0 [MY APP NAME] 0x001bf4bc 0xbd000 + 1057980
1 [MY APP NAME] 0x0018ea68 0xbd000 + 858728
2 [MY APP NAME] 0x0018ecf0 0xbd000 + 859376
3 [MY APP NAME] 0x0018c19c 0xbd000 + 848284
4 [MY APP NAME] 0x0018c244 0xbd000 + 848452
5 [MY APP NAME] 0x001b2760 0xbd000 + 1005408
6 [MY APP NAME] 0x001b29e0 0xbd000 + 1006048
7 AVFoundation 0x31887364 __-[AVCaptureVideoDataOutput _AVCaptureVideoDataOutput_VideoDataBecameReady]_block_invoke_1 + 244
8 libdispatch.dylib 0x324e4d4e _dispatch_call_block_and_release + 6
9 libdispatch.dylib 0x324efccc _dispatch_queue_drain + 236
10 libdispatch.dylib 0x324efb66 _dispatch_queue_invoke$VARIANT$up + 30
11 libdispatch.dylib 0x324f076c _dispatch_worker_thread2 + 208
12 libsystem_c.dylib 0x3625f1c8 _pthread_wqthread + 288
13 libsystem_c.dylib 0x3625f09c start_wqthread + 0

Re: QCAR in modal VC

October 20, 2011 - 9:23am #5

Good idea, should call the init/load and deinit every time, or call init/load at when vc is opened for first time and call deinit when app closes.

Re: QCAR in modal VC

October 20, 2011 - 9:14am #4

Hi marchinram

If you have a manager class (appDelegate?) that can create and retain the viewController you will show modally, then dismissing the model view shouldn't destroy the VC. Then you can reuse it next time the modal view is popped up.

However, init and deinit should be fine if the example provided is followed. Perhaps you could try that example out to prove to yourself whether it works.

I can't remember without recreating it, but if you create a delay of around 0.5s between the 'onPause' and 'onDestroy' you may avoid the video capture frame overrun issue.

Re: QCAR in modal VC

October 20, 2011 - 8:14am #3

Thanks for response,
What do you mean by keep the VC around? When I dismiss the modal VC it destroys the modal VC, so the ar view gets destroyed aswell. The way I have been doing it now is that every time the AR VC is shown modally it will call the QCAR functions in this order:

QCAR::onSurfaceChanged(screenBounds.size.height, screenBounds.size.width);
QCAR::init() // until at 100
QCAR::Tracker::getInstance().load() // until at 100
[self configureVideoBackground]; // same as from demo

Then when the modal vc is dismissed it calls the function in this order:

Is this the right order of calls, also how can I not reinit and reload every time, is there a function to check if that is necessary? And the functions that seem to cause the most crashes are:


Re: QCAR in modal VC

October 20, 2011 - 2:39am #2

Remember not to reload your tracker as mentioned here:

See your other post for information about problems stopping the camera.

Log in or register to post comments