laurensius / andar

Automatically exported from code.google.com/p/andar
0 stars 1 forks source link

white screen on the milestone #12

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I attached a log of AndAR failing on the milestone. log not from me...just 
for  convenience.

Original issue reported on code.google.com by tdomhan on 27 Apr 2010 at 4:06

Attachments:

GoogleCodeExporter commented 8 years ago
i've found problems on other apps with the Nexus One having different preview 
sizes
than the one the app was trying to set. Thus the call to set the camera
parameters.setPreviewSize() failed. 

Maybe something similar with this bug?

Original comment by suzy...@gmail.com on 27 Apr 2010 at 5:14

GoogleCodeExporter commented 8 years ago
hi, suzyque.
Thanks for helping me with the bugs, I really appreciate that!! :D
when I set the preview size to something strange an Exception will occur. 
Nevertheless the 
Camera will work with its old preview size after all.
though this might be different on other devices, and probably I can't expect 
this to be the 
case. The problem is that there was no API for querying the available preview 
sizes before 
eclair.

The milestone does display a white screen even though setPreviewSize  was 
commented out. I 
attached the new log.

Original comment by tdomhan on 27 Apr 2010 at 5:47

Attachments:

GoogleCodeExporter commented 8 years ago
Alright I think I know what the problem is now:
 * The main View of AndAR is a GLSurfaceView
 * In order to display the camera video stream the byte array from the Camera get's converted to RGB and loaded as a 
texture. this texture is drawn upon a rectangle.
 * The Camera offers a method called "setPreviewDisplay"
 * This method takes a SurfaceHolder. It uses this Holder to draw each preview frame upon it. 
 * Because of that a camera video stream can be drawn upon a Surface with just a few method calls.
 * However, as we want to draw 3D objects we can not use this approach
 * You can register a callback, that will be called every time a new preview frame arrives.
 * The current approach is(as said) to take this byte array, transform it to a texture and display it on a 
GLSurfaceview. 
 * The camera in android is not designed to supply you a raw videostream
 * calling setPreviewDisplay is necessary before you start the preview
 * if you don't call setPreviewDisplay the preview callback will never be called, at least on a few phones, like the 
droid/milestone
 * the G1/N1 don't bother if you called setPreviewDisplay or not
 * So what if you call setPreviewDisplay and provide the holder of the glsurfaceview?
 * In Android 1.5: this actually works!! not only that but also it has to be done, otherwise the camera will raise an 
exception as you try to start the preview
 * In every other Android version: the application will freeze! this is probably because both the camera and the OpenGL 
thread try to draw something on the same surface

Ok I hope I could describe the problem.
In a nutshell:
 * camera.setPreviewDisplay  has to be called on some phones, in order to get the raw preview frame stream
 * the application will freeze if you call setPreviewDisplay  while using a GLSurfaceView

I currently don't know how to solve this!! Any help/ideas are welcome!

The camera API of Android kind of sucks. Why can't it just provide a raw 
stream? And why does it allocate a whole 
byte[width*height] array for every frame? 

Original comment by tdomhan on 29 Apr 2010 at 8:11

GoogleCodeExporter commented 8 years ago

Original comment by tdomhan on 29 Apr 2010 at 8:12

GoogleCodeExporter commented 8 years ago
could anyone try the attached version , and post the output of adb logcat?

Original comment by tdomhan on 30 Apr 2010 at 9:48

Attachments:

GoogleCodeExporter commented 8 years ago
Yay! This APK worked with N1 with SDK 2.1. I've attached the logcat. 

Also, I thought you might find this interesting reading.... 
http://nhenze.net/?p=349 

Thx for debugging

Original comment by suzy...@gmail.com on 30 Apr 2010 at 12:56

Attachments:

GoogleCodeExporter commented 8 years ago
alright, great news :D

Thanks for the link.. interesting. I hope the devs will implement this in some 
newer 
version of android, although this would break backward compatibility, as 
synchronization would be needed.

Original comment by tdomhan on 30 Apr 2010 at 3:43

GoogleCodeExporter commented 8 years ago
alright seems to work now, fixed by commit 117-120

Original comment by tdomhan on 30 Apr 2010 at 6:47

GoogleCodeExporter commented 8 years ago
HI,

I found some issues with Milestone with andriod 2.1 (Thailand release). I see 
the 
white  screen and it crashes the camera.. I need to reboot the phone to have 
the 
camera back. If I run first the ANDAR, see the whitescreen, close ANDAR open 
the 
camera soft.. I see a black where I should se the picture.
Hope this helps.

Regards,
Fernando.

Original comment by friba...@gmail.com on 7 May 2010 at 1:59

GoogleCodeExporter commented 8 years ago
Hi  tdomhan,Can you put the part of your ,which You explain how to 
write(Comment 3)

Original comment by addavi...@gmail.com on 17 Sep 2010 at 3:28