From 51e0bbd975ead00dbada88d558992ff265009aa3 Mon Sep 17 00:00:00 2001 From: aler9 <46489434+aler9@users.noreply.github.com> Date: Tue, 16 Aug 2022 13:13:34 +0200 Subject: [PATCH] rtmp server: stop inserting a AV_SEQHDR message before every IDR AV_SEQHDR contains SPS and PPS. It is useless to resend it after initialization since SPS/PPS are automatically added before every IDR. --- internal/core/rtmp_conn.go | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/internal/core/rtmp_conn.go b/internal/core/rtmp_conn.go index 89e5e38c..c125ecc5 100644 --- a/internal/core/rtmp_conn.go +++ b/internal/core/rtmp_conn.go @@ -404,28 +404,6 @@ func (c *rtmpConn) runRead(ctx context.Context, u *url.URL) error { pts -= videoStartDTS } - // insert a H264DecoderConfig before every IDR - if idrPresent { - sps := videoTrack.SafeSPS() - pps := videoTrack.SafePPS() - - buf, _ := h264conf.Conf{ - SPS: sps, - PPS: pps, - }.Marshal() - - err = c.conn.WriteMessage(&message.MsgVideo{ - ChunkStreamID: 6, - MessageStreamID: 1, - IsKeyFrame: true, - H264Type: flvio.AVC_SEQHDR, - Payload: buf, - }) - if err != nil { - return err - } - } - avcc, err := h264.AVCCMarshal(data.h264NALUs) if err != nil { return err