Android MediaMuxer illegalstateexception无法停止muxer mMediaMuxer.stop()

时间:2013-10-01 00:17:50

标签: android mp4 fatal-error mediacodec muxer

我在停止MediaMuxer时遇到问题。

除了我正在使用音频外,几乎一直跟着fadden's example,所以我不是100%确定音频和视频轨道排队。这可能是问题所在。

当我点击mMediaMuxer.stop()的断点时,我收到致命错误:

09-30 17:11:21.677: E/AndroidRuntime(32304): FATAL EXCEPTION: CaptureManager
09-30 17:11:21.677: E/AndroidRuntime(32304): java.lang.IllegalStateException: Failed to stop the muxer
09-30 17:11:21.677: E/AndroidRuntime(32304):    at android.media.MediaMuxer.nativeStop(Native Method)
09-30 17:11:21.677: E/AndroidRuntime(32304):    at android.media.MediaMuxer.stop(MediaMuxer.java:190)
09-30 17:11:21.677: E/AndroidRuntime(32304):    at com.harmonicprocesses.penelopefree.camera.MyMediaMux.stop(MyMediaMux.java:97)
09-30 17:11:21.677: E/AndroidRuntime(32304):    at com.harmonicprocesses.penelopefree.camera.CaptureManager.stopMuxer(CaptureManager.java:86)
09-30 17:11:21.677: E/AndroidRuntime(32304):    at com.harmonicprocesses.penelopefree.camera.MyMediaCodec.stop(MyMediaCodec.java:209)
09-30 17:11:21.677: E/AndroidRuntime(32304):    at com.harmonicprocesses.penelopefree.camera.MyMediaCodec.checkEOS(MyMediaCodec.java:190)
09-30 17:11:21.677: E/AndroidRuntime(32304):    at com.harmonicprocesses.penelopefree.camera.MyMediaCodec.runQue(MyMediaCodec.java:177)
09-30 17:11:21.677: E/AndroidRuntime(32304):    at com.harmonicprocesses.penelopefree.camera.MyMediaCodec.runQue(MyMediaCodec.java:182)
09-30 17:11:21.677: E/AndroidRuntime(32304):    at com.harmonicprocesses.penelopefree.camera.MyMediaCodec.sendEOS(MyMediaCodec.java:199)
09-30 17:11:21.677: E/AndroidRuntime(32304):    at com.harmonicprocesses.penelopefree.camera.CaptureManager$2.run(CaptureManager.java:94)
09-30 17:11:21.677: E/AndroidRuntime(32304):    at android.os.Handler.handleCallback(Handler.java:730)
09-30 17:11:21.677: E/AndroidRuntime(32304):    at android.os.Handler.dispatchMessage(Handler.java:92)
09-30 17:11:21.677: E/AndroidRuntime(32304):    at android.os.Looper.loop(Looper.java:137)
09-30 17:11:21.677: E/AndroidRuntime(32304):    at android.os.HandlerThread.run(HandlerThread.java:61)

当我调用stop时,我可以直接告诉MediaMuxer.mState = MUXER_STATE_INITIALIZED。但它在nativeStart(mNativeObject)中失败了......

if (mState == MUXER_STATE_INITIALIZED) {
    nativeStart(mNativeObject);
    mState = MUXER_STATE_STARTED;

1 个答案:

答案 0 :(得分:1)

我得到了完全相同的异常,对我来说问题是,我忘了在一个帖子中启动整个测试用例。