mirror of
https://github.com/pion/mediadevices.git
synced 2026-04-22 15:57:27 +08:00
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:
@@ -125,18 +125,6 @@ func TestSelectBestDriverConstraintsResultIsSetProperly(t *testing.T) {
|
|||||||
frameFormat: frame.FormatI420,
|
frameFormat: frame.FormatI420,
|
||||||
frameRate: expectedProp.FrameRate,
|
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 {
|
for name, c := range cases {
|
||||||
@@ -229,12 +217,6 @@ func TestSelectBestDriverConstraintsNoFit(t *testing.T) {
|
|||||||
frameFormat: frame.FormatI420,
|
frameFormat: frame.FormatI420,
|
||||||
frameRate: expectedProp.FrameRate,
|
frameRate: expectedProp.FrameRate,
|
||||||
},
|
},
|
||||||
"DifferentFrameRate": {
|
|
||||||
width: expectedProp.Width,
|
|
||||||
height: expectedProp.Height,
|
|
||||||
frameFormat: expectedProp.FrameFormat,
|
|
||||||
frameRate: expectedProp.FrameRate - 1,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, c := range cases {
|
for name, c := range cases {
|
||||||
|
|||||||
+5
-2
@@ -145,14 +145,17 @@ func (p *MediaConstraints) FitnessDistance(o Media) (float64, bool) {
|
|||||||
cmps.add(p.Width, o.Width)
|
cmps.add(p.Width, o.Width)
|
||||||
cmps.add(p.Height, o.Height)
|
cmps.add(p.Height, o.Height)
|
||||||
cmps.add(p.FrameFormat, o.FrameFormat)
|
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.SampleRate, o.SampleRate)
|
||||||
cmps.add(p.Latency, o.Latency)
|
cmps.add(p.Latency, o.Latency)
|
||||||
cmps.add(p.ChannelCount, o.ChannelCount)
|
cmps.add(p.ChannelCount, o.ChannelCount)
|
||||||
cmps.add(p.IsBigEndian, o.IsBigEndian)
|
cmps.add(p.IsBigEndian, o.IsBigEndian)
|
||||||
cmps.add(p.IsFloat, o.IsFloat)
|
cmps.add(p.IsFloat, o.IsFloat)
|
||||||
cmps.add(p.IsInterleaved, o.IsInterleaved)
|
cmps.add(p.IsInterleaved, o.IsInterleaved)
|
||||||
|
|
||||||
return cmps.fitnessDistance()
|
return cmps.fitnessDistance()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user