feat: 使用引用计数器管理合并写切片的生命周期

This commit is contained in:
ydajiang
2025-04-18 10:58:09 +08:00
parent f3774f2151
commit bedf402ab4
17 changed files with 349 additions and 385 deletions

View File

@@ -3,6 +3,7 @@ package gb28181
import (
"fmt"
"github.com/lkmio/avformat"
"github.com/lkmio/avformat/collections"
"github.com/lkmio/avformat/utils"
"github.com/lkmio/lkm/log"
"github.com/lkmio/lkm/stream"
@@ -82,7 +83,8 @@ func (source *BaseGBSource) Input(data []byte) error {
}
bytes := transStream.(*ForwardStream).WrapData(data)
rtpPacket := [1][]byte{bytes}
rtpPacket := [1]*collections.ReferenceCounter[[]byte]{collections.NewReferenceCounter(bytes)}
source.DispatchBuffer(transStream, -1, rtpPacket[:], -1, true)
}