Error de vista previa de la cámara: error de cola de búfer

I am trying to write an app that continuously takes pictures. I have an activity and a preview class. I figured it out using an AsyncTask clase.

private class CaptureTask extends AsyncTask<Boolean,Integer,Integer>
    {

        @Override
        protected Integer doInBackground(Boolean... arg0) {
            // TODO Auto-generated method stub
            while(running)
            {
                if(!takingPicture&&getPreviewState()&&!p.checkCamera())
                    takePicture();
                else if(!takingPicture&&!p.getPreviewState())
                    clearPic();
            }
            return picCounter;
        }
        protected void onPostExecute(Integer pics)
        {
            t.setText("Pics taken: "+pics);
        }

    }

This works fine on one device, a Motorola Droid running CM7. However, when I load it on my Samsung Epic running ACS 2.3.4, I get the following error continuously until I quit the app. There is no preview shown, just black.

11-08 11:42:28.207: ERROR/CameraHardwareSec(76): ERR(int android::CameraHardwareSec::previewThread()):overlay queueBuffer fail 11-08 11:42:28.238: ERROR/v4l2_utils(76): Error = Invalid argument from qbuf

I've tried looking for this issue but only found a few unresolved ones.

preguntado el 08 de noviembre de 11 a las 16:11

1 Respuestas

If you are trying to record video do not use

mediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH));

to set up your media recorder even if you are working with SDK >= 8

Do the usual instead:

mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);

And you will stop seeing

android::CameraHardwareSec::previewThread()):overlay queueBuffer fail

Source of this error is mismatch between size of default camera preview and MediaRecorder video size as the error disappears when you make the sizes same with:

CamcorderProfile camcorderProfile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
parameters.setPreviewSize(camcorderProfile.videoFrameWidth, camcorderProfile.videoFrameHeight);
mediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH));

Respondido 28 Feb 12, 04:02

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.