JakeWharton / Telecine

Record full-resolution video on your Android devices.
Apache License 2.0
2.47k stars 460 forks source link

MediaRecorder stop fails. #7

Open JakeWharton opened 9 years ago

JakeWharton commented 9 years ago
java.lang.RuntimeException: stop failed.
        at android.media.MediaRecorder.native_stop(MediaRecorder.java:-2)
        at android.media.MediaRecorder.stop(MediaRecorder.java:816)
        at com.jakewharton.telecine.RecordingSession.stopRecording(RecordingSession.java:214)
        at com.jakewharton.telecine.RecordingSession.access$200(RecordingSession.java:47)
        at com.jakewharton.telecine.RecordingSession$1.onStop(RecordingSession.java:115)
        at com.jakewharton.telecine.OverlayView$4.onClick(OverlayView.java:144)
        at android.view.View.performClick(View.java:4763)
        at android.view.View$PerformClick.run(View.java:19821)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:135)
        at android.app.ActivityThread.main(ActivityThread.java:5274)
        at java.lang.reflect.Method.invoke(Method.java:-2)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
1420825353847 D Attempting to acquire permission to screen capture.
1420825353939 D Acquired permission to screen capture. Starting service.
1420825353949 D Starting up!
1420825353988 D Adding overlay view to window.
1420825365120 D Starting screen recording...
1420825365122 D Video size: 100%
1420825365143 I Output file '/storage/emulated/0/Movies/Telecine/Telecine_2015-01-09-18-42-45.mp4'.
1420825365569 D Screen recording started.
1420825372006 D Stopping screen recording...
1420825372006 D Removing overlay view from window.
apiLevel
21
batteryLevel
0.38
brand
lge
charging
false
dpi
640
freeDisk
12074573824.0
freeMemory
237855864
jailbroken
false
locale
pl_PL
locationStatus
allowed
manufacturer
LGE
model
LG-D855
networkAccess
wifi
orientation
portrait
osBuild
LRX21R.A1417604035
osName
android
osVersion
5.0
screenDensity
4
screenResolution
2392x1440
time
2015-01-09T17:42:52Z
totalMemory
268435456
jaredsburrows commented 9 years ago

@JakeWharton How did you make this happen? Is this related to https://github.com/JakeWharton/Telecine/issues/6? How can I reproduce it? Have you seen this on any other devices other than the G3?

JakeWharton commented 9 years ago

This is from Bugsnag. I have never seen this.

jaredsburrows commented 9 years ago

@JakeWharton That is what I thought. I was wondering if there were anymore details. Why do you use Bugsnag vs Google Analytics? Easier setup?

JakeWharton commented 9 years ago

It's a vastly superior experience for integrating in the app and viewing/resolving crashes.

jaredsburrows commented 9 years ago

Alright, thanks for the fast reply.

mrahbar commented 9 years ago

I can confirm that. I get this error all the time and also reported it after the crash. I'm currently trying to debug RecordingSession but can't find anything suspicious. Every time recorder.stop() is called this is thrown RuntimeException: stop failed. Searching SO only reveals links to the docs stating: "Note that a RuntimeException is intentionally thrown to the application, if no valid audio/video data has been received when stop() is called."

My assumption is that the surface of which the MediaRecorder records is broken. Btw. I'm running CM12 Galaxy S3 but tested it also on a stock Nexus 7 (2012) each with Android 5 without success.

RazorPT commented 9 years ago

Just noticed that this bug happens on all emulators that i created, on my nexus 5 with lollipop 5.1 the code runs fine though.

I also read on SO that "RuntimeException is intentionally thrown to the application, if no valid audio/video data has been received when stop() is called" which raises the question what can be the cause of it?

@mrahbar stated that the app crashes on a nexus 7 (2012) and galaxy S3 which are outdated devices and for me it crashses on all emulator instances!

Maybe this bug happens on slower devices?

jaredsburrows commented 9 years ago

@RazorPT @mrahbar Have you guys pull the latest source and attempted to try to resolve the issue?

RazorPT commented 9 years ago

@jaredsburrows On emulator instances that i have tried when i tried to stop recording the first time the app crashes and then if i try to start recording sometimes the emulator will restart it self so i am not sure if it is reliable to debug on it since it seems the sdk is broken on the emulator.

I do have a samsung tablet with jelly bean that i will flash with cynogen lollipop to try to reproduce the bug i will report back once i do that.

mrahbar commented 9 years ago

Since my last pull the source didn't change, so I think the incompatibility remains. My recent testing still doesn't revel any more hints. A file on the sdcard is created though not readable and still the stop() issues. I have also a Samsung G4 but this is my 4.x testing device so I can't run Telecine on that. Sry can't help any further.

RazorPT commented 9 years ago

@mrahbar @jaredsburrows Great i just flashed my samsung tablet with cynogen 12.1 (Lollipop 5.1) and it crashes on prepare "Unable to prepare MediaRecorder" damn!

Edit: I used latest source :\

lumenghz commented 8 years ago
12-12 17:34:19.568 25673-25673/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                   Process: com.jakewharton.telecine.debug, PID: 25673
                                                   java.lang.RuntimeException: stop failed.
                                                       at android.media.MediaRecorder.stop(Native Method)
                                                       at com.jakewharton.telecine.RecordingSession.stopRecording(RecordingSession.java:269)
                                                       at com.jakewharton.telecine.RecordingSession.access$200(RecordingSession.java:57)
                                                       at com.jakewharton.telecine.RecordingSession$1.onStop(RecordingSession.java:142)
                                                       at com.jakewharton.telecine.OverlayView$4.onClick(OverlayView.java:159)
                                                       at android.view.View.performClick(View.java:4761)
                                                       at android.view.View$PerformClick.run(View.java:19767)
                                                       at android.os.Handler.handleCallback(Handler.java:739)
                                                       at android.os.Handler.dispatchMessage(Handler.java:95)
                                                       at android.os.Looper.loop(Looper.java:135)
                                                       at android.app.ActivityThread.main(ActivityThread.java:5310)
                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                       at java.lang.reflect.Method.invoke(Method.java:372)
                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)
                                                       at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:117)

It crashed when i click start recording button.But....i can't reproduce it.

valterh4ck3r commented 6 years ago

One fix ?