Skip to content

Commit

Permalink
split name first
Browse files Browse the repository at this point in the history
  • Loading branch information
frostbyte73 committed Sep 14, 2023
1 parent 141c5f5 commit 8d6f628
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 1 addition & 4 deletions pkg/pipeline/builder/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package builder

import (
"fmt"
"strings"
"sync"

"github.com/tinyzimmer/go-gst/gst"
Expand Down Expand Up @@ -98,9 +97,7 @@ func BuildStreamBin(pipeline *gstreamer.Pipeline, p *config.PipelineConfig) (*St
return sb, b, nil
}

func (sb *StreamBin) GetStreamUrl(element string) (string, error) {
name := strings.Split(element, "_")[1]

func (sb *StreamBin) GetStreamUrl(name string) (string, error) {
sb.mu.RLock()
url, ok := sb.urls[name]
sb.mu.RUnlock()
Expand Down
4 changes: 3 additions & 1 deletion pkg/pipeline/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,11 @@ func (c *Controller) handleMessageError(gErr *gst.GError) error {

switch {
case element == elementGstRtmp2Sink:
name = strings.Split(name, "_")[1]

if strings.HasPrefix(gErr.Error(), "Connection error") && !c.eos.IsBroken() {
// try reconnecting
ok, err := c.streamBin.ResetStream(name[10:], gErr)
ok, err := c.streamBin.ResetStream(name, gErr)
if err != nil {
logger.Errorw("failed to reset stream", err)
} else if ok {
Expand Down

0 comments on commit 8d6f628

Please sign in to comment.