Remove video framerate as explicit constraint (#394)

* Do not consider video framerate in the constraints fitness function
* Remove test about video framerate
This commit is contained in:
f-fl0
2022-04-06 10:07:15 +09:00
committed by GitHub
parent e780bdc6f9
commit 0d09f7f458
2 changed files with 5 additions and 20 deletions

View File

@@ -125,18 +125,6 @@ func TestSelectBestDriverConstraintsResultIsSetProperly(t *testing.T) {
frameFormat: frame.FormatI420,
frameRate: expectedProp.FrameRate,
},
"DifferentFrameRate": {
width: expectedProp.Width,
height: expectedProp.Height,
frameFormat: expectedProp.FrameFormat,
frameRate: expectedProp.FrameRate - 1,
},
"NoFrameRateConstraints": {
width: expectedProp.Width,
height: expectedProp.Height,
frameFormat: expectedProp.FrameFormat,
frameRate: -1,
},
}
for name, c := range cases {
@@ -229,12 +217,6 @@ func TestSelectBestDriverConstraintsNoFit(t *testing.T) {
frameFormat: frame.FormatI420,
frameRate: expectedProp.FrameRate,
},
"DifferentFrameRate": {
width: expectedProp.Width,
height: expectedProp.Height,
frameFormat: expectedProp.FrameFormat,
frameRate: expectedProp.FrameRate - 1,
},
}
for name, c := range cases {

View File

@@ -145,14 +145,17 @@ func (p *MediaConstraints) FitnessDistance(o Media) (float64, bool) {
cmps.add(p.Width, o.Width)
cmps.add(p.Height, o.Height)
cmps.add(p.FrameFormat, o.FrameFormat)
cmps.add(p.FrameRate, o.FrameRate)
// The next line is comment out for now to not include framerate in the fitness function.
// As camera.Properties does not have access to the list of available framerate at the moment,
// no driver can be matched with a framerate constraint.
// Note this also affect screen caputre as screen.Properties does not fill in the Framerate field.
// cmps.add(p.FrameRate, o.FrameRate)
cmps.add(p.SampleRate, o.SampleRate)
cmps.add(p.Latency, o.Latency)
cmps.add(p.ChannelCount, o.ChannelCount)
cmps.add(p.IsBigEndian, o.IsBigEndian)
cmps.add(p.IsFloat, o.IsFloat)
cmps.add(p.IsInterleaved, o.IsInterleaved)
return cmps.fitnessDistance()
}