Trace to log supported MP4 codecs

This commit is contained in:
Alexey Khit
2022-12-06 10:51:42 +03:00
parent c2748fc77b
commit 74c3510a10
2 changed files with 7 additions and 5 deletions
+3 -3
View File
@@ -15,8 +15,8 @@ import (
func Init() {
log = app.GetLogger("mp4")
api.HandleWS("mse", handlerWS)
api.HandleWS("mp4", handlerWS4)
api.HandleWS("mse", handlerWSMSE)
api.HandleWS("mp4", handlerWSMP4)
api.HandleFunc("api/frame.mp4", handlerKeyframe)
api.HandleFunc("api/stream.mp4", handlerMP4)
@@ -65,7 +65,7 @@ func handlerKeyframe(w http.ResponseWriter, r *http.Request) {
}
func handlerMP4(w http.ResponseWriter, r *http.Request) {
log.Trace().Msgf("[api.mp4] %s %+v", r.Method, r.Header)
log.Trace().Msgf("[mp4] %s %+v", r.Method, r.Header)
if isChromeFirst(w, r) || isSafari(w, r) {
return
+4 -2
View File
@@ -11,7 +11,7 @@ import (
const packetSize = 8192
func handlerWS(tr *api.Transport, msg *api.Message) error {
func handlerWSMSE(tr *api.Transport, msg *api.Message) error {
src := tr.Request.URL.Query().Get("src")
stream := streams.GetOrNew(src)
if stream == nil {
@@ -23,6 +23,7 @@ func handlerWS(tr *api.Transport, msg *api.Message) error {
cons.RemoteAddr = tr.Request.RemoteAddr
if codecs, ok := msg.Value.(string); ok {
log.Trace().Str("codecs", codecs).Msgf("[mp4] new WS/MSE consumer")
cons.Medias = parseMedias(codecs, true)
}
@@ -60,7 +61,7 @@ func handlerWS(tr *api.Transport, msg *api.Message) error {
return nil
}
func handlerWS4(tr *api.Transport, msg *api.Message) error {
func handlerWSMP4(tr *api.Transport, msg *api.Message) error {
src := tr.Request.URL.Query().Get("src")
stream := streams.GetOrNew(src)
if stream == nil {
@@ -70,6 +71,7 @@ func handlerWS4(tr *api.Transport, msg *api.Message) error {
cons := &mp4.Segment{}
if codecs, ok := msg.Value.(string); ok {
log.Trace().Str("codecs", codecs).Msgf("[mp4] new WS/MP4 consumer")
cons.Medias = parseMedias(codecs, false)
}