mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-11 07:59:08 +02:00
Attach to the X server on the active VT and keep a retryable DXGI frame from tearing down the capturer
Claude-Session: https://claude.ai/code/session_01QKDYfH4WKLbpNQHccpVo3P
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"image"
|
||||
"runtime"
|
||||
@@ -435,6 +436,11 @@ type frameCapturer interface {
|
||||
close()
|
||||
}
|
||||
|
||||
// errFrameNotReady is the capture error that means "healthy, but nothing to
|
||||
// hand out yet". The worker answers the request with it and keeps the
|
||||
// capturer, where any other error tears the capturer down and rebuilds it.
|
||||
var errFrameNotReady = errors.New("no frame captured yet")
|
||||
|
||||
// captureWorker owns the worker goroutine's mutable state. Extracted into a
|
||||
// struct so the request/desktop/init logic can live on small methods and the
|
||||
// outer worker() stays a thin loop.
|
||||
@@ -475,6 +481,11 @@ func (w *captureWorker) serveRequest(req captureReq) {
|
||||
return
|
||||
}
|
||||
img, err := fc.capture()
|
||||
if errors.Is(err, errFrameNotReady) {
|
||||
log.Tracef("capture: %v", err)
|
||||
req.reply <- captureReply{err: err}
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
log.Debugf("capture: %v", err)
|
||||
w.closeCapturer()
|
||||
|
||||
Reference in New Issue
Block a user