Zatrzymanie urządzenia multimedialnego w systemie Android nie powiodło się

Stawiałem czoła bardzo dziwnemu zachowaniu: czasami mój mediarecorder ulega awarii z błędem „Stop failed” i czasami działa dobrze. Czy jest moja wina, czy jest to błąd systemu? Nie mogę zrozumieć, co jest nie tak.

<code>private void stopRecording(){
        ticker.cancel();
        ticker.purge();

        recorder.stop();

        startBtn.setText("Start");
        recordInProcess = false;

        markList = locWriteTask.getMarkArray();

    mCamera.lock();
        recorder.release();
    }

 private void startRecording(){

         startBtn.setText("Stop");

         recordInProcess = true;

             recorder = new MediaRecorder();

         mCamera.unlock();
         recorder.setCamera(mCamera);

         recorder.setPreviewDisplay(mSurfaceHolder.getSurface());
         recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
         recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
         recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
         recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
         recorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
         recorder.setMaxDuration((int) 10000000); 
         recorder.setVideoSize(320, 240); 
         recorder.setVideoFrameRate(15); 
         recorder.setOutputFile(FULL_PATH_TO_LOCAL_FILE + counter + MP4);

         try{
             recorder.prepare();
         } catch (Exception e){
             finish();
         }

         lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, ll);

         ticker = new Timer();
         locWriteTask = new WriteTimeLocationTimerTask(ll);
         ticker.schedule(locWriteTask, 0, DELAY);   

         recorder.start();
    }
</code>

questionAnswers(4)

yourAnswerToTheQuestion