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