mirror of
https://github.com/Monibuca/plugin-rtsp.git
synced 2025-09-27 03:56:08 +08:00
修正升级带来的bug
This commit is contained in:
28
session.go
28
session.go
@@ -317,21 +317,21 @@ func (session *RTSP) handleRequest(req *Request) {
|
||||
|
||||
session.SDPRaw = req.Body
|
||||
session.SDPMap = ParseSDP(req.Body)
|
||||
sdp, ok := session.SDPMap["audio"]
|
||||
if ok {
|
||||
session.AControl = sdp.Control
|
||||
session.ACodec = sdp.Codec
|
||||
session.WriteASC(sdp.Config)
|
||||
Printf("audio codec[%s]\n", session.ACodec)
|
||||
}
|
||||
if sdp, ok = session.SDPMap["video"]; ok {
|
||||
session.VControl = sdp.Control
|
||||
session.VCodec = sdp.Codec
|
||||
session.WriteSPS(sdp.SpropParameterSets[0])
|
||||
session.WritePPS(sdp.SpropParameterSets[1])
|
||||
Printf("video codec[%s]\n", session.VCodec)
|
||||
}
|
||||
if session.Publish(streamPath) {
|
||||
sdp, ok := session.SDPMap["audio"]
|
||||
if ok {
|
||||
session.AControl = sdp.Control
|
||||
session.ACodec = sdp.Codec
|
||||
session.WriteASC(sdp.Config)
|
||||
Printf("audio codec[%s]\n", session.ACodec)
|
||||
}
|
||||
if sdp, ok = session.SDPMap["video"]; ok {
|
||||
session.VControl = sdp.Control
|
||||
session.VCodec = sdp.Codec
|
||||
session.WriteSPS(sdp.SpropParameterSets[0])
|
||||
session.WritePPS(sdp.SpropParameterSets[1])
|
||||
Printf("video codec[%s]\n", session.VCodec)
|
||||
}
|
||||
session.Stream.Type = "RTSP"
|
||||
session.RTSPInfo.StreamInfo = &session.Stream.StreamInfo
|
||||
collection.Store(streamPath, session)
|
||||
|
@@ -2,13 +2,14 @@ package rtsp
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
. "github.com/Monibuca/engine/v2"
|
||||
. "github.com/Monibuca/plugin-rtp"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
. "github.com/Monibuca/engine/v2"
|
||||
. "github.com/Monibuca/plugin-rtp"
|
||||
)
|
||||
|
||||
type UDPServer struct {
|
||||
@@ -94,7 +95,7 @@ func (s *UDPServer) SetupAudio() (err error) {
|
||||
pack := &RTPPack{
|
||||
Type: RTP_TYPE_AUDIO,
|
||||
}
|
||||
pack.Unmarshal(bufUDP)
|
||||
pack.Unmarshal(bufUDP[:n])
|
||||
s.HandleRTP(pack)
|
||||
} else {
|
||||
Println("udp server read audio pack error", err)
|
||||
@@ -133,7 +134,7 @@ func (s *UDPServer) SetupAudio() (err error) {
|
||||
pack := &RTPPack{
|
||||
Type: RTP_TYPE_AUDIOCONTROL,
|
||||
}
|
||||
pack.Unmarshal(bufUDP)
|
||||
pack.Unmarshal(bufUDP[:n])
|
||||
s.HandleRTP(pack)
|
||||
} else {
|
||||
Println("udp server read audio control pack error", err)
|
||||
@@ -182,7 +183,7 @@ func (s *UDPServer) SetupVideo() (err error) {
|
||||
pack := &RTPPack{
|
||||
Type: RTP_TYPE_VIDEO,
|
||||
}
|
||||
pack.Unmarshal(bufUDP)
|
||||
pack.Unmarshal(bufUDP[:n])
|
||||
s.HandleRTP(pack)
|
||||
} else {
|
||||
Println("udp server read video pack error", err)
|
||||
@@ -222,7 +223,7 @@ func (s *UDPServer) SetupVideo() (err error) {
|
||||
pack := &RTPPack{
|
||||
Type: RTP_TYPE_VIDEOCONTROL,
|
||||
}
|
||||
pack.Unmarshal(bufUDP)
|
||||
pack.Unmarshal(bufUDP[:n])
|
||||
s.HandleRTP(pack)
|
||||
} else {
|
||||
Println("udp server read video control pack error", err)
|
||||
|
Reference in New Issue
Block a user