From 0166830a83016b7b2511620f2c7cfe77ea51959e Mon Sep 17 00:00:00 2001 From: dexter <178529795@qq.com> Date: Wed, 29 Dec 2021 21:38:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pull.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pull.go b/pull.go index 2430531..8c6a240 100644 --- a/pull.go +++ b/pull.go @@ -46,11 +46,11 @@ func PullStream(streamPath, url string) error { StreamPath: streamPath, ExtraProp: &HDLPuller{}, } - at := stream.NewAudioTrack(0) - vt := stream.NewVideoTrack(0) if strings.HasPrefix(url, "http") { if res, err := http.Get(url); err == nil { if stream.Publish() { + at := stream.NewAudioTrack(0) + vt := stream.NewVideoTrack(0) go func() { lastTs := pull(at, vt, res.Body, 0) if config.Reconnect { @@ -72,6 +72,8 @@ func PullStream(streamPath, url string) error { stream.Type = "FLV File" if file, err := os.Open(url); err == nil { if stream.Publish() { + at := stream.NewAudioTrack(0) + vt := stream.NewVideoTrack(0) go func() { lastTs := pull(at, vt, file, 0) if config.Reconnect {