Wednesday, March 9, 2011

[android-developers] Re: Camera startPreview() failed on Nexus S with Gingerbread

Thanks Mark.
I'll compare my code with yours, to understand where the problem is.

On 8 Mar, 15:17, Mark Murphy <mmur...@commonsware.com> wrote:
> The Nexus S works just fine with camera previews. See:
>
> https://github.com/commonsguy/cw-advandroid/tree/master/Camera/Previewhttps://github.com/commonsguy/cw-advandroid/tree/master/Camera/Picture
>
> The first one is just preview, working with the default camera. The
> second one also takes pictures and will use the FFC on Android 2.3 and
> newer devices (if there is an FFC), otherwise it will use the default
> camera.
>
>
>
>
>
> On Tue, Mar 8, 2011 at 9:07 AM, Paolo <brand...@gmail.com> wrote:
> > I guess the problem is that Nexus S has two cameras (front and back).
> > With Froyo I can't manage this situation. I expect that Android use
> > the back one without problem with the same code I use for Froyo,
>
> > The startPreview() faild and I don't undestrand why.
>
> > If I run the same app on a Nexus One with Gingerbread installed, it
> > works fine... I suppose because N1 has only one camera.
>
> > Please help me!
>
> > Paolo
>
> > On 7 Mar, 18:00, Paolo <brand...@gmail.com> wrote:
> >> Hi there!
> >> I've tested my app developed with SDK 2.2 as target on a Nexus S with
> >> Gingerbread. All it goes ok, except the activity that uses the Camera
> >> hardware to take pictures.
> >> I don't know what's wrong... :(
> >> Is there anyone who has had the same problem? Please help me!
>
> >> Thanks in advance!
>
> >> This is my logcat:
>
> >> 03-07 17:47:04.457: ERROR/SecCamera(75): ERR(int
> >> android::fimc_v4l2_reqbufs(int, v4l2_buf_type, int)):VIDIOC_REQBUFS
> >> failed
> >> 03-07 17:47:04.457: ERROR/SecCamera(75): int
> >> android::SecCamera::startPreview()::828 fail. errno: Out of memory,
> >> m_camera_id = 0
> >> 03-07 17:47:04.457: ERROR/CameraHardwareSec(75): ERR(virtual
> >> android::status_t android::CameraHardwareSec::startPreview()):Fail on
> >> mSecCamera->startPreview()
> >> 03-07 17:47:04.460: DEBUG/AndroidRuntime(793): Shutting down VM
> >> 03-07 17:47:04.460: WARN/dalvikvm(793): threadid=1: thread exiting
> >> with uncaught exception (group=0x40015560)
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793): FATAL EXCEPTION: main
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):
> >> java.lang.RuntimeException: startPreview failed
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):     at
> >> android.hardware.Camera.startPreview(Native Method)
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):     at
> >> it.visitotuscany.CameraActivity.surfaceChanged(CameraActivity.java:
> >> 330)
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):     at
> >> android.view.SurfaceView.updateWindow(SurfaceView.java:549)
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):     at
> >> android.view.SurfaceView.dispatchDraw(SurfaceView.java:348)
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):     at
> >> android.view.ViewGroup.drawChild(ViewGroup.java:1644)
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):     at
> >> android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):     at
> >> android.view.ViewGroup.drawChild(ViewGroup.java:1644)
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):     at
> >> android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):     at
> >> android.view.View.draw(View.java:6883)
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):     at
> >> android.widget.FrameLayout.draw(FrameLayout.java:357)
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):     at
> >> android.view.ViewGroup.drawChild(ViewGroup.java:1646)
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):     at
> >> android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):     at
> >> android.view.View.draw(View.java:6883)
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):     at
> >> android.widget.FrameLayout.draw(FrameLayout.java:357)
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):     at
> >> com.android.internal.policy.impl.PhoneWindow
> >> $DecorView.draw(PhoneWindow.java:1862)
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):     at
> >> android.view.ViewRoot.draw(ViewRoot.java:1522)
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):     at
> >> android.view.ViewRoot.performTraversals(ViewRoot.java:1258)
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):     at
> >> android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):     at
> >> android.os.Handler.dispatchMessage(Handler.java:99)
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):     at
> >> android.os.Looper.loop(Looper.java:123)
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):     at
> >> android.app.ActivityThread.main(ActivityThread.java:3683)
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):     at
> >> java.lang.reflect.Method.invokeNative(Native Method)
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):     at
> >> java.lang.reflect.Method.invoke(Method.java:507)
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):     at
> >> com.android.internal.os.ZygoteInit
> >> $MethodAndArgsCaller.run(ZygoteInit.java:839)
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):     at
> >> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
> >> 03-07 17:47:04.468: ERROR/AndroidRuntime(793):     at
> >> dalvik.system.NativeStart.main(Native Method)
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscribe@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android Training Worldwide:http://commonsware.com/training

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment