openh264 icon indicating copy to clipboard operation
openh264 copied to clipboard

Decoder picture queue ran out of space

Open kawan-test opened this issue 8 months ago • 11 comments

When I test an use case of playback received frames on my target from remote rtsp streaming server, the decoder picture queue ran out of space. The error is below Error:DecodeCurrentAccessUnit()::::::PrefetchPic ERROR, pSps->iNumRefFrames:4. Info:ResetDecoder(), context error code is 16384

static inline int32_t GetTargetRefListSize (PWelsDecoderContext pCtx) { ... } else { iNumRefFrames = pCtx->pSps->iNumRefFrames + 2; ...

In my test case, the iNumRefFrames =4, so the queue size is 6.

There is a comment in WelsRequestMem() saying that the queue size will be pSps->iNumRefFrames x 2.

iPicQueueSize = GetTargetRefListSize (pCtx); // adaptive size of picture queue, = (pSps->iNumRefFrames x 2)

I increased the queue size with the formula pCtx->pSps->iNumRefFrames * 2, the queue size is 8 in my case and the issue disappeared .

So the comment and actual code does not match. Should we use pCtx->pSps->iNumRefFrames * 2? Or can we increase the buffer size like iNumRefFrames = pCtx->pSps->iNumRefFrames + 4;

I am using QNX in my test target. h264 version is 2.4.1.

kawan-test avatar Apr 08 '25 21:04 kawan-test

If you could provide sample video which can reproduce the issue, it would help.

tyan0 avatar Apr 22 '25 01:04 tyan0

I used this sample video https://dvdloc8.com/clip.php?movieid=12167&clipid=3

kawan-test avatar Apr 22 '25 02:04 kawan-test

I tried iNumRefFrames = pCtx->pSps->iNumRefFrames + 4; It solved the issue as well.

kawan-test avatar Apr 22 '25 02:04 kawan-test

Thanks for sample video. Where does the problem occur? (Time or frame?)

tyan0 avatar Apr 22 '25 04:04 tyan0

Not sure I understand your question. It is not fixed time. Most of time is around 10 seconds.

Error:DecodeCurrentAccessUnit()::::::PrefetchPic ERROR, pSps->iNumRefFrames:4. Info:ResetDecoder(), context error code is 16384

kawan-test avatar Apr 22 '25 19:04 kawan-test

Thanks for the information. I could reproduce the issue with openh264 v2.4.1, however, could not with v2.5.0, or later. i.e. the issue was already fixed.

tyan0 avatar Apr 23 '25 05:04 tyan0

I will try against 2.6.0

kawan-test avatar Apr 25 '25 13:04 kawan-test

I am still seeing the issue with 2.6.0 if I do not increase the picture queue size. my platform is raspberryPi-4.

kawan-test avatar Apr 28 '25 16:04 kawan-test

What kind of player are you using? I tested with ffplay and mpv but the issue could not be reproduced. Does libopenh264 run in QNX via some player?

tyan0 avatar Apr 29 '25 01:04 tyan0

We have our own developed player using libopenh264.

kawan-test avatar Apr 30 '25 19:04 kawan-test

Do you use multi-threading decoding? If so, how many threads do you specify?

tyan0 avatar Apr 30 '25 19:04 tyan0