mirror of
https://github.com/cnotch/ipchub.git
synced 2025-09-26 19:41:18 +08:00
fixed bug for tp-link rtsp session format
This commit is contained in:
@@ -464,6 +464,14 @@ func (c *PullClient) receiveResponse() (resp *Response, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func trimSessionString(s string) string {
|
||||
idx := strings.Index(s, ";")
|
||||
if idx > 0 {
|
||||
return strings.TrimSpace(s[:idx])
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func (c *PullClient) requestWithResponse(r *Request) (*Response, error) {
|
||||
err := c.request(r)
|
||||
if err != nil {
|
||||
@@ -477,6 +485,10 @@ func (c *PullClient) requestWithResponse(r *Request) (*Response, error) {
|
||||
|
||||
// 保存 session
|
||||
c.rsession = resp.Header.Get(FieldSession)
|
||||
if len(c.rsession) > 0 {
|
||||
// Fixed: TP-Link RTSP session fields(5EA2A41D;timeout=15)
|
||||
c.rsession = trimSessionString(c.rsession)
|
||||
}
|
||||
|
||||
// 如果需要安全信息,增加安全信息并再次请求
|
||||
if resp.StatusCode == StatusUnauthorized {
|
||||
|
@@ -100,6 +100,24 @@ a=rtpmap:97 MPEG4-GENERIC/44100/2
|
||||
a=fmtp:97 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3; config=121056E500
|
||||
a=control:streamid=1
|
||||
`
|
||||
const sdpTplink500 = `v=0
|
||||
o=- 14665860 31787219 1 IN IP4 192.168.1.60
|
||||
s=Session streamed by "TP-LINK RTSP Server"
|
||||
t=0 0
|
||||
m=video 0 RTP/AVP 96
|
||||
c=IN IP4 0.0.0.0
|
||||
b=AS:4096
|
||||
a=range:npt=0-
|
||||
a=control:track1
|
||||
a=rtpmap:96 H265/90000
|
||||
a=fmtp:96 profile-space=0;profile-id=12;tier-flag=0;level-id=0;interop-constraints=600000000000;sprop-vps=AAAAAUABDAH//wFgAAADAAADAAADAAADAJasCQ==;sprop-sps=AAAAAUIBAQFgAAADAAADAAADAAADAJagAWggBln3ja5JMmuWMAgAAAMACAAAAwB4QA==;sprop-pps=AAAAAUQB4HawJkA=
|
||||
m=audio 0 RTP/AVP 8
|
||||
a=rtpmap:8 PCMA/8000
|
||||
a=control:track2
|
||||
m=application/TP-LINK 0 RTP/AVP smart/1/90000
|
||||
a=rtpmap:95 TP-LINK/90000
|
||||
a=control:track3
|
||||
`
|
||||
|
||||
func Benchmark_ThirdSdpParse(b *testing.B) {
|
||||
b.ResetTimer()
|
||||
|
Reference in New Issue
Block a user