mirror of
https://github.com/bluenviron/mediamtx
synced 2025-03-05 11:57:33 +00:00
rtsp server: allow again H264 tracks without SPS or PPS in the SDP (#787)
This commit is contained in:
parent
343a5f17fb
commit
3e8668f9e2
@ -125,16 +125,6 @@ func (s *rtspSession) onClose(err error) {
|
|||||||
|
|
||||||
// onAnnounce is called by rtspServer.
|
// onAnnounce is called by rtspServer.
|
||||||
func (s *rtspSession) onAnnounce(c *rtspConn, ctx *gortsplib.ServerHandlerOnAnnounceCtx) (*base.Response, error) {
|
func (s *rtspSession) onAnnounce(c *rtspConn, ctx *gortsplib.ServerHandlerOnAnnounceCtx) (*base.Response, error) {
|
||||||
for i, track := range ctx.Tracks {
|
|
||||||
if th264, ok := track.(*gortsplib.TrackH264); ok {
|
|
||||||
if th264.SPS() == nil || th264.PPS() == nil {
|
|
||||||
return &base.Response{
|
|
||||||
StatusCode: base.StatusBadRequest,
|
|
||||||
}, fmt.Errorf("track %d can't be used: H264 SPS or PPS not provided into the SDP", i)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
res := s.pathManager.onPublisherAnnounce(pathPublisherAnnounceReq{
|
res := s.pathManager.onPublisherAnnounce(pathPublisherAnnounceReq{
|
||||||
author: s,
|
author: s,
|
||||||
pathName: ctx.Path,
|
pathName: ctx.Path,
|
||||||
|
@ -198,7 +198,7 @@ func TestMuxerCloseBeforeFirstSegment(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMuxerMaxSegmentSize(t *testing.T) {
|
func TestMuxerMaxSegmentSize(t *testing.T) {
|
||||||
videoTrack, err := gortsplib.NewTrackH264(96,[]byte{0x07, 0x01, 0x02, 0x03}, []byte{0x08}, nil)
|
videoTrack, err := gortsplib.NewTrackH264(96, []byte{0x07, 0x01, 0x02, 0x03}, []byte{0x08}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
m, err := NewMuxer(3, 1*time.Second, 0, videoTrack, nil)
|
m, err := NewMuxer(3, 1*time.Second, 0, videoTrack, nil)
|
||||||
|
@ -13,8 +13,8 @@ import (
|
|||||||
|
|
||||||
type muxerTSSegment struct {
|
type muxerTSSegment struct {
|
||||||
hlsSegmentMaxSize uint64
|
hlsSegmentMaxSize uint64
|
||||||
videoTrack gortsplib.Track
|
videoTrack gortsplib.Track
|
||||||
writer *muxerTSWriter
|
writer *muxerTSWriter
|
||||||
|
|
||||||
name string
|
name string
|
||||||
buf bytes.Buffer
|
buf bytes.Buffer
|
||||||
|
Loading…
Reference in New Issue
Block a user