mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-20 02:00:05 -08:00
Some checks are pending
code_lint / golangci_lint (push) Waiting to run
code_lint / mod_tidy (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_highlevel (push) Waiting to run
Discarded frames, decode errors and lost packets were logged individually, then there was a mechanism that prevented more than 1 log entry per second from being printed, resulting in inaccurate reports. Now discarded frames, decode errors and lost packets are accurately counted, and their count is printed once every second.
36 lines
827 B
Go
36 lines
827 B
Go
package stream
|
|
|
|
import (
|
|
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
|
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
|
"github.com/bluenviron/mediamtx/internal/counterdumper"
|
|
)
|
|
|
|
type streamMedia struct {
|
|
UDPMaxPayloadSize int
|
|
Media *description.Media
|
|
GenerateRTPPackets bool
|
|
DecodeErrors *counterdumper.CounterDumper
|
|
|
|
formats map[format.Format]*streamFormat
|
|
}
|
|
|
|
func (sm *streamMedia) initialize() error {
|
|
sm.formats = make(map[format.Format]*streamFormat)
|
|
|
|
for _, forma := range sm.Media.Formats {
|
|
sf := &streamFormat{
|
|
UDPMaxPayloadSize: sm.UDPMaxPayloadSize,
|
|
Format: forma,
|
|
GenerateRTPPackets: sm.GenerateRTPPackets,
|
|
DecodeErrors: sm.DecodeErrors,
|
|
}
|
|
err := sf.initialize()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
sm.formats[forma] = sf
|
|
}
|
|
|
|
return nil
|
|
}
|