mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 23:26:54 +08:00
@@ -16,15 +16,19 @@ import (
|
|||||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||||
)
|
)
|
||||||
|
|
||||||
var smartRegexp = regexp.MustCompile("^([0-9]+) (.*?)/90000")
|
var (
|
||||||
|
smartPayloadTypeRegexp = regexp.MustCompile("^smart/[0-9]/[0-9]+$")
|
||||||
|
smartRtpmapRegexp = regexp.MustCompile("^([0-9]+) (.+)/[0-9]+$")
|
||||||
|
)
|
||||||
|
|
||||||
func replaceSmartPayloadType(payloadType string, attributes []psdp.Attribute) string {
|
func replaceSmartPayloadType(payloadType string, attributes []psdp.Attribute) string {
|
||||||
if payloadType == "smart/1/90000" {
|
re1 := smartPayloadTypeRegexp.FindStringSubmatch(payloadType)
|
||||||
|
if re1 != nil {
|
||||||
for _, attr := range attributes {
|
for _, attr := range attributes {
|
||||||
if attr.Key == "rtpmap" {
|
if attr.Key == "rtpmap" {
|
||||||
sm := smartRegexp.FindStringSubmatch(attr.Value)
|
re2 := smartRtpmapRegexp.FindStringSubmatch(attr.Value)
|
||||||
if sm != nil {
|
if re2 != nil {
|
||||||
return sm[1]
|
return re2[1]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -550,7 +550,7 @@ var casesSession = []struct {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"tp-link",
|
"issue mediamtx/1267 (tp-link)",
|
||||||
"v=0\r\n" +
|
"v=0\r\n" +
|
||||||
"o=- 4158123474391860926 2 IN IP4 127.0.0.1\r\n" +
|
"o=- 4158123474391860926 2 IN IP4 127.0.0.1\r\n" +
|
||||||
"s=-\r\n" +
|
"s=-\r\n" +
|
||||||
@@ -579,6 +579,39 @@ var casesSession = []struct {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"issue gortsplib/509 (tp-link)",
|
||||||
|
"v=0\n" +
|
||||||
|
"o=- 14665860 31787219 1 IN IP4 192.168.1.102\n" +
|
||||||
|
"s=Session streamed by \"TP-LINK RTSP Server\"\n" +
|
||||||
|
"t=0 0\n" +
|
||||||
|
"a=smart_encoder:virtualIFrame=1\n" +
|
||||||
|
"m=application/tp-link 0 RTP/AVP smart/0/25000\n" +
|
||||||
|
"a=rtpmap:95 tp-link/25000\n" +
|
||||||
|
"a=control:track3\n",
|
||||||
|
"v=0\r\n" +
|
||||||
|
"o=- 0 0 IN IP4 127.0.0.1\r\n" +
|
||||||
|
"s=Session streamed by \"TP-LINK RTSP Server\"\r\n" +
|
||||||
|
"c=IN IP4 0.0.0.0\r\n" +
|
||||||
|
"t=0 0\r\n" +
|
||||||
|
"m=application/tp-link 0 RTP/AVP 95\r\n" +
|
||||||
|
"a=control:track3\r\n" +
|
||||||
|
"a=rtpmap:95 tp-link/25000\r\n",
|
||||||
|
Session{
|
||||||
|
Title: `Session streamed by "TP-LINK RTSP Server"`,
|
||||||
|
Medias: []*Media{
|
||||||
|
{
|
||||||
|
Type: "application/tp-link",
|
||||||
|
Formats: []format.Format{&format.Generic{
|
||||||
|
PayloadTyp: 95,
|
||||||
|
RTPMa: "tp-link/25000",
|
||||||
|
ClockRat: 25000,
|
||||||
|
}},
|
||||||
|
Control: "track3",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"mercury",
|
"mercury",
|
||||||
"v=0\n" +
|
"v=0\n" +
|
||||||
|
Reference in New Issue
Block a user