mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-20 02:00:05 -08:00
do not include recorder and HLS muxer in sent bytes (#4380) (#5039)
Some checks are pending
code_lint / go (push) Waiting to run
code_lint / go_mod (push) Waiting to run
code_lint / docs (push) Waiting to run
code_lint / api_docs (push) Waiting to run
code_test / test_64 (push) Waiting to run
code_test / test_32 (push) Waiting to run
code_test / test_e2e (push) Waiting to run
Some checks are pending
code_lint / go (push) Waiting to run
code_lint / go_mod (push) Waiting to run
code_lint / docs (push) Waiting to run
code_lint / api_docs (push) Waiting to run
code_test / test_64 (push) Waiting to run
code_test / test_32 (push) Waiting to run
code_test / test_e2e (push) Waiting to run
in API (/paths/list, /paths/get) and metrics (paths_bytes_sent), the amount of sent bytes was increased even in case of writes to the recorder and HLS muxer, which are not generating network traffic. This fixes the issue.
This commit is contained in:
parent
ada39d22cd
commit
cd80814009
28 changed files with 615 additions and 656 deletions
|
|
@ -409,13 +409,13 @@ func TestFromStream(t *testing.T) {
|
|||
err = conn.Accept()
|
||||
require.NoError(t, err)
|
||||
|
||||
reader := test.NilLogger
|
||||
r := &stream.Reader{Parent: test.NilLogger}
|
||||
|
||||
err = FromStream(strm, reader, conn, nconn, 10*time.Second)
|
||||
err = FromStream(strm.Desc, r, conn, nconn, 10*time.Second)
|
||||
require.NoError(t, err)
|
||||
defer strm.RemoveReader(reader)
|
||||
|
||||
strm.StartReader(reader)
|
||||
strm.AddReader(r)
|
||||
defer strm.RemoveReader(r)
|
||||
|
||||
switch ca {
|
||||
case "h264 + aac":
|
||||
|
|
@ -675,56 +675,44 @@ func TestFromStream(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestFromStreamNoSupportedCodecs(t *testing.T) {
|
||||
strm := &stream.Stream{
|
||||
WriteQueueSize: 512,
|
||||
RTPMaxPayloadSize: 1450,
|
||||
Desc: &description.Session{Medias: []*description.Media{{
|
||||
Type: description.MediaTypeVideo,
|
||||
Formats: []format.Format{&format.VP8{}},
|
||||
}}},
|
||||
GenerateRTPPackets: true,
|
||||
Parent: test.NilLogger,
|
||||
desc := &description.Session{Medias: []*description.Media{{
|
||||
Type: description.MediaTypeVideo,
|
||||
Formats: []format.Format{&format.VP8{}},
|
||||
}}}
|
||||
|
||||
r := &stream.Reader{
|
||||
Parent: test.Logger(func(logger.Level, string, ...interface{}) {
|
||||
t.Error("should not happen")
|
||||
}),
|
||||
}
|
||||
err := strm.Initialize()
|
||||
require.NoError(t, err)
|
||||
|
||||
l := test.Logger(func(logger.Level, string, ...interface{}) {
|
||||
t.Error("should not happen")
|
||||
})
|
||||
|
||||
err = FromStream(strm, l, nil, nil, 0)
|
||||
err := FromStream(desc, r, nil, nil, 0)
|
||||
require.Equal(t, errNoSupportedCodecsFrom, err)
|
||||
}
|
||||
|
||||
func TestFromStreamSkipUnsupportedTracks(t *testing.T) {
|
||||
strm := &stream.Stream{
|
||||
WriteQueueSize: 512,
|
||||
RTPMaxPayloadSize: 1450,
|
||||
Desc: &description.Session{Medias: []*description.Media{
|
||||
{
|
||||
Type: description.MediaTypeVideo,
|
||||
Formats: []format.Format{&format.VP8{}},
|
||||
},
|
||||
{
|
||||
Type: description.MediaTypeVideo,
|
||||
Formats: []format.Format{&format.H264{}},
|
||||
},
|
||||
}},
|
||||
GenerateRTPPackets: true,
|
||||
Parent: test.NilLogger,
|
||||
}
|
||||
err := strm.Initialize()
|
||||
require.NoError(t, err)
|
||||
desc := &description.Session{Medias: []*description.Media{
|
||||
{
|
||||
Type: description.MediaTypeVideo,
|
||||
Formats: []format.Format{&format.VP8{}},
|
||||
},
|
||||
{
|
||||
Type: description.MediaTypeVideo,
|
||||
Formats: []format.Format{&format.H264{}},
|
||||
},
|
||||
}}
|
||||
|
||||
n := 0
|
||||
|
||||
l := test.Logger(func(l logger.Level, format string, args ...interface{}) {
|
||||
require.Equal(t, logger.Warn, l)
|
||||
if n == 0 {
|
||||
require.Equal(t, "skipping track 1 (VP8)", fmt.Sprintf(format, args...))
|
||||
}
|
||||
n++
|
||||
})
|
||||
r := &stream.Reader{
|
||||
Parent: test.Logger(func(l logger.Level, format string, args ...interface{}) {
|
||||
require.Equal(t, logger.Warn, l)
|
||||
if n == 0 {
|
||||
require.Equal(t, "skipping track 1 (VP8)", fmt.Sprintf(format, args...))
|
||||
}
|
||||
n++
|
||||
}),
|
||||
}
|
||||
|
||||
ln, err := net.Listen("tcp", "127.0.0.1:9121")
|
||||
require.NoError(t, err)
|
||||
|
|
@ -754,9 +742,8 @@ func TestFromStreamSkipUnsupportedTracks(t *testing.T) {
|
|||
err = conn.Accept()
|
||||
require.NoError(t, err)
|
||||
|
||||
err = FromStream(strm, l, conn, nil, 0)
|
||||
err = FromStream(desc, r, conn, nil, 0)
|
||||
require.NoError(t, err)
|
||||
defer strm.RemoveReader(l)
|
||||
|
||||
require.Equal(t, 1, n)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue