mirror of
https://github.com/Monibuca/plugin-rtsp.git
synced 2025-09-26 19:51:14 +08:00
增加对publisher的非空判断
This commit is contained in:
@@ -314,11 +314,15 @@ func (client *RTSP) startStream() {
|
||||
|
||||
switch channel {
|
||||
case client.aRTPChannel:
|
||||
client.RtpAudio.Push(content)
|
||||
if client.RtpAudio != nil {
|
||||
client.RtpAudio.Push(content)
|
||||
}
|
||||
case client.aRTPControlChannel:
|
||||
|
||||
case client.vRTPChannel:
|
||||
client.RtpVideo.Push(content)
|
||||
if client.RtpVideo != nil {
|
||||
client.RtpVideo.Push(content)
|
||||
}
|
||||
case client.vRTPControlChannel:
|
||||
|
||||
default:
|
||||
|
24
session.go
24
session.go
@@ -125,22 +125,26 @@ func (session *RTSP) AcceptPush() {
|
||||
switch channel {
|
||||
case session.aRTPChannel:
|
||||
// pack.Type = RTP_TYPE_AUDIO
|
||||
elapsed := time.Since(timer)
|
||||
if elapsed >= 30*time.Second {
|
||||
Println("Recv an audio RTP package")
|
||||
timer = time.Now()
|
||||
if session.RtpAudio != nil {
|
||||
elapsed := time.Since(timer)
|
||||
if elapsed >= 30*time.Second {
|
||||
Println("Recv an audio RTP package")
|
||||
timer = time.Now()
|
||||
}
|
||||
session.RtpAudio.Push(rtpBytes)
|
||||
}
|
||||
session.RtpAudio.Push(rtpBytes)
|
||||
case session.aRTPControlChannel:
|
||||
// pack.Type = RTP_TYPE_AUDIOCONTROL
|
||||
case session.vRTPChannel:
|
||||
// pack.Type = RTP_TYPE_VIDEO
|
||||
elapsed := time.Since(timer)
|
||||
if elapsed >= 30*time.Second {
|
||||
Println("Recv an video RTP package")
|
||||
timer = time.Now()
|
||||
if session.RtpVideo != nil {
|
||||
elapsed := time.Since(timer)
|
||||
if elapsed >= 30*time.Second {
|
||||
Println("Recv an video RTP package")
|
||||
timer = time.Now()
|
||||
}
|
||||
session.RtpVideo.Push(rtpBytes)
|
||||
}
|
||||
session.RtpVideo.Push(rtpBytes)
|
||||
case session.vRTPControlChannel:
|
||||
// pack.Type = RTP_TYPE_VIDEOCONTROL
|
||||
default:
|
||||
|
Reference in New Issue
Block a user