mirror of
https://github.com/pion/mediadevices.git
synced 2026-04-23 00:07:29 +08:00
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user