xpra icon
Bug tracker and wiki

Opened 13 days ago

Last modified 11 days ago

#1839 new defect

fix broadway software h264 decoding

Reported by: Antoine Martin Owned by: J. Max Mena
Priority: major Milestone: 2.4
Component: html5 Version:
Keywords: Cc:

Description

Split from #1463, the error that comes up is RangeError: Source is too large.

Change History (3)

comment:1 Changed 13 days ago by Antoine Martin

Status: newassigned

The error RangeError: Source is too large turned out to be trivial to fix: r19294, just needed a "new" pair of eyes, found it when looking into mpeg1 decoding (#1816).

So r19295 enables broadway software decoding by default, again.

What we may still want to do here:

  • tune the encoder to maximize decoding speed for the html5 client since software decoding is going to be CPU intensive: fastdecode – disables CABAC and the in-loop deblocking filter to allow for faster decoding on devices with lower computational power
  • do a test run during startup and verify that we can decode some test frames, and fast enough (tricky since the broadway javascript decoder may not be optimized the first time we run it) - or blacklist some browsers / OS / CPU

comment:2 Changed 13 days ago by Antoine Martin

Owner: changed from Antoine Martin to J. Max Mena
Status: assignednew

The html5 client already sets the correct h264 encoding properties (see also #1840):

"encoding.h264.YUV420P.profile"		: "baseline",
"encoding.h264.YUV420P.level"		: "2.1",
"encoding.h264.cabac"			: false,
"encoding.h264.deblocking-filter"	: false,

And these are correctly applied by the x264 codec (as seen with "-d x264"):

x264 context=0x7f08788859c0, YUV420P  640x356  quality=40, speed=40, source=unknown
 preset=medium, profile=baseline, tune=zerolatency
 me=DIA, me_range=16, mv_range=-1, weighted-pred=0
 b-frames=0, max delayed frames=0
 vfr-input=False, lookahead=-1, sync-lookahead=0, mb-tree=False, bframe-adaptive=FAST
 open-gop=True, bluray-compat=False, cabac=False, deblocking-filter=False
 intra-refresh=False, interlaced=False, constrained_intra=False
 threads=auto, sliced-threads=True
x264 encode YUV420P frame     0 as  IDR slice with 8 nals, tune=zerolatency, total   10776 bytes, keyframe=True , delayed=0

Note: nvenc doesn't have such controls, so it may or may not produce a stream which is more CPU intensive to decode.

So the only remaining issue is the blacklisting, which we can look at after some testing.
This:

Decoder.js:450 Invalid asm.js: Unexpected token

could slow things down quite a bit - not sure how to fix that (building it from source is a pain).

Last edited 11 days ago by Antoine Martin (previous) (diff)

comment:3 Changed 11 days ago by Antoine Martin

Updates:

  • r19318: fix asm.js, don't minify source in svn, we do it during the build instead
  • r19321: better x264 tuning for the broadway decoder: "fast-decode" tune, higher min-speed
  • r19322: minor fix
  • r19323: better "fast-decode" tuning
  • r19324: better x264 encoder content type tuning
  • r19325: expose more x264 settings via xpra info

Which gives us:

window.5.encoder=x264
window.5.encoder.b-frames=0
window.5.encoder.delayed=11
window.5.encoder.fast-decode=True
window.5.encoder.formats=('BGRX', 'YUV422P', 'YUV420P', 'BGRA', 'YUV444P')
window.5.encoder.fps=16
window.5.encoder.frame-types.IDR=1
window.5.encoder.frame-types.P=7
window.5.encoder.frames=8
window.5.encoder.generation=9
window.5.encoder.height=432
window.5.encoder.lossless=False
window.5.encoder.max-size=(8192, 4096)
window.5.encoder.ms_per_frame=1
window.5.encoder.params.bframe-adaptive=NONE
window.5.encoder.params.bluray-compat=False
window.5.encoder.params.cabac=False
window.5.encoder.params.constrained_intra=False
window.5.encoder.params.deblocking-filter=False
window.5.encoder.params.interlaced=False
window.5.encoder.params.intra-refresh=False
window.5.encoder.params.lookahead=0
window.5.encoder.params.mb-tree=False
window.5.encoder.params.me.me-range=16
window.5.encoder.params.me.mv-range=256
window.5.encoder.params.me.type=HEX
window.5.encoder.params.me.weighted-pred=0
window.5.encoder.params.open-gop=False
window.5.encoder.params.sliced-threads=False
window.5.encoder.params.threads=12
window.5.encoder.params.vfr-input=False
window.5.encoder.pixels_per_second=159132896
window.5.encoder.preset=veryfast
window.5.encoder.profile=baseline
window.5.encoder.quality=58
window.5.encoder.source=video
window.5.encoder.speed=82
window.5.encoder.src_format=YUV420P
window.5.encoder.total_time_ms=13
window.5.encoder.tune=film
window.5.encoder.version=148
window.5.encoder.width=640

Still TODO:

  • why am I seeing many delayed frames?
  • some corrupted frames too?
Last edited 11 days ago by Antoine Martin (previous) (diff)
Note: See TracTickets for help on using tickets.