mirror of
https://github.com/aler9/gortsplib
synced 2025-10-30 10:06:28 +08:00
client: remove DialReadContext, DialPublishContext
This commit is contained in:
40
client.go
40
client.go
@@ -307,11 +307,6 @@ func (c *Client) Dial(scheme string, host string) error {
|
||||
|
||||
// DialRead connects to the address and starts reading all tracks.
|
||||
func (c *Client) DialRead(address string) error {
|
||||
return c.DialReadContext(context.Background(), address)
|
||||
}
|
||||
|
||||
// DialReadContext connects to the address with the given context and starts reading all tracks.
|
||||
func (c *Client) DialReadContext(ctx context.Context, address string) error {
|
||||
u, err := base.ParseURL(address)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -322,21 +317,6 @@ func (c *Client) DialReadContext(ctx context.Context, address string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
ctxHandlerDone := make(chan struct{})
|
||||
defer func() { <-ctxHandlerDone }()
|
||||
|
||||
ctxHandlerTerminate := make(chan struct{})
|
||||
defer close(ctxHandlerTerminate)
|
||||
|
||||
go func() {
|
||||
defer close(ctxHandlerDone)
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
c.Close()
|
||||
case <-ctxHandlerTerminate:
|
||||
}
|
||||
}()
|
||||
|
||||
_, err = c.Options(u)
|
||||
if err != nil {
|
||||
c.Close()
|
||||
@@ -368,11 +348,6 @@ func (c *Client) DialReadContext(ctx context.Context, address string) error {
|
||||
|
||||
// DialPublish connects to the address and starts publishing the tracks.
|
||||
func (c *Client) DialPublish(address string, tracks Tracks) error {
|
||||
return c.DialPublishContext(context.Background(), address, tracks)
|
||||
}
|
||||
|
||||
// DialPublishContext connects to the address with the given context and starts publishing the tracks.
|
||||
func (c *Client) DialPublishContext(ctx context.Context, address string, tracks Tracks) error {
|
||||
u, err := base.ParseURL(address)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -383,21 +358,6 @@ func (c *Client) DialPublishContext(ctx context.Context, address string, tracks
|
||||
return err
|
||||
}
|
||||
|
||||
ctxHandlerDone := make(chan struct{})
|
||||
defer func() { <-ctxHandlerDone }()
|
||||
|
||||
ctxHandlerTerminate := make(chan struct{})
|
||||
defer close(ctxHandlerTerminate)
|
||||
|
||||
go func() {
|
||||
defer close(ctxHandlerDone)
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
c.Close()
|
||||
case <-ctxHandlerTerminate:
|
||||
}
|
||||
}()
|
||||
|
||||
_, err = c.Options(u)
|
||||
if err != nil {
|
||||
c.Close()
|
||||
|
||||
Reference in New Issue
Block a user