Crash after 1000 seeks on Rock64 with h264 video

  • I created a Kodi addon that plays a single video file in a playlist, and then seeks to different positions in the video based on GPIO input.

    The player works fine, with a clean transition to the seek locations, and stable operation for hours.

    But, after roughly 980 seeks, Kodi starts throwing error messages,and the video starts to distort with stuttered playing and color distortions.

    At about 1100 seeks, the processor reboots.

    This occurs whether the seeks are driven by the GPIO input, or a for loop that seeks back to 0 after a few seconds.

    The error message that appears after seek ~980 is:

    ERROR <general>: CDVDVideoCodecDRMPRIME::AddData - send packet failed: Operation not permitted (-1)

    I am using

    Pine64 Rock64 (Rockchip RK3328)processor, 4 GB

    Libreelec 10.0.2 with Kodi 19.4.

    Memory usage is ~500MB out of 4 GBR

    CPU loading is 25% on all 4 cores, per htop.

    Seek commands sent 1 or 2 times per minute

    4k h264 video (3840 x 2160, 29.97 fps) with 48000 Hz aac audio

    also tested with same video recoded by ffmpeg to 1080p

    also tested with the 4k video with audio re-encoded to mp3

    The attached python plugin recreates the problem, but with a seek cycle of 0.2 seconds.

    This lets me recreate the error in about 6 minutes instead of 15 hours.

    The test program includes a Kodi popup message to display the seek count.

    Note that this fast loop version throws additional errors I did not see in my 15 hour test.

    It is possible that they are caused by the short play duration

    ERROR <general>: CDVDVideoCodecDRMPRIME::Drain - send packet failed: Operation not permitted (-1)

    ERROR <general>: CDVDVideoCodecDRMPRIME::Reset - receive frame failed: Operation not permitted (-1)

    Note: the logfile include a lot of warnings, which seem to be about losing audio sync. But I ignore these since I don't use the audio.

    The problem does not occur with an h265 encoded video.

    And, just for "fun", I put Libreelec on two Raspberry Pi's to test it.

    The problem does not occur with the h264 video on a Raspberry Pi 4 with Libreelec 10.0.2

    The problem does not occur with the h264 video on a Raspberry Pi Zero with Libreelec 9.2.6

    Has anyone else seen this issue? Is there a workaround, other than converting everything to h265?

    I'm attaching my plugin files (addon.xml and loop.py, with .txt added to the names) and the crash log.