Move duplicate string to a constant
This commit is contained in:
parent
47770feaa5
commit
1fe1c6c925
@ -11,6 +11,8 @@ import (
|
|||||||
"github.com/owncast/owncast/models"
|
"github.com/owncast/owncast/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const unknownString = "Unknown"
|
||||||
|
|
||||||
func getInboundDetailsFromMetadata(metadata []interface{}) (models.RTMPStreamMetadata, error) {
|
func getInboundDetailsFromMetadata(metadata []interface{}) (models.RTMPStreamMetadata, error) {
|
||||||
metadataComponentsString := fmt.Sprintf("%+v", metadata)
|
metadataComponentsString := fmt.Sprintf("%+v", metadata)
|
||||||
if !strings.Contains(metadataComponentsString, "onMetaData") {
|
if !strings.Contains(metadataComponentsString, "onMetaData") {
|
||||||
@ -50,12 +52,12 @@ func getAudioCodec(codec interface{}) string {
|
|||||||
return "Speex"
|
return "Speex"
|
||||||
}
|
}
|
||||||
|
|
||||||
return "Unknown"
|
return unknownString
|
||||||
}
|
}
|
||||||
|
|
||||||
func getVideoCodec(codec interface{}) string {
|
func getVideoCodec(codec interface{}) string {
|
||||||
if codec == nil {
|
if codec == nil {
|
||||||
return "Unknown"
|
return unknownString
|
||||||
}
|
}
|
||||||
|
|
||||||
var codecID float64
|
var codecID float64
|
||||||
@ -72,5 +74,5 @@ func getVideoCodec(codec interface{}) string {
|
|||||||
return "H.265"
|
return "H.265"
|
||||||
}
|
}
|
||||||
|
|
||||||
return "Unknown"
|
return unknownString
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user