mirror of
https://github.com/bluenviron/mediamtx.git
synced 2026-01-23 11:59:51 -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
38 lines
813 B
Go
38 lines
813 B
Go
package stream
|
|
|
|
import (
|
|
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
|
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
|
|
|
"github.com/bluenviron/mediamtx/internal/logger"
|
|
)
|
|
|
|
type streamMedia struct {
|
|
formats map[format.Format]*streamFormat
|
|
}
|
|
|
|
func newStreamMedia(udpMaxPayloadSize int,
|
|
medi *description.Media,
|
|
generateRTPPackets bool,
|
|
decodeErrLogger logger.Writer,
|
|
) (*streamMedia, error) {
|
|
sm := &streamMedia{
|
|
formats: make(map[format.Format]*streamFormat),
|
|
}
|
|
|
|
for _, forma := range medi.Formats {
|
|
sf := &streamFormat{
|
|
udpMaxPayloadSize: udpMaxPayloadSize,
|
|
format: forma,
|
|
generateRTPPackets: generateRTPPackets,
|
|
decodeErrLogger: decodeErrLogger,
|
|
}
|
|
err := sf.initialize()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
sm.formats[forma] = sf
|
|
}
|
|
|
|
return sm, nil
|
|
}
|