From e31fb41b6e44ff1aa4c7778ba802bb1fbcb14270 Mon Sep 17 00:00:00 2001 From: dexter <178529795@qq.com> Date: Sun, 13 Mar 2022 23:24:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20SplitBuffers=E5=87=BD=E6=95=B0=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E4=BF=AE=E6=94=B9=E5=8E=9F=E6=95=B0=E7=BB=84=E7=9A=84?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- subscriber.go | 2 +- util/buffer.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/subscriber.go b/subscriber.go index 43fb653..0d03af2 100644 --- a/subscriber.go +++ b/subscriber.go @@ -228,7 +228,7 @@ func (s *Subscriber) PlayBlock(spesic ISubscriber) { if s.VideoTrack.IDRing.Value.Sequence != firstIFrame.Sequence { firstIFrame = nil s.vr = s.VideoTrack.ReadRing() - s.Debug("skip to latest key frame") + s.Debug("skip to latest key frame", zap.Uint32("seq", s.VideoTrack.IDRing.Value.Sequence)) continue } else { vp = (*VideoFrame)(s.vr.Read(ctx)) diff --git a/util/buffer.go b/util/buffer.go index 26dbf15..3aa02cd 100644 --- a/util/buffer.go +++ b/util/buffer.go @@ -97,6 +97,7 @@ func SizeOfBuffers[T ~[]byte](buf []T) (size int) { // SplitBuffers 按照一定大小分割 Buffers func SplitBuffers[T ~[]byte](buf []T, size int) (result [][]T) { + buf = append([]T(nil), buf...) for total := SizeOfBuffers(buf); total > 0; { if total <= size { return append(result, buf)