xpra icon
Bug tracker and wiki

Opened 3 years ago

Closed 3 years ago

#1012 closed defect (fixed)

frame error triggered by client decode error

Reported by: Antoine Martin Owned by: alas
Priority: major Milestone: 0.16
Component: encodings Version: 0.15.x
Keywords: nvenc Cc:

Description

Split from #1010: with the fault injection and after unapplying r10993 to trigger the window decode error codepath, you can hit:

Error: invalid encoding: jpeg
libav: non-existing PPS 0 referenced
libav: decode_slice_header error
libav: non-existing PPS 0 referenced
libav: decode_slice_header error
libav: non-existing PPS 0 referenced
libav: decode_slice_header error
libav: non-existing PPS 0 referenced
libav: decode_slice_header error
libav: no frame!
avcodec_decode_video2 h264 decoding failure:
 Invalid data found when processing input
paint_with_video_decoder: wid=1, h264 decompression error on 440 bytes of picture data for 498x316 pixels using \
    dec_avcodec.Decoder({'decoder_height': 316, 'encoding': 'h264', 'colorspace': 'YUV444P', \
        'actual_colorspace': 'YUV444P', 'height': 316, 'decoder_width': 498, 'width': 498, 'version': (56, 60, 100), \
        'formats': ['YUV422P', 'BGRX', 'GBRP', 'RGB', 'YUV420P', 'BGRA', 'ARGB', 'XRGB', 'YUV444P'], \
        'frames': 0L, 'type': 'avcodec', 'buffers': 0}), \
    options={'quality': 99, 'encoding': 'h264', 'pts': 439, 'frame': 1, 'csc': 'YUV444P', 'speed': 40}

Looks like the previous decoding error causes a video encoder reset, and the client is getting some kind of video context mismatch.

This only happens with nvenc, x264 is immune to this problem.

Change History (3)

comment:1 Changed 3 years ago by Antoine Martin

Status: newassigned

Got the bug, not the fix.
Problem is that nvenc can return an empty frame (not sure why - we don't have I frames yet, could be a driver or library issue?), when that happens we miss frame 0, which is what the client uses to know when to re-start the decoder.

TODO:

  • use / enhance fault injection for triggering this bug
  • fix nvenc to not return empty frames unless we are use I frames
  • when we do use I frames, start at zero!

comment:2 Changed 3 years ago by Antoine Martin

Owner: changed from Antoine Martin to alas
Status: assignednew
Summary: nvenc frame error triggered by client decode errorframe error triggered by client decode error

Turns out, I was wrong: the frames aren't empty, this bug is not specific to nvenc, it is just easier to hit with a fast encoder. It isn't just triggered by decoding errors either, anything that cancels damage can probably trigger it.

The problem is that when we get a decoding error, we cancel damage - unsafely.
r11003 + r11008 fix that. Will backport.

@afarr: just a FYI, this could explain the non-existing PPS 0 referenced you had reported. Please close.

comment:3 Changed 3 years ago by alas

Resolution: fixed
Status: newclosed

Ok, closing... will watch for stuff to test.

Note: See TracTickets for help on using tickets.