mirror of
https://github.com/bluenviron/mediamtx
synced 2025-02-05 22:22:21 +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.
57 lines
923 B
Go
57 lines
923 B
Go
package core
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/pion/rtp"
|
|
)
|
|
|
|
// data is the data unit routed across the server.
|
|
type data interface {
|
|
getRTPPackets() []*rtp.Packet
|
|
getNTP() time.Time
|
|
}
|
|
|
|
type dataGeneric struct {
|
|
rtpPackets []*rtp.Packet
|
|
ntp time.Time
|
|
}
|
|
|
|
func (d *dataGeneric) getRTPPackets() []*rtp.Packet {
|
|
return d.rtpPackets
|
|
}
|
|
|
|
func (d *dataGeneric) getNTP() time.Time {
|
|
return d.ntp
|
|
}
|
|
|
|
type dataH264 struct {
|
|
rtpPackets []*rtp.Packet
|
|
ntp time.Time
|
|
pts time.Duration
|
|
nalus [][]byte
|
|
}
|
|
|
|
func (d *dataH264) getRTPPackets() []*rtp.Packet {
|
|
return d.rtpPackets
|
|
}
|
|
|
|
func (d *dataH264) getNTP() time.Time {
|
|
return d.ntp
|
|
}
|
|
|
|
type dataMPEG4Audio struct {
|
|
rtpPackets []*rtp.Packet
|
|
ntp time.Time
|
|
pts time.Duration
|
|
aus [][]byte
|
|
}
|
|
|
|
func (d *dataMPEG4Audio) getRTPPackets() []*rtp.Packet {
|
|
return d.rtpPackets
|
|
}
|
|
|
|
func (d *dataMPEG4Audio) getNTP() time.Time {
|
|
return d.ntp
|
|
}
|