Use strings.Cut when parsing fmtp.
This commit is contained in:
+3
-6
@@ -181,12 +181,9 @@ func (g *Group) API() (*webrtc.API, error) {
|
|||||||
func fmtpValue(fmtp, key string) string {
|
func fmtpValue(fmtp, key string) string {
|
||||||
fields := strings.Split(fmtp, ";")
|
fields := strings.Split(fmtp, ";")
|
||||||
for _, f := range fields {
|
for _, f := range fields {
|
||||||
kv := strings.SplitN(f, "=", 2)
|
k, v, found := strings.Cut(f, "=")
|
||||||
if len(kv) != 2 {
|
if found && k == key {
|
||||||
continue
|
return v
|
||||||
}
|
|
||||||
if kv[0] == key {
|
|
||||||
return kv[1]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
|
|||||||
Reference in New Issue
Block a user