mediamtx/internal/core/streamtrack.go
aler9 3606472e82 generate RTP packets after H264 remuxing
Previously, RTP packets coming from sources other than RTSP (that
actually are RTMP and HLS) were generated before the H264 remuxing, and
that leaded to invalid streams, expecially when sourceOnDemand is true
and the stream has invalid or dynamic SPS/PPS.
2022-08-14 13:03:04 +02:00

28 lines
685 B
Go

package core
import (
"fmt"
"github.com/aler9/gortsplib"
)
type streamTrack interface {
writeData(*data)
}
func newStreamTrack(track gortsplib.Track, generateRTPPackets bool, writeDataInner func(*data)) (streamTrack, error) {
switch ttrack := track.(type) {
case *gortsplib.TrackH264:
return newStreamTrackH264(ttrack, generateRTPPackets, writeDataInner), nil
case *gortsplib.TrackMPEG4Audio:
return newStreamTrackMPEG4Audio(ttrack, generateRTPPackets, writeDataInner), nil
default:
if generateRTPPackets {
return nil, fmt.Errorf("we don't know how to generate RTP packets of track %+v", track)
}
return newStreamTrackGeneric(track, writeDataInner), nil
}
}