Split the harness stream into capture, encode, and per-client send loops
This commit is contained in:
+6
-6
@@ -36,6 +36,9 @@ func openGrabber() (*grabber, error) {
|
||||
}
|
||||
crtc, index, err := activeCrtc(fd)
|
||||
if err == nil {
|
||||
// Opening the node while no master exists hands this fd implicit
|
||||
// drm master; give it back so cabletest can take it.
|
||||
drm.Ioctl(fd, drm.DropMaster, nil)
|
||||
return &grabber{fd: fd, crtc: crtc, index: index}, nil
|
||||
}
|
||||
unix.Close(fd)
|
||||
@@ -129,7 +132,7 @@ const overrunLimit = 10
|
||||
// sequences differ by at most one therefore provably finished before the
|
||||
// rewrite could begin. Overrunning that is a timing miss, not corruption:
|
||||
// sample again, and treat only systematic misses as an error.
|
||||
func (g *grabber) rawFrame(dst []byte) ([]byte, int, int, int, error) {
|
||||
func (g *grabber) rawFrame() ([]byte, int, int, int, error) {
|
||||
for tries := 0; tries < overrunLimit; tries++ {
|
||||
s0, err := g.vblank(1)
|
||||
if err != nil {
|
||||
@@ -139,10 +142,7 @@ func (g *grabber) rawFrame(dst []byte) ([]byte, int, int, int, error) {
|
||||
if err != nil {
|
||||
return nil, 0, 0, 0, err
|
||||
}
|
||||
if len(dst) < len(mem) {
|
||||
dst = make([]byte, len(mem))
|
||||
}
|
||||
dst = dst[:len(mem)]
|
||||
dst := make([]byte, len(mem))
|
||||
copy(dst, mem)
|
||||
unix.Munmap(mem)
|
||||
s1, err := g.vblank(0)
|
||||
@@ -157,7 +157,7 @@ func (g *grabber) rawFrame(dst []byte) ([]byte, int, int, int, error) {
|
||||
}
|
||||
|
||||
func (g *grabber) frame() (*image.NRGBA, error) {
|
||||
raw, pitch, pw, ph, err := g.rawFrame(nil)
|
||||
raw, pitch, pw, ph, err := g.rawFrame()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user