forked from External/mediamtx
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.
This commit is contained in:
parent
5ba46e6c8f
commit
3606472e82
14 changed files with 397 additions and 281 deletions
|
|
@ -125,7 +125,10 @@ func (s *rtspSource) run(ctx context.Context) error {
|
|||
}
|
||||
}
|
||||
|
||||
res := s.parent.sourceStaticImplSetReady(pathSourceStaticSetReadyReq{tracks: tracks})
|
||||
res := s.parent.sourceStaticImplSetReady(pathSourceStaticSetReadyReq{
|
||||
tracks: tracks,
|
||||
generateRTPPackets: false,
|
||||
})
|
||||
if res.err != nil {
|
||||
return res.err
|
||||
}
|
||||
|
|
@ -140,15 +143,15 @@ func (s *rtspSource) run(ctx context.Context) error {
|
|||
if ctx.H264NALUs != nil {
|
||||
res.stream.writeData(&data{
|
||||
trackID: ctx.TrackID,
|
||||
rtp: ctx.Packet,
|
||||
rtpPacket: ctx.Packet,
|
||||
ptsEqualsDTS: ctx.PTSEqualsDTS,
|
||||
pts: ctx.H264PTS,
|
||||
h264NALUs: append([][]byte(nil), ctx.H264NALUs...),
|
||||
h264PTS: ctx.H264PTS,
|
||||
})
|
||||
} else {
|
||||
res.stream.writeData(&data{
|
||||
trackID: ctx.TrackID,
|
||||
rtp: ctx.Packet,
|
||||
rtpPacket: ctx.Packet,
|
||||
ptsEqualsDTS: ctx.PTSEqualsDTS,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue