Whenever i try to run this code on samsung cynogen 12.1 (5.1 lollipop) or on the emulator i always get this exception which seems to be cased by some problems with the timestamps:
E/MPEG4Writer﹕ timestampUs 126037 < lastTimestampUs 266235 for Video track
04-17 11:43:28.597 6475-6502/net.yrom.screenrecorder I/ScreenRecorder﹕ dequeue output buffer index=-1
04-17 11:43:28.597 6475-6502/net.yrom.screenrecorder D/ScreenRecorder﹕ retrieving buffers time out!
04-17 11:43:28.618 6475-6502/net.yrom.screenrecorder I/ScreenRecorder﹕ dequeue output buffer index=-1
04-17 11:43:28.618 6475-6502/net.yrom.screenrecorder D/ScreenRecorder﹕ retrieving buffers time out!
04-17 11:43:28.629 6475-6502/net.yrom.screenrecorder I/ScreenRecorder﹕ dequeue output buffer index=3
04-17 11:43:28.629 6475-6502/net.yrom.screenrecorder D/ScreenRecorder﹕ got buffer, info: size=115, presentationTimeUs=9115790746, offset=0
04-17 11:43:28.630 6475-6508/net.yrom.screenrecorder E/MPEG4Writer﹕ timestampUs 126037 < lastTimestampUs 266235 for Video track
04-17 11:43:28.716 6475-6502/net.yrom.screenrecorder D/MPEG4Writer﹕ Video track stopping
04-17 11:43:28.716 6475-6502/net.yrom.screenrecorder D/MPEG4Writer﹕ Video track source stopping
04-17 11:43:28.716 6475-6502/net.yrom.screenrecorder D/MPEG4Writer﹕ Video track source stopped
04-17 11:43:28.716 6475-6502/net.yrom.screenrecorder D/MPEG4Writer﹕ Stopping writer thread
04-17 11:43:28.716 6475-6507/net.yrom.screenrecorder D/MPEG4Writer﹕ 0 chunks are written in the last batch
04-17 11:43:28.717 6475-6502/net.yrom.screenrecorder D/MPEG4Writer﹕ Writer thread stopped
04-17 11:43:28.720 6475-6502/net.yrom.screenrecorder E/AndroidRuntime﹕ FATAL EXCEPTION: ScreenRecorder
Process: net.yrom.screenrecorder, PID: 6475
java.lang.IllegalStateException: Failed to stop the muxer
at android.media.MediaMuxer.nativeStop(Native Method)
at android.media.MediaMuxer.stop(MediaMuxer.java:225)
at net.yrom.screenrecorder.ScreenRecorder.release(ScreenRecorder.java:200)
at net.yrom.screenrecorder.ScreenRecorder.run(ScreenRecorder.java:100)
Whenever i try to run this code on samsung cynogen 12.1 (5.1 lollipop) or on the emulator i always get this exception which seems to be cased by some problems with the timestamps:
E/MPEG4Writer﹕ timestampUs 126037 < lastTimestampUs 266235 for Video track