mirror of
https://github.com/bluenviron/mediamtx
synced 2025-01-23 07:23:34 +00:00
c778c049ce
Fixes #1103 gortsplib/v2 supports multiple formats inside a single track (media). This allows to apply the resizing algorithm to single formats inside medias. For instance, if a media contains a a proprietary format and an H264 format, and the latter has oversized packets, they can now be resized.
27 lines
533 B
Go
27 lines
533 B
Go
package core
|
|
|
|
import (
|
|
"github.com/aler9/gortsplib/v2/pkg/format"
|
|
"github.com/aler9/gortsplib/v2/pkg/media"
|
|
)
|
|
|
|
type streamMedia struct {
|
|
formats map[format.Format]*streamFormat
|
|
}
|
|
|
|
func newStreamMedia(medi *media.Media, generateRTPPackets bool) (*streamMedia, error) {
|
|
sm := &streamMedia{
|
|
formats: make(map[format.Format]*streamFormat),
|
|
}
|
|
|
|
for _, forma := range medi.Formats {
|
|
var err error
|
|
sm.formats[forma], err = newStreamFormat(forma, generateRTPPackets)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
|
|
return sm, nil
|
|
}
|