sofie-atem-connection
sofie-atem-connection copied to clipboard
Upload speed improvements
Currently the media uploading in this library is significantly slower than the atem software. There appear to be a couple of factors that could be improved in the library in that regard.
Max packets per tick constant
The amount of packets sent per tick are limited by this constant https://github.com/nrkno/tv-automation-atem-connection/blob/master/src/dataTransfer/index.ts#L10
Doing some testing under node 8 with the strict-config branch reveals that setting this property to 40 can reduce upload speeds from ~1800ms to ~1400ms. Setting it higher (80) gives little benefit and setting it too high (160) gave many packet resends. Possibly this value should not be constant but instead be variable based on how many packets are resent.
Multithreading overhead
Disabling multi threading in the strict-config branch gives me another 300-400ms benefit. Combining this with the aforementioned max packets constant optimization I can reach sub second transfers, which is an almost 2x improvement
RLE encoding
The atem software applies RLE encoding as an optimization. I don't know how much faster that would make our transfers but it would optimize things where a lot of black is included such as lower thirds and logo bugs.
Shared Memory (Multithreading overhead)
We can probably get some improvements by using SharedArrayBuffer or ArrayBuffer instead of using Buffer over the ipc bridge, as the buffers get converted to arrays of numbers that we have to convert back to a Buffer. Some work may be needed in threadedClass to handle these types. This will reduce the noted overhead of multithreading
Max packets per tick is changed and RLE is implemented by https://github.com/nrkno/sofie-atem-connection/pull/149