Skip to content

Commit

Permalink
remove useless append()
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 committed Aug 14, 2022
1 parent 3606472 commit f952ff2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion internal/core/rtsp_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
2 changes: 1 addition & 1 deletion internal/core/rtsp_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
4 changes: 2 additions & 2 deletions internal/core/streamtrack_h264.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions internal/hls/muxer_variant_fmp4_segmenter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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{})
}
Expand Down

0 comments on commit f952ff2

Please sign in to comment.