From 50d6b2e9166e3e94d0d37b10e877d1a23f21c73d Mon Sep 17 00:00:00 2001 From: aler9 <46489434+aler9@users.noreply.github.com> Date: Tue, 13 Dec 2022 17:10:01 +0100 Subject: [PATCH] fix race condition when calling format.Clone() --- pkg/format/h264.go | 4 ++-- pkg/format/h265.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/format/h264.go b/pkg/format/h264.go index edf0b06f..3868bbd5 100644 --- a/pkg/format/h264.go +++ b/pkg/format/h264.go @@ -181,8 +181,8 @@ func (t *H264) Marshal() (string, string) { func (t *H264) Clone() Format { return &H264{ PayloadTyp: t.PayloadTyp, - SPS: t.SPS, - PPS: t.PPS, + SPS: t.SafeSPS(), + PPS: t.SafePPS(), PacketizationMode: t.PacketizationMode, } } diff --git a/pkg/format/h265.go b/pkg/format/h265.go index 72e3003a..3bf8393f 100644 --- a/pkg/format/h265.go +++ b/pkg/format/h265.go @@ -121,9 +121,9 @@ func (t *H265) Marshal() (string, string) { func (t *H265) Clone() Format { return &H265{ PayloadTyp: t.PayloadTyp, - VPS: t.VPS, - SPS: t.SPS, - PPS: t.PPS, + VPS: t.SafeVPS(), + SPS: t.SafeSPS(), + PPS: t.SafePPS(), MaxDONDiff: t.MaxDONDiff, } }