Optimize x11 screen capture buffer handling

This commit is contained in:
Atsushi Watanabe
2020-02-16 18:27:30 +09:00
parent 29d5a80f4f
commit a2d6c6bb58
3 changed files with 76 additions and 9 deletions
+3 -1
View File
@@ -65,9 +65,11 @@ func (s *screen) VideoRecord(p prop.Media) (video.Reader, error) {
}
s.tick = time.NewTicker(time.Duration(float32(time.Second) / p.FrameRate))
var dst image.RGBA
r := video.ReaderFunc(func() (image.Image, error) {
<-s.tick.C
return s.reader.Read(), nil
return s.reader.Read().ToRGBA(&dst), nil
})
return r, nil
}