mirror of
https://github.com/bluenviron/mediamtx
synced 2024-12-15 19:24:55 +00:00
parent
bd1cb35022
commit
30a69a7722
@ -43,6 +43,21 @@ var testMediaH264 = &description.Media{
|
||||
Formats: []format.Format{testFormatH264},
|
||||
}
|
||||
|
||||
var testMediaAAC = &description.Media{
|
||||
Type: description.MediaTypeAudio,
|
||||
Formats: []format.Format{&format.MPEG4Audio{
|
||||
PayloadTyp: 96,
|
||||
Config: &mpeg4audio.Config{
|
||||
Type: 2,
|
||||
SampleRate: 44100,
|
||||
ChannelCount: 2,
|
||||
},
|
||||
SizeLength: 13,
|
||||
IndexLength: 3,
|
||||
IndexDeltaLength: 3,
|
||||
}},
|
||||
}
|
||||
|
||||
func httpRequest(t *testing.T, hc *http.Client, method string, ur string, in interface{}, out interface{}) {
|
||||
buf := func() io.Reader {
|
||||
if in == nil {
|
||||
@ -247,20 +262,7 @@ func TestAPIPathsList(t *testing.T) {
|
||||
"rtsp://localhost:8554/mypath",
|
||||
&description.Session{Medias: []*description.Media{
|
||||
media0,
|
||||
{
|
||||
Type: description.MediaTypeAudio,
|
||||
Formats: []format.Format{&format.MPEG4Audio{
|
||||
PayloadTyp: 96,
|
||||
Config: &mpeg4audio.Config{
|
||||
Type: 2,
|
||||
SampleRate: 44100,
|
||||
ChannelCount: 2,
|
||||
},
|
||||
SizeLength: 13,
|
||||
IndexLength: 3,
|
||||
IndexDeltaLength: 3,
|
||||
}},
|
||||
},
|
||||
testMediaAAC,
|
||||
}})
|
||||
require.NoError(t, err)
|
||||
defer source.Close()
|
||||
@ -314,24 +316,8 @@ func TestAPIPathsList(t *testing.T) {
|
||||
source := gortsplib.Client{TLSConfig: &tls.Config{InsecureSkipVerify: true}}
|
||||
err = source.StartRecording("rtsps://localhost:8322/mypath",
|
||||
&description.Session{Medias: []*description.Media{
|
||||
{
|
||||
Type: description.MediaTypeVideo,
|
||||
Formats: []format.Format{testFormatH264},
|
||||
},
|
||||
{
|
||||
Type: description.MediaTypeAudio,
|
||||
Formats: []format.Format{&format.MPEG4Audio{
|
||||
PayloadTyp: 97,
|
||||
Config: &mpeg4audio.Config{
|
||||
Type: 2,
|
||||
SampleRate: 44100,
|
||||
ChannelCount: 2,
|
||||
},
|
||||
SizeLength: 13,
|
||||
IndexLength: 3,
|
||||
IndexDeltaLength: 3,
|
||||
}},
|
||||
},
|
||||
testMediaH264,
|
||||
testMediaAAC,
|
||||
}})
|
||||
require.NoError(t, err)
|
||||
defer source.Close()
|
||||
|
@ -866,6 +866,14 @@ func (pa *path) handleAddReader(req pathAddReaderReq) {
|
||||
}
|
||||
|
||||
func (pa *path) handleAddReaderPost(req pathAddReaderReq) {
|
||||
if _, ok := pa.readers[req.author]; ok {
|
||||
req.res <- pathAddReaderRes{
|
||||
path: pa,
|
||||
stream: pa.stream,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if pa.conf.MaxReaders != 0 && len(pa.readers) >= pa.conf.MaxReaders {
|
||||
req.res <- pathAddReaderRes{
|
||||
err: fmt.Errorf("maximum reader count reached"),
|
||||
|
@ -284,7 +284,10 @@ func TestPathMaxReaders(t *testing.T) {
|
||||
source := gortsplib.Client{}
|
||||
err := source.StartRecording(
|
||||
"rtsp://localhost:8554/mystream",
|
||||
&description.Session{Medias: []*description.Media{testMediaH264}})
|
||||
&description.Session{Medias: []*description.Media{
|
||||
testMediaH264,
|
||||
testMediaAAC,
|
||||
}})
|
||||
require.NoError(t, err)
|
||||
defer source.Close()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user