From 97a64fab36a43521a047b2503b3f5a94c2d12817 Mon Sep 17 00:00:00 2001 From: dexter <178529795@qq.com> Date: Wed, 1 Jun 2022 22:59:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=B8=AA=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E5=BC=95=E7=94=A8=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 8e08c17..f7ebccf 100644 --- a/main.go +++ b/main.go @@ -42,7 +42,6 @@ import ( // } var ( reg_level = regexp.MustCompile("profile-level-id=(4.+f)") - api *API ) type WebRTCConfig struct { @@ -87,7 +86,7 @@ func (conf *WebRTCConfig) Play_(w http.ResponseWriter, r *http.Request) { bytes, err := ioutil.ReadAll(r.Body) var suber WebRTCSubscriber suber.SDP = string(bytes) - if suber.PeerConnection, err = api.NewPeerConnection(Configuration{}); err != nil { + if suber.PeerConnection, err = conf.api.NewPeerConnection(Configuration{}); err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } @@ -117,7 +116,7 @@ func (conf *WebRTCConfig) Push_(w http.ResponseWriter, r *http.Request) { bytes, err := ioutil.ReadAll(r.Body) var puber WebRTCPublisher puber.SDP = string(bytes) - if puber.PeerConnection, err = api.NewPeerConnection(Configuration{}); err != nil { + if puber.PeerConnection, err = conf.api.NewPeerConnection(Configuration{}); err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return }