Opened 22 months ago

Closed 21 months ago

Last modified 16 months ago

#13173 closed Bug Report - General (fixed)

Raspberry Pi - Occasional 10 second hangs during playback

Reported by: Peter Bennett Owned by: Peter Bennett
Priority: minor Milestone: 29.1
Component: Ports - rPi Version: v29-fixes
Severity: medium Keywords:
Cc: Ticket locked: no

Description

While watching MPEG2 HD recordings there is occasionally a 10 second hang and then playback continues. This is about once or twice per hour. This is the log:

2017-11-07 18:50:01.798445 N  Player(0): Waited 103ms for video buffers ALLAAAAAAPPP
2017-11-07 18:50:02.768457 N  Player(0): Waited 104ms for video buffers AAAALLAAAPPP
2017-11-07 18:50:04.017824 N  Player(0): Waited 104ms for video buffers ALALAAAAAPPP
2017-11-07 18:50:05.512239 N  Player(0): Waited 103ms for video buffers LALAAAAAAPPP
2017-11-07 18:50:06.726072 N  Player(0): Waited 103ms for video buffers AAAAAALLAPPP
2017-11-07 18:50:08.002697 N  Player(0): Waited 102ms for video buffers AAAALAALAPPP
2017-11-07 18:52:19.200334 N  Player(0): Waited 103ms for video buffers LAALAAAAAPPP
2017-11-07 18:52:20.809759 N  Player(0): Waited 101ms for video buffers AALAAALAAPPP
2017-11-07 18:52:23.040792 N  Player(0): To see more buffering messages use -v playback
2017-11-07 18:53:27.819973 E  DOMX:0 ProcessPacket - no input buffers

The "no input buffers" is the key. There are by default 20 input buffers allocated of 81920 each. If an entire frame cannot be decoded from the 20 buffers then a hang results.

Attachments (2)

20171108_#13173_raspi_hangs.patch (1.7 KB) - added by Peter Bennett 22 months ago.
Proposed fix
20171111_#13173_raspi_hangs.patch (2.6 KB) - added by Peter Bennett 21 months ago.
Revised patch to fix the bug

Download all attachments as: .zip

Change History (11)

comment:1 Changed 22 months ago by Peter Bennett

The attached patch increases the default number of input buffers to 25 and allows a setting to set a different value if needed. Set OmxInputBuffers to the desired number of buffers, for example "-O OmxInputBuffers=30".

Changed 22 months ago by Peter Bennett

Proposed fix

comment:2 Changed 21 months ago by Peter Bennett

Status: newaccepted

comment:3 Changed 21 months ago by Peter Bennett

This patch did not fix the problem. I had two occurrences yesterday. I could easily mask the problem by reducing the 10 second timeout but I would rather fix the root cause. More investigation is needed.

comment:4 Changed 21 months ago by Peter Bennett

I found that the number of free buffers varies greatly during playback, occasionally hitting zero. If you have buffers set at 20, it runs out of buffers about once every 30 minutes. Ignoring the error and dropping the packet seems to have little effect on viewing, mostly nothing is noticed, occasionally it causes a pixellation. We can set buffers as 20 and endure 1 possible pixellation per 30 minutes or set it to 25 and have one possible pixellation per 2 hours. I have made the setting available and set it at 20 buffers. It can be increased if needed by end users.

Changed 21 months ago by Peter Bennett

Revised patch to fix the bug

comment:5 Changed 21 months ago by Peter Bennett

While the latest patch works well on Raspberry Pi 3, it causes a lot of pixellation on Raspberry Pi 2. On Pi 2 you need to supply 30 or 40 buffers with "-O OmxInputBuffers=". There are 80K per buffer so increasing from 20 to 40 adds 1.6 MB to the memory requirements so I think that is not an issue even with the limited memory in the raspberry pi.

comment:6 Changed 21 months ago by Peter Bennett

Milestone: needs_triage29.1

comment:7 Changed 21 months ago by Peter Bennett <pbennett@…>

Resolution: fixed
Status: acceptedclosed

In 01f2e33130e5d2ff8bc2429da8af68195c4cdab1/mythtv:

Fixes #13173 - Raspberry Pi hangs during playback

Running out of OMX decoder input buffers occasionally. Fixed by
increasing default number of buffers from 20 to 30 and reducing the timeout
for acquiring a buffer to 100ms.

comment:8 Changed 21 months ago by Peter Bennett <pbennett@…>

In e62530954d2b5814fc95808608b3b555d9a101e7/mythtv:

Fixes #13173 - Raspberry Pi hangs during playback

Running out of OMX decoder input buffers occasionally. Fixed by
increasing default number of buffers from 20 to 30 and reducing the timeout
for acquiring a buffer to 100ms.

(cherry picked from commit 01f2e33130e5d2ff8bc2429da8af68195c4cdab1)

comment:9 Changed 16 months ago by Peter Bennett

Owner: changed from Peter Bennett to Peter Bennett
Note: See TracTickets for help on using tickets.