execbc-source: Merged the dial function to the Client creation

This commit is contained in:
Michael Reif
2024-01-06 09:40:20 +01:00
parent cc6b8277c9
commit 2b9247d630
2 changed files with 3 additions and 11 deletions
-1
View File
@@ -17,6 +17,5 @@ func handle(url string) (core.Producer, error) {
if err != nil {
return nil, err
}
con.Dial()
return con, nil
}
+3 -10
View File
@@ -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) {