do not panic if capture pipeline already exists.

This commit is contained in:
Miroslav Šedivý 2021-09-20 20:21:13 +02:00
parent 51577ecff4
commit 41d8fa7e22

View File

@ -1,6 +1,7 @@
package capture
import (
"errors"
"fmt"
"strings"
@ -141,20 +142,23 @@ func (manager *CaptureManagerCtx) Start() {
manager.desktop.OnAfterScreenSizeChange(func() {
for _, video := range manager.videos {
if video.Started() {
if err := video.createPipeline(); err != nil {
err := video.createPipeline()
if err != nil && !errors.Is(err, types.ErrCapturePipelineAlreadyExists) {
manager.logger.Panic().Err(err).Msg("unable to recreate video pipeline")
}
}
}
if manager.broadcast.Started() {
if err := manager.broadcast.createPipeline(); err != nil {
err := manager.broadcast.createPipeline()
if err != nil && !errors.Is(err, types.ErrCapturePipelineAlreadyExists) {
manager.logger.Panic().Err(err).Msg("unable to recreate broadcast pipeline")
}
}
if manager.screencast.Started() {
if err := manager.screencast.createPipeline(); err != nil {
err := manager.screencast.createPipeline()
if err != nil && !errors.Is(err, types.ErrCapturePipelineAlreadyExists) {
manager.logger.Panic().Err(err).Msg("unable to recreate screencast pipeline")
}
}