diff --git a/cmd/livepeer/starter/starter.go b/cmd/livepeer/starter/starter.go index 5354820abe..508ff75ab0 100755 --- a/cmd/livepeer/starter/starter.go +++ b/cmd/livepeer/starter/starter.go @@ -342,8 +342,9 @@ func DefaultLivepeerConfig() LivepeerConfig { FVfailGsKey: &defaultFVfailGsKey, // API - AuthWebhookURL: &defaultAuthWebhookURL, - OrchWebhookURL: &defaultOrchWebhookURL, + AuthWebhookURL: &defaultAuthWebhookURL, + OrchWebhookURL: &defaultOrchWebhookURL, + OrchMinLivepeerVersion: &defaultMinLivepeerVersion, // Versioning constraints OrchMinLivepeerVersion: &defaultMinLivepeerVersion, diff --git a/core/capabilities.go b/core/capabilities.go index 237790e3c8..89a3847bc5 100644 --- a/core/capabilities.go +++ b/core/capabilities.go @@ -614,7 +614,7 @@ func CapabilityToName(capability Capability) (string, error) { return capName, nil } -func InArray(capability Capability, caps []Capability) bool { +func HasCapability(caps []Capability, capability Capability) bool { for _, c := range caps { if capability == c { return true diff --git a/core/capabilities_test.go b/core/capabilities_test.go index 89e3d62102..e31642f6bc 100644 --- a/core/capabilities_test.go +++ b/core/capabilities_test.go @@ -148,22 +148,22 @@ func TestCapability_TranscoderCapabilities(t *testing.T) { if devicesAvailable { nvidiaCaps, err := TestTranscoderCapabilities(devices, NewNvidiaTranscoder) assert.Nil(t, err) - assert.False(t, InArray(Capability_H264_Decode_444_8bit, nvidiaCaps), "Nvidia device should not support decode of 444_8bit") - assert.False(t, InArray(Capability_H264_Decode_422_8bit, nvidiaCaps), "Nvidia device should not support decode of 422_8bit") - assert.False(t, InArray(Capability_H264_Decode_444_10bit, nvidiaCaps), "Nvidia device should not support decode of 444_10bit") - assert.False(t, InArray(Capability_H264_Decode_422_10bit, nvidiaCaps), "Nvidia device should not support decode of 422_10bit") - assert.False(t, InArray(Capability_H264_Decode_420_10bit, nvidiaCaps), "Nvidia device should not support decode of 420_10bit") + assert.False(t, HasCapability(nvidiaCaps, Capability_H264_Decode_444_8bit), "Nvidia device should not support decode of 444_8bit") + assert.False(t, HasCapability(nvidiaCaps, Capability_H264_Decode_422_8bit), "Nvidia device should not support decode of 422_8bit") + assert.False(t, HasCapability(nvidiaCaps, Capability_H264_Decode_444_10bit), "Nvidia device should not support decode of 444_10bit") + assert.False(t, HasCapability(nvidiaCaps, Capability_H264_Decode_422_10bit), "Nvidia device should not support decode of 422_10bit") + assert.False(t, HasCapability(nvidiaCaps, Capability_H264_Decode_420_10bit), "Nvidia device should not support decode of 420_10bit") } // Same test with software transcoder: softwareCaps, err := TestSoftwareTranscoderCapabilities(tmpdir) assert.Nil(t, err) // Software transcoder supports: [h264_444_8bit h264_422_8bit h264_444_10bit h264_422_10bit h264_420_10bit] - assert.True(t, InArray(Capability_H264_Decode_444_8bit, softwareCaps), "software decoder should support 444_8bit input") - assert.True(t, InArray(Capability_H264_Decode_422_8bit, softwareCaps), "software decoder should support 422_8bit input") - assert.True(t, InArray(Capability_H264_Decode_444_10bit, softwareCaps), "software decoder should support 444_10bit input") - assert.True(t, InArray(Capability_H264_Decode_422_10bit, softwareCaps), "software decoder should support 422_10bit input") - assert.True(t, InArray(Capability_H264_Decode_420_10bit, softwareCaps), "software decoder should support 420_10bit input") + assert.True(t, HasCapability(softwareCaps, Capability_H264_Decode_444_8bit), "software decoder should support 444_8bit input") + assert.True(t, HasCapability(softwareCaps, Capability_H264_Decode_422_8bit), "software decoder should support 422_8bit input") + assert.True(t, HasCapability(softwareCaps, Capability_H264_Decode_444_10bit), "software decoder should support 444_10bit input") + assert.True(t, HasCapability(softwareCaps, Capability_H264_Decode_422_10bit), "software decoder should support 422_10bit input") + assert.True(t, HasCapability(softwareCaps, Capability_H264_Decode_420_10bit), "software decoder should support 420_10bit input") } func TestCapability_JobCapabilities(t *testing.T) { diff --git a/core/transcoder.go b/core/transcoder.go index a34dab3f64..090ee3d217 100644 --- a/core/transcoder.go +++ b/core/transcoder.go @@ -180,7 +180,7 @@ type transcodeTestParams struct { } func (params transcodeTestParams) IsRequired() bool { - return InArray(params.Cap, DefaultCapabilities()) + return HasCapability(DefaultCapabilities(), params.Cap) } func (params transcodeTestParams) Kind() string {