Move MP4 mutex from HTTP to Muxer
This commit is contained in:
+1
-7
@@ -4,7 +4,6 @@ import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/AlexxIT/go2rtc/cmd/api"
|
||||
@@ -110,14 +109,9 @@ func handlerMP4(w http.ResponseWriter, r *http.Request) {
|
||||
Medias: core.ParseQuery(r.URL.Query()),
|
||||
}
|
||||
|
||||
var mu sync.Mutex
|
||||
cons.Listen(func(msg any) {
|
||||
if data, ok := msg.([]byte); ok {
|
||||
mu.Lock()
|
||||
_, err := w.Write(data)
|
||||
mu.Unlock()
|
||||
|
||||
if err != nil && exit != nil {
|
||||
if _, err := w.Write(data); err != nil && exit != nil {
|
||||
select {
|
||||
case exit <- err:
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user