From c7535ebfbd714c5fcafe7f31e9fb6998bf3f5401 Mon Sep 17 00:00:00 2001 From: cnderrauber Date: Wed, 31 Jan 2024 17:52:52 +0800 Subject: [PATCH] Unbind stream for report interceptor UnbindLocalStream for Sender UnbindRemoteStream for Receiver --- pkg/report/receiver_interceptor.go | 4 ++-- pkg/report/sender_interceptor.go | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/report/receiver_interceptor.go b/pkg/report/receiver_interceptor.go index c126f9ab..39606f80 100644 --- a/pkg/report/receiver_interceptor.go +++ b/pkg/report/receiver_interceptor.go @@ -142,8 +142,8 @@ func (r *ReceiverInterceptor) BindRemoteStream(info *interceptor.StreamInfo, rea }) } -// UnbindLocalStream is called when the Stream is removed. It can be used to clean up any data related to that track. -func (r *ReceiverInterceptor) UnbindLocalStream(info *interceptor.StreamInfo) { +// UnbindRemoteStream is called when the Stream is removed. It can be used to clean up any data related to that track. +func (r *ReceiverInterceptor) UnbindRemoteStream(info *interceptor.StreamInfo) { r.streams.Delete(info.SSRC) } diff --git a/pkg/report/sender_interceptor.go b/pkg/report/sender_interceptor.go index 087838e7..a19ac367 100644 --- a/pkg/report/sender_interceptor.go +++ b/pkg/report/sender_interceptor.go @@ -144,3 +144,8 @@ func (s *SenderInterceptor) BindLocalStream(info *interceptor.StreamInfo, writer return writer.Write(header, payload, a) }) } + +// UnbindLocalStream is called when the Stream is removed. It can be used to clean up any data related to that track. +func (s *SenderInterceptor) UnbindLocalStream(info *interceptor.StreamInfo) { + s.streams.Delete(info.SSRC) +}