Update webcam module to set the camera framerate (#390)

* Update webcam module to set the camera framerate
* Add framerate to property fitness function
* Set framerate to dummy VideoRecord
* Add tests about video constraints
* Set framerate only when a positive value is specified
This commit is contained in:
f-fl0
2022-04-04 14:48:56 +09:00
committed by GitHub
parent 70261260cb
commit 3b2316081e
6 changed files with 163 additions and 31 deletions
+7
View File
@@ -179,6 +179,13 @@ func (c *camera) VideoRecord(p prop.Media) (video.Reader, error) {
return nil, err
}
if p.FrameRate > 0 {
err = c.cam.SetFramerate(float32(p.FrameRate))
if err != nil {
return nil, err
}
}
if err := c.cam.StartStreaming(); err != nil {
return nil, err
}