execbc-source: Merged the dial function to the Client creation
This commit is contained in:
@@ -17,6 +17,5 @@ func handle(url string) (core.Producer, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
con.Dial()
|
|
||||||
return con, nil
|
return con, nil
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-10
@@ -4,7 +4,6 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"sync"
|
|
||||||
|
|
||||||
"github.com/AlexxIT/go2rtc/pkg/core"
|
"github.com/AlexxIT/go2rtc/pkg/core"
|
||||||
)
|
)
|
||||||
@@ -19,14 +18,8 @@ type Client struct {
|
|||||||
cmd *exec.Cmd
|
cmd *exec.Cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
var lock = &sync.Mutex{}
|
|
||||||
var singleInstance *Client
|
|
||||||
|
|
||||||
func NewClient(commandArgs []string) (*Client, error) {
|
func NewClient(commandArgs []string) (*Client, error) {
|
||||||
return &Client{commandArgs: commandArgs}, nil
|
c := &Client{commandArgs: commandArgs}
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) Dial() error {
|
|
||||||
media := &core.Media{
|
media := &core.Media{
|
||||||
Kind: core.KindAudio,
|
Kind: core.KindAudio,
|
||||||
Direction: core.DirectionSendonly,
|
Direction: core.DirectionSendonly,
|
||||||
@@ -43,11 +36,11 @@ func (c *Client) Dial() error {
|
|||||||
|
|
||||||
pipeCloser, error := PipeCloser(&cmd)
|
pipeCloser, error := PipeCloser(&cmd)
|
||||||
if error != nil {
|
if error != nil {
|
||||||
return error
|
return nil, error
|
||||||
}
|
}
|
||||||
c.pipeCloser = pipeCloser
|
c.pipeCloser = pipeCloser
|
||||||
c.cmd = &cmd
|
c.cmd = &cmd
|
||||||
return nil
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c Client) Open() (err error) {
|
func (c Client) Open() (err error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user