Skip to content

Commit

Permalink
patch
Browse files Browse the repository at this point in the history
  • Loading branch information
q191201771 committed Jun 25, 2024
1 parent b5de3f9 commit afe3a8c
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions pkg/httpflv/client_pull_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,29 +85,15 @@ func (session *PullSession) WithOnReadFlvTag(onReadFlvTag OnReadFlvTag) *PullSes
// 1. `http://{domain}/{app_name}/{stream_name}.flv`
// 2. `http://{ip}/{domain}/{app_name}/{stream_name}.flv`
func (session *PullSession) Start(rawUrl string) error {
return session.Pull(rawUrl, session.onReadFlvTag)
if session.onReadFlvTag == nil {
Log.Warnf("[%s] Start. onReadFlvTag not set.", session.UniqueKey())
}
return session.pull(rawUrl)
}

// Pull deprecated. use Start instead.
func (session *PullSession) Pull(rawUrl string, onReadFlvTag OnReadFlvTag) error {
Log.Debugf("[%s] pull. url=%s", session.UniqueKey(), rawUrl)

var (
ctx context.Context
cancel context.CancelFunc
)
if session.option.PullTimeoutMs == 0 {
ctx, cancel = context.WithCancel(context.Background())
} else {
ctx, cancel = context.WithTimeout(context.Background(), time.Duration(session.option.PullTimeoutMs)*time.Millisecond)
}
defer cancel()

err := session.pullContext(ctx, rawUrl, onReadFlvTag)
if err != nil {
_ = session.dispose(err)
}
return err
return session.WithOnReadFlvTag(onReadFlvTag).Start(rawUrl)
}

// ---------------------------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit afe3a8c

Please sign in to comment.