revid: corrected logic for RTMPURL fallback and fixed bug in test

This commit is contained in:
Saxon 2019-08-24 14:53:49 +09:30
parent 9eb155dfed
commit d390918209
2 changed files with 3 additions and 2 deletions

View File

@ -314,8 +314,9 @@ func (c *Config) Validate() error {
if c.RTMPURL == "" {
c.Logger.Log(logger.Info, pkg+"no RTMP URL: falling back to HTTP")
c.Outputs[i] = HTTP
break
haveRTMPOut = false
}
fallthrough
case HTTP, RTP:
if !haveRTMPOut {
c.Bitrate = 0

View File

@ -53,7 +53,7 @@ func TestValidate(t *testing.T) {
},
},
{
in: Config{Outputs: []uint8{RTMP}, Logger: &dumbLogger{}},
in: Config{Outputs: []uint8{RTMP}, RTMPURL: "dummURL", Logger: &dumbLogger{}},
check: func(c Config) error {
if c.Bitrate != defaultBitrate {
return fmt.Errorf("did not get expected bitrate. Got: %v, Want: %v", c.Bitrate, defaultBitrate)