rtsp-client-android icon indicating copy to clipboard operation
rtsp-client-android copied to clipboard

W/FrameQueue: Cannot add frame, queue is full

Open ligeirow opened this issue 3 years ago • 16 comments

W/FrameQueue: Cannot add frame, queue is full

app run but stop in 6 seconds

D/EGL_emulation: app_time_stats: avg=18.24ms min=3.35ms max=108.95ms count=38 W/System: A resource failed to call close. D/BufferPoolAccessor2.0: bufferpool2 0x7b75ffe54dd8 : 4(25165824 size) total buffers - 4(25165824 size) used buffers - 0/4 (recycle/alloc) - 4/69 (fetch/transfer) D/BufferPoolAccessor2.0: evictor expired: 1, evicted: 1 D/CCodecBuffers: [c2.goldfish.h264.decoder#383:1D-Input.Impl[N]] codec released a buffer owned by client (index 1) W/CCodec: [c2.goldfish.h264.decoder] previous call to queue exceeded timeout E/MediaCodec: Codec reported err 0x80000000/UNKNOWN_ERROR, actionCode 0, while in state 6/STARTED E/VideoDecodeThread: RTSP video thread [192.168.1.174:554] stopped due to 'null'

ligeirow avatar Aug 13 '22 15:08 ligeirow

is there any solution regarding can not add frame,queue is full

humayoonsiddiqui avatar Oct 07 '22 07:10 humayoonsiddiqui

Any solution for above issue?

bhavikpokar1993 avatar Nov 17 '22 08:11 bhavikpokar1993

yes i added

humayoonsiddiqui avatar Nov 17 '22 08:11 humayoonsiddiqui

@humayoonsiddiqui did you manage this issue?

SFocus avatar May 01 '23 19:05 SFocus

make sure you call RtspSurfaceView.start() method in onViewCreated() rather than in onCreateView() if use it in a fragment, and after checking if (!view.isStarted()). that was my problem. hope it helps

BarrelOfTea avatar May 23 '23 14:05 BarrelOfTea

@BarrelOfTea I do everything as you wrote, but after some time of the application, for example, 4-5 minutes, I get in the logs FrameQueue: Cannot add frame, queue is full

And the picture freezes.

SFocus avatar May 23 '23 16:05 SFocus

@alexeyvasilyev I understood what the problem was. Some streams send too many frames. One frame is small, another is large. A large frame takes about 100 milliseconds to process. During this time, several frames are added to the queue. And it turns out that the library does not have time to process all the frames. Hence the delay and then the queue overflow.

But I don't know how to solve this problem yet.

SFocus avatar May 24 '23 19:05 SFocus

@SFocus, by large frames, do you mean the resolution is too high? If there is an original app for your camera, maybe you could try setting a lower resolution in it, and then launching your app again

BarrelOfTea avatar May 25 '23 01:05 BarrelOfTea

@BarrelOfTea I tried changing the resolution but it doesn't work. https://rtsp.stream/ here you can create a free account and there will be 2 streams. One is a cartoon that plays normally, the other stream does not work with this application.

SFocus avatar May 25 '23 08:05 SFocus

@SFocus, I have looked into the code of the library and noticed an interesting thing: in FrameQueue class (here), "Cannot add frame, queue is full" is shown not only in the push() method when it tries to put a frame into queue and there is no room for it, but also in the pop() method, when there is an InterruptedException. Seems like the author forgot to change the message for a different exception. So maybe the problem lies not in a queue being full, but in a thread being interrupted. I suggest you try copying the module rather than adding it into Gradle dependencies (so that it is a part of you code and you can modify it) and change the message for InterruptedException in the pop() method to see what is actually a problem in your case.

BarrelOfTea avatar May 28 '23 05:05 BarrelOfTea

@BarrelOfTea I saw that, but that's clearly not the problem. I have already tried to change the code myself and fix the problem. But so far, I have made a solution based on GStreamer library and it works great.

SFocus avatar Jun 03 '23 07:06 SFocus

@SFocus , may I know how you use the library in you project? I am working on app that reads video from RTSP and converts output into a series of bitmaps. Currently I am facing the same "cant add frame queue is full" issue, and I was wondering whether GStream could suit my purposes too.

BarrelOfTea avatar Jun 03 '23 09:06 BarrelOfTea

@BarrelOfTea I'm working on playing a local stream where I need minimal latency.

SFocus avatar Jun 07 '23 09:06 SFocus

Most probably issue is fixed in 2.0.9 just released

alexeyvasilyev avatar Jul 01 '23 16:07 alexeyvasilyev

Good day issue is not resolved as of version [2.0.11], the video would play ok for a few minutes but would randomly give the error "FrameQueue: Cannot add frame, queue is full" the timing for the error is never consistent so I am not sure what triggers it. Increasing the size of the the videoFrameQueue does not do much. Tried removing the last frames from the queue when the limit is reached but the video feed still remains frozen. I guess the issue here is how to safely handle "full queues" even if some frames have to be dropped.

Vane101 avatar Aug 16 '23 17:08 Vane101

Are there any solutions to this problem yet? i also have the problem, that my image freezes after a while and the log is full with this specific error message. Could it be possible because i'm running it in an emulator?

schmoizz avatar Dec 12 '23 13:12 schmoizz