lassana / continuous-audiorecorder

Implementation of the missing feature in Android SDK: audio recorder with a pause.
BSD 2-Clause "Simplified" License
147 stars 51 forks source link

Stop failed when click quickly to record and pause #5

Open loikfb opened 8 years ago

loikfb commented 8 years ago

Here's my stack Trace :

11-30 16:27:20.674 2436-3017/com. E/MediaRecorder: stop failed: -1007 11-30 16:27:20.675 2436-2436/com. W/System.err: java.lang.RuntimeException: stop failed. 11-30 16:27:20.675 2436-2436/com.W/System.err: at android.media.MediaRecorder.stop(Native Method) 11-30 16:27:20.675 2436-2436/com. W/System.err: at com.github.lassana.recorder.AudioRecorder$PauseRecordTask.doInBackground(AudioRecorder.java:125) 11-30 16:27:20.675 2436-2436/com. W/System.err: at com.github.lassana.recorder.AudioRecorder$PauseRecordTask.doInBackground(AudioRecorder.java:117) 11-30 16:27:20.675 2436-2436/com.W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:295) 11-30 16:27:20.675 2436-2436/com.W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237) 11-30 16:27:20.675 2436-2436/com. W/System.err: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 11-30 16:27:20.675 2436-2436/com. W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 11-30 16:27:20.675 2436-2436/com. W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 11-30 16:27:20.675 2436-2436/com. W/System.err: at java.lang.Thread.run(Thread.java:818)

dougouk commented 7 years ago

Is it this about this possibly?

Note that a RuntimeException is intentionally thrown to the application, if no valid audio/video data has been received when stop() is called. This happens if stop() is called immediately after start(). The failure lets the application take action accordingly to clean up the output file (delete the output file, for instance), since the output file is not properly constructed when this happens.

lassana commented 7 years ago

@dougouk I think -1007 code means that there something wrong with recording configuration (e.g. the device doesn't support it).

anonym24 commented 6 years ago

@dougouk not necessarily 50% you could do something wrong 50% MediaRecord is just buggy: https://stackoverflow.com/questions/51332386/mediarecorder-and-videosource-surface-stop-failed-1007-a-serious-android-bug