fix remote desktop being slow
This commit is contained in:
@@ -612,9 +612,6 @@ func buildFrame(img *image.RGBA, display int, quality int) (wire.Frame, time.Dur
|
|||||||
}
|
}
|
||||||
h264Bytes, err := encodeH264Frame(img)
|
h264Bytes, err := encodeH264Frame(img)
|
||||||
if err == nil && len(h264Bytes) > 0 {
|
if err == nil && len(h264Bytes) > 0 {
|
||||||
prevMu.Lock()
|
|
||||||
copyPrev(img)
|
|
||||||
prevMu.Unlock()
|
|
||||||
lastKeyframe.Store(now.UnixNano())
|
lastKeyframe.Store(now.UnixNano())
|
||||||
statFullFrames.Add(1)
|
statFullFrames.Add(1)
|
||||||
return wire.Frame{Type: "frame", Header: wire.FrameHeader{Monitor: display, FPS: 0, Format: "h264"}, Data: h264Bytes}, time.Since(encStart), nil
|
return wire.Frame{Type: "frame", Header: wire.FrameHeader{Monitor: display, FPS: 0, Format: "h264"}, Data: h264Bytes}, time.Since(encStart), nil
|
||||||
@@ -720,9 +717,6 @@ func buildFrameHVNC(img *image.RGBA, display int, quality int) (wire.Frame, time
|
|||||||
}
|
}
|
||||||
h264Bytes, err := encodeH264FrameHVNC(img)
|
h264Bytes, err := encodeH264FrameHVNC(img)
|
||||||
if err == nil && len(h264Bytes) > 0 {
|
if err == nil && len(h264Bytes) > 0 {
|
||||||
hvncPrevMu.Lock()
|
|
||||||
copyPrevHVNC(img)
|
|
||||||
hvncPrevMu.Unlock()
|
|
||||||
hvncLastKeyframe.Store(now.UnixNano())
|
hvncLastKeyframe.Store(now.UnixNano())
|
||||||
statFullFrames.Add(1)
|
statFullFrames.Add(1)
|
||||||
frame := wire.Frame{Type: "frame", Header: wire.FrameHeader{Monitor: display, FPS: 0, Format: "h264", HVNC: true}, Data: h264Bytes}
|
frame := wire.Frame{Type: "frame", Header: wire.FrameHeader{Monitor: display, FPS: 0, Format: "h264", HVNC: true}, Data: h264Bytes}
|
||||||
|
|||||||
@@ -710,7 +710,6 @@ func (s *duplicationState) capture(display int) (*image.RGBA, error) {
|
|||||||
if img == s.lastBase || img == s.cursorScratch {
|
if img == s.lastBase || img == s.cursorScratch {
|
||||||
img = cloneRGBA(img)
|
img = cloneRGBA(img)
|
||||||
}
|
}
|
||||||
s.lastFrame = cloneRGBA(img)
|
|
||||||
s.lastFrameAt = time.Now()
|
s.lastFrameAt = time.Now()
|
||||||
return img, nil
|
return img, nil
|
||||||
}
|
}
|
||||||
@@ -808,7 +807,7 @@ func (s *duplicationState) capture(display int) (*image.RGBA, error) {
|
|||||||
// the next compose doesn't write into a buffer the caller has pooled.
|
// the next compose doesn't write into a buffer the caller has pooled.
|
||||||
img = cloneRGBA(img)
|
img = cloneRGBA(img)
|
||||||
}
|
}
|
||||||
s.lastFrame = cloneRGBA(img)
|
s.lastFrame = nil
|
||||||
s.lastFrameAt = time.Now()
|
s.lastFrameAt = time.Now()
|
||||||
|
|
||||||
return img, nil
|
return img, nil
|
||||||
|
|||||||
Reference in New Issue
Block a user