mirror of
https://github.com/bluenviron/mediamtx
synced 2025-01-27 17:33:33 +00:00
3606472e82
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.
28 lines
685 B
Go
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
|
|
}
|
|
}
|