do not capture pointers in ops queue closures (#2675)
This commit is contained in:
+12
-9
@@ -75,6 +75,11 @@ type downTrackState struct {
|
||||
downTrack sfu.DownTrackState
|
||||
}
|
||||
|
||||
type postRtcpOp struct {
|
||||
*ParticipantImpl
|
||||
pkts []rtcp.Packet
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
type participantUpdateInfo struct {
|
||||
@@ -164,7 +169,7 @@ type ParticipantImpl struct {
|
||||
disconnectTimer *time.Timer
|
||||
migrationTimer *time.Timer
|
||||
|
||||
pubRTCPQueue *sutils.TypedOpsQueue[[]rtcp.Packet]
|
||||
pubRTCPQueue *sutils.TypedOpsQueue[postRtcpOp]
|
||||
|
||||
// hold reference for MediaTrack
|
||||
twcc *twcc.Responder
|
||||
@@ -244,7 +249,7 @@ func NewParticipant(params ParticipantParams) (*ParticipantImpl, error) {
|
||||
p := &ParticipantImpl{
|
||||
params: params,
|
||||
disconnected: make(chan struct{}),
|
||||
pubRTCPQueue: sutils.NewTypedOpsQueue[[]rtcp.Packet](sutils.OpsQueueParams{
|
||||
pubRTCPQueue: sutils.NewTypedOpsQueue[postRtcpOp](sutils.OpsQueueParams{
|
||||
Name: "pub-rtcp",
|
||||
MinSize: 64,
|
||||
Logger: params.Logger,
|
||||
@@ -2379,13 +2384,11 @@ func (p *ParticipantImpl) postRtcp(pkts []rtcp.Packet) {
|
||||
return
|
||||
}
|
||||
|
||||
p.pubRTCPQueue.Enqueue(p.writePublisherRTCP, pkts)
|
||||
}
|
||||
|
||||
func (p *ParticipantImpl) writePublisherRTCP(pkts []rtcp.Packet) {
|
||||
if err := p.TransportManager.WritePublisherRTCP(pkts); err != nil && !IsEOF(err) {
|
||||
p.pubLogger.Errorw("could not write RTCP to participant", err)
|
||||
}
|
||||
p.pubRTCPQueue.Enqueue(func(op postRtcpOp) {
|
||||
if err := op.TransportManager.WritePublisherRTCP(op.pkts); err != nil && !IsEOF(err) {
|
||||
op.pubLogger.Errorw("could not write RTCP to participant", err)
|
||||
}
|
||||
}, postRtcpOp{p, pkts})
|
||||
}
|
||||
|
||||
func (p *ParticipantImpl) setDowntracksConnected() {
|
||||
|
||||
Reference in New Issue
Block a user