Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeatedly Creating RtspServerStream and Encountering 'Create VideoEncoder failed' Issue #1471

Open
Mett-Barr opened this issue May 6, 2024 · 1 comment

Comments

@Mett-Barr
Copy link

Hello, my current requirement involves creating independently managed RtspServerStreams in different scenarios. Initially, the first eight creations and usages of the streams went without any issues. However, issues start occurring from the ninth creation onwards. Each time I use it after that, and especially when calling prepareVideo(), I encounter the following problems:

2024-05-06 11:26:52.272 VideoEncoder             I  3 encoders found
2024-05-06 11:26:52.272 VideoEncoder             I  Encoder OMX.MTK.VIDEO.ENCODER.AVC
2024-05-06 11:26:52.272 VideoEncoder             I  Color supported: 2130706944
2024-05-06 11:26:52.273 VideoEncoder             I  Color supported: 2130708361
2024-05-06 11:26:52.273 VideoEncoder             I  Encoder selected OMX.MTK.VIDEO.ENCODER.AVC
2024-05-06 11:26:52.279 OMXClient                I  IOmx service obtained
2024-05-06 11:26:52.279 ACodec                   E  Unable to instantiate codec 'OMX.MTK.VIDEO.ENCODER.AVC' with err 0xfffffff4.
2024-05-06 11:26:52.279 ACodec                   E  signalError(omxError 0xfffffff4, internalError -12)
2024-05-06 11:26:52.280 MediaCodec               E  Codec reported err 0xfffffff4, actionCode 0, while in state 1
2024-05-06 11:26:52.288 MediaCodec-JNI           W  try to release MediaCodec from JMediaCodec::~JMediaCodec()...
2024-05-06 11:26:52.288 MediaCodec-JNI           W  done releasing MediaCodec from JMediaCodec::~JMediaCodec().
2024-05-06 11:26:52.290 VideoEncoder             E  Create VideoEncoder failed.
                                                    android.media.MediaCodec$CodecException: Failed to initialize OMX.MTK.VIDEO.ENCODER.AVC, error 0xfffffff4
                                                    	at android.media.MediaCodec.native_setup(Native Method)
                                                    	at android.media.MediaCodec.<init>(MediaCodec.java:1864)
                                                    	at android.media.MediaCodec.createByCodecName(MediaCodec.java:1842)
                                                    	at com.pedro.encoder.video.VideoEncoder.prepareVideoEncoder(VideoEncoder.java:108)
                                                    	at com.pedro.library.base.StreamBase.prepareVideo(StreamBase.kt:115)
                                                    	at com.pedro.library.base.StreamBase.prepareVideo$default(StreamBase.kt:103)

2024-05-06 11:26:52.290 VideoEncoder             I  stopped
2024-05-06 11:26:52.290 AudioEncoder             I  stopped
2024-05-06 11:26:52.297 AudioEncoder             I  2 encoders found
2024-05-06 11:26:52.297 AudioEncoder             I  Encoder selected c2.android.aac.encoder
2024-05-06 11:26:52.300 CCodec                   D  allocate(c2.android.aac.encoder)
2024-05-06 11:26:52.303 CCodec                   I  Created component [c2.android.aac.encoder]

I've attempted to call stopPreview() and stopRecord() after closing the previous RtspServerStream (as calling stopStream() and release() leads to crashes currently). However, I still face the 'Create VideoEncoder failed' issue. Could there be a step that I'm missing? Thank you for your help.

@pedroSG94
Copy link
Owner

Hello,

Are you calling release method when RtspServerStream is not needed anymore?

rtspServerStream.release()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants