mirror of https://bitbucket.org/ausocean/av.git
fixed typo and also defaulting to CBR for RTMP with geovision
This commit is contained in:
parent
a6797a929d
commit
ed9f6f5336
|
@ -140,6 +140,11 @@ func (g *GeoVision) Set(c avconfig.Config) error {
|
||||||
c.MinFrames = defaultMinFrames
|
c.MinFrames = defaultMinFrames
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we're using RTMP then we should default to constant bitrate.
|
||||||
|
if containsUint8(avconfig.OutputRTMP, c.Outputs) {
|
||||||
|
c.CBR = true
|
||||||
|
}
|
||||||
|
|
||||||
switch c.VBRQuality {
|
switch c.VBRQuality {
|
||||||
case avconfig.QualityStandard, avconfig.QualityFair, avconfig.QualityGood, avconfig.QualityGreat, avconfig.QualityExcellent:
|
case avconfig.QualityStandard, avconfig.QualityFair, avconfig.QualityGood, avconfig.QualityGreat, avconfig.QualityExcellent:
|
||||||
default:
|
default:
|
||||||
|
@ -332,3 +337,13 @@ func parseSvrRTCPPort(resp rtsp.Response) (int, error) {
|
||||||
}
|
}
|
||||||
return 0, errors.New("SETUP response did not provide RTCP port")
|
return 0, errors.New("SETUP response did not provide RTCP port")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// containsUint8 checks if a []uint8 slice contains want.
|
||||||
|
func containsUint8(want uint8, s []uint8) bool {
|
||||||
|
for _, v := range s {
|
||||||
|
if v == want {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
|
@ -152,7 +152,7 @@ func (r *Raspivid) Set(c config.Config) error {
|
||||||
errs = append(errs, errBadFrameRate)
|
errs = append(errs, errBadFrameRate)
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.CBR || containsUint8(config.OutputHTTP, c.Outputs) {
|
if c.CBR || containsUint8(config.OutputRTMP, c.Outputs) {
|
||||||
c.Quantization = 0
|
c.Quantization = 0
|
||||||
if c.Bitrate <= 0 {
|
if c.Bitrate <= 0 {
|
||||||
errs = append(errs, errBadBitrate)
|
errs = append(errs, errBadBitrate)
|
||||||
|
|
Loading…
Reference in New Issue