destroy pipelines func.

This commit is contained in:
Miroslav Šedivý 2020-11-13 21:23:48 +01:00
parent ff97242bac
commit 9c26f35c76

View File

@ -43,10 +43,7 @@ func (manager *CaptureManagerCtx) Start() {
manager.StartBroadcastPipeline()
manager.desktop.OnBeforeScreenSizeChange(func() {
manager.video_emit_stop <- true
manager.logger.Info().Msgf("stopping video pipeline")
manager.video.Stop()
manager.destroyVideoPipeline()
manager.StopBroadcastPipeline()
})
@ -93,14 +90,8 @@ func (manager *CaptureManagerCtx) StartStream() {
func (manager *CaptureManagerCtx) StopStream() {
manager.logger.Info().Msgf("stopping pipelines")
manager.audio_emit_stop <- true
manager.logger.Info().Msgf("stopping video pipeline")
manager.audio.Stop()
manager.video_emit_stop <- true
manager.logger.Info().Msgf("stopping audio pipeline")
manager.video.Stop()
manager.destroyVideoPipeline()
manager.destroyAudioPipeline()
manager.streaming = false
}
@ -148,6 +139,12 @@ func (manager *CaptureManagerCtx) createVideoPipeline() {
}()
}
func (manager *CaptureManagerCtx) destroyVideoPipeline() {
manager.video_emit_stop <- true
manager.logger.Info().Msgf("stopping video pipeline")
manager.video.Stop()
}
func (manager *CaptureManagerCtx) createAudioPipeline() {
var err error
@ -187,3 +184,9 @@ func (manager *CaptureManagerCtx) createAudioPipeline() {
}
}()
}
func (manager *CaptureManagerCtx) destroyAudioPipeline() {
manager.audio_emit_stop <- true
manager.logger.Info().Msgf("stopping audio pipeline")
manager.audio.Stop()
}