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:
parent
4f4a13540f
commit
a40b3a0e80
@ -5,6 +5,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/nareix/joy5/format/flv/flvio"
|
"github.com/nareix/joy5/format/flv/flvio"
|
||||||
"github.com/owncast/owncast/models"
|
"github.com/owncast/owncast/models"
|
||||||
@ -12,6 +13,9 @@ import (
|
|||||||
|
|
||||||
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, "@setDataFrame") {
|
||||||
|
return models.RTMPStreamMetadata{}, errors.New("Not a setDataFrame message")
|
||||||
|
}
|
||||||
re := regexp.MustCompile(`\{(.*?)\}`)
|
re := regexp.MustCompile(`\{(.*?)\}`)
|
||||||
submatchall := re.FindAllString(metadataComponentsString, 1)
|
submatchall := re.FindAllString(metadataComponentsString, 1)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user