From 2b9247d630490f61b7557134767b4c4e79ca8e84 Mon Sep 17 00:00:00 2001 From: Michael Reif <19reifl93@gmail.com> Date: Sat, 6 Jan 2024 09:40:20 +0100 Subject: [PATCH] execbc-source: Merged the dial function to the Client creation --- internal/execbc/init.go | 1 - pkg/execbc/client.go | 13 +++---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/internal/execbc/init.go b/internal/execbc/init.go index 158780bb..7d346331 100644 --- a/internal/execbc/init.go +++ b/internal/execbc/init.go @@ -17,6 +17,5 @@ func handle(url string) (core.Producer, error) { if err != nil { return nil, err } - con.Dial() return con, nil } diff --git a/pkg/execbc/client.go b/pkg/execbc/client.go index aa470a68..c5b3490d 100644 --- a/pkg/execbc/client.go +++ b/pkg/execbc/client.go @@ -4,7 +4,6 @@ import ( "io" "net" "os/exec" - "sync" "github.com/AlexxIT/go2rtc/pkg/core" ) @@ -19,14 +18,8 @@ type Client struct { cmd *exec.Cmd } -var lock = &sync.Mutex{} -var singleInstance *Client - func NewClient(commandArgs []string) (*Client, error) { - return &Client{commandArgs: commandArgs}, nil -} - -func (c *Client) Dial() error { + c := &Client{commandArgs: commandArgs} media := &core.Media{ Kind: core.KindAudio, Direction: core.DirectionSendonly, @@ -43,11 +36,11 @@ func (c *Client) Dial() error { pipeCloser, error := PipeCloser(&cmd) if error != nil { - return error + return nil, error } c.pipeCloser = pipeCloser c.cmd = &cmd - return nil + return c, nil } func (c Client) Open() (err error) {