mirror of https://bitbucket.org/ausocean/av.git
using slice functions from sliceutils package
This commit is contained in:
parent
ed9f6f5336
commit
c2c0a576e6
|
@ -41,6 +41,7 @@ import (
|
||||||
"bitbucket.org/ausocean/av/protocol/rtsp"
|
"bitbucket.org/ausocean/av/protocol/rtsp"
|
||||||
avconfig "bitbucket.org/ausocean/av/revid/config"
|
avconfig "bitbucket.org/ausocean/av/revid/config"
|
||||||
"bitbucket.org/ausocean/utils/logger"
|
"bitbucket.org/ausocean/utils/logger"
|
||||||
|
"bitbucket.org/ausocean/utils/sliceutils"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Indicate package when logging.
|
// Indicate package when logging.
|
||||||
|
@ -141,7 +142,7 @@ func (g *GeoVision) Set(c avconfig.Config) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're using RTMP then we should default to constant bitrate.
|
// If we're using RTMP then we should default to constant bitrate.
|
||||||
if containsUint8(avconfig.OutputRTMP, c.Outputs) {
|
if sliceutils.ContainsUint8(c.Outputs, avconfig.OutputRTMP) {
|
||||||
c.CBR = true
|
c.CBR = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,13 +338,3 @@ 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.OutputRTMP, c.Outputs) {
|
if c.CBR || sliceutils.ContainsUint8(c.Outputs, config.OutputRTMP) {
|
||||||
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