mirror of
https://github.com/pion/mediadevices.git
synced 2026-04-23 00:07:29 +08:00
Fix data race in drivers
This commit is contained in:
committed by
Lukas Herman
parent
2bac44aa8a
commit
33b2964733
@@ -66,10 +66,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
|
||||
reader := s.reader
|
||||
|
||||
r := video.ReaderFunc(func() (image.Image, error) {
|
||||
<-s.tick.C
|
||||
return s.reader.Read().ToRGBA(&dst), nil
|
||||
return reader.Read().ToRGBA(&dst), nil
|
||||
})
|
||||
return r, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user