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.
This commit is contained in:
aler9 2022-08-16 13:13:34 +02:00
parent 4990e98993
commit 51e0bbd975

View File

@ -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