开发者

android camera error 100

For my project I am using MediaRecorder to record video.

This code is working on most of the devices, but in HTC Desire (with Android 2.3), when I call recorder.start(); it's throwing ERROR/Camera(25146): Error 100. Is anybody has any clue how to solve it?

My code is like this:

 Camera camera = Camera.open();

 Parameters parameters = camera.getParameters();

 if (flash) {
        parameters.setFlashMode(Parameters.FLASH_MODE_TORCH);
 }
 else {
    parameters.setFlashMode(Parameters.FLASH_MODE_OFF);
 }
 camera.setParameters(parameters);
 try {
    camera.setPreviewDisplay(holder);
 } catch (IOException e1) {
    e1.printStackTrace();
 }
 camera.startPreview();
 camera.unlock();

 recorder = new MediaRecorder();
 recorder.setCamera(camera);

 am = (AudioManager) context.getSystemService(Activity.AUDIO_SERVICE);
 am.setMode(AudioManager.STREAM_VOICE_CALL);
 am.startBluetoothSco();

 try {
        recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
        if(android.os.Build.VERSION.SDK_INT>=8){
            recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
            CamcorderProfile cp = CamcorderProfile.get(CamcorderProfile.QUALITY_LOW);
            recorder.setProfile(cp);
        }
        else{
            recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
            recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
            recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
            recorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
                recorder.setVideoSize(CIF_WIDTH, CIF_HEIGHT);
                recorder.setVideoFrameRate(FRAME_RATE);
        }
        recorder.setMaxDuration(maxduration*1000);
        recorder.setPreviewDisplay(holder.getSurface());

    String data_folder=Environment.getExternalStorageDirectory().getAbsolutePath() + settings.location_in_sdcard;

            File ff=new File(data_folder);
        if(!ff.exists()){
            ff.mkdirs();
        }

            String path = data_folder+api.getCurrentTimeStamp()+".3gp";

        recorder.setOutputFile(path);

            try{
            recorder.prepare();
        }
            catch (Exception ee) {
            ee.printStackTrace();
        }
    }
catch (Exception e) {
    Log.e("ls", e.toString(), e);
} 

    recorder.start();

Log Report:

    09-27 18:11:37.358: ERROR/StagefrightRecorder(24740): Failed to set frame rate to 30 fps. The actual frame rate is 15
    09-27 18:11:37.478: ERROR/QualcommCameraHardware(24740): frames in busy Q = 0
    09-27 18:11:37.478: ERROR/QualcommCameraHardware(24740): frames in busy Q = 0 after deq and add to freeQ
    09-27 18:11:37.478: ERROR/OMXNodeInstance(24740): OMX_UseBuffer failed with error -2147479547 (0x80001005)
    09-27 18:11:37.478: ERROR/OMXCodec(24740): allocate_buffer_with_backup failed
    09-27 18:11:37.478: ERROR/OMXCodec(24740): [ 09-27 18:11:37.478 24740:0x60a8 F/OMXCodec ]
    09-27 18:11:37.478: ERROR/OMXCodec(24740): frameworks/base/media/libstagefright/OMXCodec.cpp:1863 err != OK
    09-27 18:11:38.679: ERROR/Camera(25146): Error 100
    09-27 18:11:40.121: ERRO开发者_如何学运维R/AudioService(1335): Media server died.
    09-27 18:11:41.242: ERROR/OverlayLIB(1335): Error parameters for screen direction is not correct
    09-27 18:11:41.292: ERROR/OverlayLIB(1335): Error parameters for screen direction is not correct
    09-27 18:11:41.362: ERROR/OverlayLIB(1335): Error parameters for screen direction is not correct
    09-27 18:11:41.402: ERROR/OverlayLIB(1335): Error parameters for screen direction is not correct
    09-27 18:11:41.422: ERROR/OverlayLIB(1335): Error parameters for screen direction is not correct
    09-27 18:11:41.442: ERROR/OverlayLIB(1335): Error parameters for screen direction is not correct
    09-27 18:11:41.452: ERROR/OverlayLIB(1335): Error parameters for screen direction is not correct
    09-27 18:11:41.472: ERROR/OverlayLIB(1335): Error parameters for screen direction is not correct
    09-27 18:11:41.532: ERROR/OverlayLIB(1335): Error parameters for screen direction is not correct
    09-27 18:11:41.702: ERROR/OverlayLIB(1335): Error parameters for screen direction is not correct
    09-27 18:11:41.722: ERROR/OverlayLIB(1335): Error parameters for screen direction is not correct
    09-27 18:11:41.732: ERROR/OverlayLIB(1335): Error parameters for screen direction is not correct
    09-27 18:11:41.752: ERROR/OverlayLIB(1335): Error parameters for screen direction is not correct
    09-27 18:11:41.762: ERROR/Overlay(1335): connect to socket failed
    09-27 18:11:44.285: ERROR/HTC Acoustic(25182): ioctl ACOUSTIC_UPDATE_ADIE failed -1
    09-27 18:11:44.285: ERROR/HTC Acoustic(25182): ioctl ACOUSTIC_UPDATE_ADIE failed -1
    09-27 18:11:44.285: ERROR/HTC Acoustic(25182): ioctl ACOUSTIC_UPDATE_ADIE failed -1
    09-27 18:11:44.305: ERROR/HTC Acoustic(25182): failed to open A2051 CSV files /system/etc/TPA2051_CFG.csv.
    09-27 18:11:44.305: ERROR/AudioHardwareMSM7X30(25182): set_tpa2051_parameters fail
    09-27 18:11:44.305: ERROR/AudioHardwareMSM7X30(25182): set_aic3254_parameters failed
    09-27 18:11:44.315: ERROR/AudioPolicyManagerBase(25182): mSupportBacMic = 0
    09-27 18:11:45.626: ERROR/AudioService(1335): Media server started.
    09-27 18:12:42.191: ERROR/HtcLockScreen2.0(1335): MusicCtrl: updateImage~ exception:null
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜