Code refactoring for mpegts input
This commit is contained in:
@@ -56,19 +56,17 @@ func inputMpegTS(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
res := &http.Response{Body: r.Body, Request: r}
|
client, err := mpegts.Open(r.Body)
|
||||||
client, err := mpegts.Open(res.Body)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
stream.AddProducer(client)
|
stream.AddProducer(client)
|
||||||
|
defer stream.RemoveProducer(client)
|
||||||
|
|
||||||
if err = client.Start(); err != nil {
|
if err = client.Start(); err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
stream.RemoveProducer(client)
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user