适配3.1

This commit is contained in:
langhuihui
2021-07-09 08:18:19 +08:00
parent ba9f39853f
commit cc731a25f0
3 changed files with 5 additions and 10 deletions

View File

@@ -164,12 +164,12 @@ func (rtsp *RTSP) setVideoTrack() {
if rtsp.VSdp.Codec == "H264" {
rtsp.RtpVideo = rtsp.NewRTPVideo(7)
if len(rtsp.VSdp.SpropParameterSets) > 1 {
rtsp.RtpVideo.PushNalu(VideoPack{NALUs: rtsp.VSdp.SpropParameterSets})
rtsp.RtpVideo.PushNalu(0, 0, rtsp.VSdp.SpropParameterSets...)
}
} else if rtsp.VSdp.Codec == "H265" {
rtsp.RtpVideo = rtsp.NewRTPVideo(12)
if len(rtsp.VSdp.VPS) > 0 {
rtsp.RtpVideo.PushNalu(VideoPack{NALUs: [][]byte{rtsp.VSdp.VPS, rtsp.VSdp.SPS, rtsp.VSdp.PPS}})
rtsp.RtpVideo.PushNalu(0, 0, rtsp.VSdp.VPS, rtsp.VSdp.SPS, rtsp.VSdp.PPS)
}
}
}

View File

@@ -60,6 +60,8 @@ func ParseSDP(sdpRaw string) map[string]*SDPInfo {
switch keyval[0] {
case "H264", "H265", "PCMA", "PCMU":
info.Codec = keyval[0]
case "HEVC":
info.Codec = "H265"
case "MPEG4-GENERIC":
info.Codec = "AAC"
}

View File

@@ -14,7 +14,6 @@ import (
. "github.com/Monibuca/engine/v3"
. "github.com/Monibuca/utils/v3"
"github.com/Monibuca/utils/v3/codec"
"github.com/pion/rtp"
"github.com/teris-io/shortid"
)
@@ -129,13 +128,7 @@ func (session *RTSP) AcceptPush() {
Println("Recv an audio RTP package")
timer = time.Now()
}
if session.RtpAudio.CodecID == 10 {
for _, payload := range codec.ParseRTPAAC(rtpBytes) {
session.RtpAudio.Push(payload)
}
} else {
session.RtpAudio.Push(rtpBytes)
}
session.RtpAudio.Push(rtpBytes)
case session.aRTPControlChannel:
// pack.Type = RTP_TYPE_AUDIOCONTROL
case session.vRTPChannel: