From 8f9ad2cd9bf2fc1630dfde921fff90b86372d85f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sun, 28 Feb 2021 18:56:04 +0100 Subject: [PATCH] capture stream remove listeners on shutdown. --- internal/capture/stream.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/capture/stream.go b/internal/capture/stream.go index dd3f13f2..ef19b0c2 100644 --- a/internal/capture/stream.go +++ b/internal/capture/stream.go @@ -64,6 +64,12 @@ func streamNew(codec codec.RTPCodec, pipelineStr func() string) *StreamManagerCt func (manager *StreamManagerCtx) shutdown() { manager.logger.Info().Msgf("shutting down") + manager.emitMu.Lock() + for key := range manager.listeners { + delete(manager.listeners, key) + } + manager.emitMu.Unlock() + manager.destroyPipeline() manager.emitStop <- true }