rtsp-client-android
rtsp-client-android copied to clipboard
After few minutes streams gets stops and app force close.
After few minutes streams gets stops and app force close.
2021-01-23 19:41:43.355 31496-31550/com.alexvas.rtsp.demo E/AndroidRuntime: FATAL EXCEPTION: Thread-4 Process: com.alexvas.rtsp.demo, PID: 31496 java.lang.IllegalStateException at android.media.MediaCodec.native_dequeueInputBuffer(Native Method) at android.media.MediaCodec.dequeueInputBuffer(MediaCodec.java:2786) at com.alexvas.rtsp.demo.decode.VideoDecodeThread.run(VideoDecodeThread.kt:31)
above exception is appear at bellow code in VideoDecodeThread
val inIndex: Int = decoder.dequeueInputBuffer(10000L)
This is not a library issue. This is demo app issue. I will check that.
Yeah ok.
Any answers about this issue, @alexeyvasilyev ? I'm facing the same issue...
@LeandroVanolli What Android device? What RTSP camera model? Have you tried to reboot Android device?
Hello @alexeyvasilyev-wyze . Thank you for replying.
I realized that streaming does not stop on its own, but stops when the wi-fi connection becomes unstable. At first, I can see packet loss causing some delay in streaming, and sometimes the streaming stops, and it doesn't work anymore until we stop streaming by clicking "stop" and "start" again. I want to know how to prevent the permanent streming stop caused by an unstable connection. Maybe if some method is called when that happens, I can make the app restart streaming from that method.
Thank you!
@alexeyvasilyev I'm testing the app trying to find out the issue. Below you can see that the frames can't be pushed to the queue because the queue is full, At the same time, the decoder doesn't has any frame to decode.

As I said before, it happens easily when the connection becomes unstable. Sometimes, the app stops the decoder thread and needs to be restarted, and this way is ok, because the user will know this information by a toast.
I'm trying to solve, but I don't have enought experience in Kotlin and Android programming.
Any news about the issue? @alexeyvasilyev Are you working on it?
No news.
W/System.err: java.lang.IllegalStateException at android.media.MediaCodec.native_dequeueInputBuffer(Native Method) at android.media.MediaCodec.dequeueInputBuffer(MediaCodec.java:2319) at com.alexvas.rtsp.demo.decode.VideoDecodeThread.run(VideoDecodeThread.kt:38) java.lang.IllegalStateException at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method) at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:2379) at com.alexvas.rtsp.demo.decode.VideoDecodeThread.run(VideoDecodeThread.kt:71) E/AndroidRuntime: FATAL EXCEPTION: Thread-4683 Process: com.alexvas.rtsp.demo, PID: 24368 java.lang.IllegalStateException at android.media.MediaCodec.native_stop(Native Method) at android.media.MediaCodec.stop(MediaCodec.java:1901) at com.alexvas.rtsp.demo.decode.VideoDecodeThread.run(VideoDecodeThread.kt:98)
line : val outIndex = decoder.dequeueOutputBuffer(bufferInfo, 9000) where it throws error!
so the connections keeps on dropping again and again and when you keep trying to reconnect it throws this error
Hey, Hi The Stream keeps getting disconnected frequently and throws this error
W/System.err: java.net.SocketTimeoutException at java.net.PlainSocketImpl.read(PlainSocketImpl.java:484) at java.net.PlainSocketImpl.-wrap0(PlainSocketImpl.java) at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:237) at com.alexvas.utils.NetUtils.readData(NetUtils.java:229) at com.alexvas.rtsp.RtspClient.readRtpData(RtspClient.java:586) at com.alexvas.rtsp.RtspClient.execute(RtspClient.java:495) W/System.err: at com.alexvas.rtsp.demo.ui.live.LiveFragment$RtspThread.run(LiveFragment.kt:334) E/LiveFragment: onRtspFailed(message="null")
and also in between MediaCodec.INFO_TRY_AGAIN_LATER -> if (DEBUG) Log.d(TAG, "No output from decoder available") No output from decoder available No output from decoder available No output from decoder available even when the stream is active and streaming, the app keeps throwing those two errors
Any news on this? This is a serious issue. I just tried a temporary fix which is increate timeout from default value (5000) to 10000 which made it little stable. Change timeout value timeout=10000; line no 75 NetUtils.java