mirror of
https://github.com/Monibuca/plugin-rtsp.git
synced 2025-10-04 07:16:48 +08:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e6d0489d9c | ||
![]() |
68d0d9aa08 | ||
![]() |
e411d30e91 | ||
![]() |
709a4cee7b | ||
![]() |
a90f52769d | ||
![]() |
3764a26bbd | ||
![]() |
2533ab2604 | ||
![]() |
db07f0d588 |
@@ -42,6 +42,7 @@ func (rtsp *RTSPClient) PullStream(streamPath string, rtspUrl string) (err error
|
||||
time.Sleep(time.Second * 5)
|
||||
}
|
||||
if rtsp.IsTimeout {
|
||||
rtsp.processFunc = nil
|
||||
go rtsp.PullStream(streamPath, rtspUrl)
|
||||
}
|
||||
}()
|
||||
@@ -165,6 +166,9 @@ func (client *RTSPClient) pullStream() {
|
||||
Printf("connect:%s error:%v", client.URL, err)
|
||||
return
|
||||
}
|
||||
client.OnClose = func() {
|
||||
client.Client.Close()
|
||||
}
|
||||
//client.close should be after connected!
|
||||
defer client.Client.Close()
|
||||
var res *base.Response
|
||||
|
10
server.go
10
server.go
@@ -75,7 +75,7 @@ func (sh *RTSPServer) OnDescribe(ctx *gortsplib.ServerHandlerOnDescribeCtx) (*ba
|
||||
sub.Type = "RTSP pull"
|
||||
sub.vt = s.WaitVideoTrack("h264", "h265")
|
||||
sub.at = s.WaitAudioTrack("aac", "pcma", "pcmu")
|
||||
ssrc := uintptr(unsafe.Pointer(stream))
|
||||
ssrc := uintptr(unsafe.Pointer(&stream))
|
||||
var trackIds = 0
|
||||
if sub.vt != nil {
|
||||
trackId := trackIds
|
||||
@@ -98,7 +98,13 @@ func (sh *RTSPServer) OnDescribe(ctx *gortsplib.ServerHandlerOnDescribeCtx) (*ba
|
||||
var st uint32
|
||||
onVideo := func(ts uint32, pack *engine.VideoPack) {
|
||||
for i, nalu := range pack.NALUs {
|
||||
packs := vpacketer.Packetize(nalu, (ts-st)*90)
|
||||
var samples uint32
|
||||
if i == len(pack.NALUs)-1 {
|
||||
samples = (ts - st) * 90
|
||||
} else {
|
||||
samples = 0
|
||||
}
|
||||
packs := vpacketer.Packetize(nalu, samples)
|
||||
for j, rtpack := range packs {
|
||||
rtpack.Marker = i == len(pack.NALUs)-1 && j == len(packs)-1
|
||||
rtp, _ := rtpack.Marshal()
|
||||
|
Reference in New Issue
Block a user