Kickflip / kickflip-android-sdk

Kickflip Android SDK - Live Video Streaming to the Cloud
https://kickflip.io
Apache License 2.0
660 stars 212 forks source link

i meet some exception #59

Open woniu0936 opened 8 years ago

woniu0936 commented 8 years ago

java.lang.IllegalStateException at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method) at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:1036) at com.gouhuoapp.camerarecord.video.AndroidEncoder$override.drainEncoder(AndroidEncoder.java:86) at com.gouhuoapp.camerarecord.video.AndroidEncoder$override.access$dispatch(AndroidEncoder.java) at com.gouhuoapp.camerarecord.video.AndroidEncoder.drainEncoder(AndroidEncoder.java:0) at com.gouhuoapp.camerarecord.video.CameraEncoder.handleFrameAvailable(CameraEncoder.java:497) at com.gouhuoapp.camerarecord.video.CameraEncoder.access$100(CameraEncoder.java:28) at com.gouhuoapp.camerarecord.video.CameraEncoder$EncoderHandler.handleMessage(CameraEncoder.java:913) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at com.gouhuoapp.camerarecord.video.CameraEncoder.run(CameraEncoder.java:676) at java.lang.Thread.run(Thread.java:818)

woniu0936 commented 8 years ago

in MediaCodec,i find below: /* * Dequeue an output buffer, block at most "timeoutUs" microseconds. * Returns the index of an output buffer that has been successfully * decoded or one of the INFO* constants. * @param info Will be filled with buffer meta data. * @param timeoutUs The timeout in microseconds, a negative timeout indicates "infinite". * @throws IllegalStateException if not in the Executing state, * or codec is configured in asynchronous mode. * @throws MediaCodec.CodecException upon codec error. / @OutputBufferInfo public final int dequeueOutputBuffer( @NonNull BufferInfo info, long timeoutUs) { int res = native_dequeueOutputBuffer(info, timeoutUs); synchronized(mBufferLock) { if (res == INFO_OUTPUT_BUFFERSCHANGED) { cacheBuffers(false / input /); } else if (res >= 0) { validateOutputByteBuffer(mCachedOutputBuffers, res, info); if (mHasSurface) { mDequeuedOutputInfos.put(res, info.dup()); } } } return res; }

woniu0936 commented 8 years ago

IllegalStateException if codec is configured in asynchronous mode??in VideoEncoderCore you say “This class is not thread-safe, with one exception: it is valid to use the input surface on one thread, and drain the output on a different thread.”

woniu0936 commented 8 years ago

It's really nice if you can help check it.