xpra icon
Bug tracker and wiki

Opened 3 weeks ago

Last modified 3 weeks ago

#2048 assigned enhancement

nvenc startup is slow - send replacement jpeg frame

Reported by: Antoine Martin Owned by: Antoine Martin
Priority: major Milestone: 3.1
Component: encodings Version: 2.4.x
Keywords: Cc:


Even with decent hardware and a single card, it can take ~200ms to initialize the nvenc context (some examples in #2022).

Just like we already do with delayed frames (r13047), we can send a jpeg before initializing the video encoder and then skip the first video frame that comes out of it (the client still needs to decode it but doesn't need to display it).

This will probably require a new "slow-start" codec attribute.

Change History (2)

comment:1 Changed 3 weeks ago by Antoine Martin

Status: newassigned

Because the video encoder initialization has to run in the encode thread, we would still incur a 200ms delay, but at least the first frame would arrive quickly. (more important when the window is locked on video encoding)

A smoother solution to this problem would be to:

  • set a flag before starting the video encoder initialization
  • send a low quality jpeg (fast encode)
  • if we end up in the damage loop again, don't queue up the request and process frames immediately with "jpeg" from the worker thread until the video encoder is ready (locking?)

comment:2 Changed 3 weeks ago by Antoine Martin

Milestone: 2.53.1

I think that this can only work well if we move video encoding to a separate thread so that the normal flow isn't disrupted. We have to ensure that we don't update that video area with non-video screen updates, as those could arrive out of sequence.
That's exactly what the video region exclusion code does... but video encoders can be used without video regions.

On the plus side, the "video-clean" code wouldn't have to wait for the encode queue.

Note: See TracTickets for help on using tickets.