Question

I am having problems stopping the MediaMuxer.

Pretty much have followed fadden's example all the way, except I am using audio, so I am not 100% sure the audio and video tracks line up yet. This might be the problem.

When I hit the breakpoint for mMediaMuxer.stop() I get a fatal error:

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)

I can step into it far enough to tell MediaMuxer.mState = MUXER_STATE_INITIALIZED when I call stop. But it is failing in the nativeStart(mNativeObject) ...

if (mState == MUXER_STATE_INITIALIZED) {
    nativeStart(mNativeObject);
    mState = MUXER_STATE_STARTED;
Était-ce utile?

La solution

I got the exact same exception and for me the problem was, that I forgot to start the whole testcase in a thread.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top