mirror of
https://github.com/aler9/rtsp-simple-server
synced 2025-10-18 13:40:50 +08:00
remove useless append()
This commit is contained in:
@@ -395,7 +395,7 @@ func (s *rtspSession) onPacketRTP(ctx *gortsplib.ServerHandlerOnPacketRTPCtx) {
|
||||
rtpPacket: ctx.Packet,
|
||||
ptsEqualsDTS: ctx.PTSEqualsDTS,
|
||||
pts: ctx.H264PTS,
|
||||
h264NALUs: append([][]byte(nil), ctx.H264NALUs...),
|
||||
h264NALUs: ctx.H264NALUs,
|
||||
})
|
||||
} else {
|
||||
s.stream.writeData(&data{
|
||||
|
@@ -146,7 +146,7 @@ func (s *rtspSource) run(ctx context.Context) error {
|
||||
rtpPacket: ctx.Packet,
|
||||
ptsEqualsDTS: ctx.PTSEqualsDTS,
|
||||
pts: ctx.H264PTS,
|
||||
h264NALUs: append([][]byte(nil), ctx.H264NALUs...),
|
||||
h264NALUs: ctx.H264NALUs,
|
||||
})
|
||||
} else {
|
||||
res.stream.writeData(&data{
|
||||
|
@@ -40,12 +40,12 @@ func (t *streamTrackH264) updateTrackParameters(nalus [][]byte) {
|
||||
switch typ {
|
||||
case h264.NALUTypeSPS:
|
||||
if !bytes.Equal(nalu, t.track.SafeSPS()) {
|
||||
t.track.SafeSetSPS(append([]byte(nil), nalu...))
|
||||
t.track.SafeSetSPS(nalu)
|
||||
}
|
||||
|
||||
case h264.NALUTypePPS:
|
||||
if !bytes.Equal(nalu, t.track.SafePPS()) {
|
||||
t.track.SafeSetPPS(append([]byte(nil), nalu...))
|
||||
t.track.SafeSetPPS(nalu)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -163,7 +163,7 @@ func (m *muxerVariantFMP4Segmenter) writeH264Entry(sample *fmp4.VideoSample) err
|
||||
|
||||
m.videoFirstIDRReceived = true
|
||||
m.videoDTSExtractor = h264.NewDTSExtractor()
|
||||
m.videoSPS = append([]byte(nil), m.videoTrack.SafeSPS()...)
|
||||
m.videoSPS = m.videoTrack.SafeSPS()
|
||||
|
||||
var err error
|
||||
sample.DTS, err = m.videoDTSExtractor.Extract(sample.NALUs, sample.PTS)
|
||||
@@ -249,7 +249,7 @@ func (m *muxerVariantFMP4Segmenter) writeH264Entry(sample *fmp4.VideoSample) err
|
||||
|
||||
// if SPS changed, reset adjusted part duration
|
||||
if spsChanged {
|
||||
m.videoSPS = append([]byte(nil), sps...)
|
||||
m.videoSPS = sps
|
||||
m.firstSegmentFinalized = false
|
||||
m.sampleDurations = make(map[time.Duration]struct{})
|
||||
}
|
||||
|
Reference in New Issue
Block a user