0

Check if inbound details properly set before use (#365)

* Check if inbound details properly set before use

Fixes #340

* Only parse setDataFrame messages

* Remove unneeded guard
This commit is contained in:
Matt Steele 2020-11-16 22:14:22 -06:00 committed by GitHub
parent 4f4a13540f
commit a40b3a0e80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"regexp"
"strings"
"github.com/nareix/joy5/format/flv/flvio"
"github.com/owncast/owncast/models"
@ -12,6 +13,9 @@ import (
func getInboundDetailsFromMetadata(metadata []interface{}) (models.RTMPStreamMetadata, error) {
metadataComponentsString := fmt.Sprintf("%+v", metadata)
if !strings.Contains(metadataComponentsString, "@setDataFrame") {
return models.RTMPStreamMetadata{}, errors.New("Not a setDataFrame message")
}
re := regexp.MustCompile(`\{(.*?)\}`)
submatchall := re.FindAllString(metadataComponentsString, 1)