optimize remote desktop, hvnc and webcam stuff. Fix issues with webcam frames getting super slow out of nowhere because of backup. Also remove compression since we rarely use it + H264 already compresses. Most things we send either way are so small where compression just adds CPU overhead that isn't needed.
This commit is contained in:
@@ -1169,9 +1169,17 @@ func encodeBlocksHVNC(img *image.RGBA, prev *prevImage, quality int, codec strin
|
||||
func copyPrev(img *image.RGBA) {
|
||||
width := img.Bounds().Dx()
|
||||
height := img.Bounds().Dy()
|
||||
buf := make([]byte, len(img.Pix))
|
||||
copy(buf, img.Pix)
|
||||
prevFrame = &prevImage{w: width, h: height, pix: buf}
|
||||
n := len(img.Pix)
|
||||
if prevFrame != nil && cap(prevFrame.pix) >= n {
|
||||
prevFrame.w = width
|
||||
prevFrame.h = height
|
||||
prevFrame.pix = prevFrame.pix[:n]
|
||||
copy(prevFrame.pix, img.Pix)
|
||||
} else {
|
||||
buf := make([]byte, n)
|
||||
copy(buf, img.Pix)
|
||||
prevFrame = &prevImage{w: width, h: height, pix: buf}
|
||||
}
|
||||
}
|
||||
|
||||
func encodeBlockRaw(img *image.RGBA, x, y, w, h int) []byte {
|
||||
|
||||
Reference in New Issue
Block a user