MCPcopy Create free account
hub / github.com/deepch/RTSPtoWebRTC / HTTPAPIServerStreamCodec

Function HTTPAPIServerStreamCodec

http.go:71–99  ·  view source on GitHub ↗

HTTPAPIServerStreamCodec stream codec

(c *gin.Context)

Source from the content-addressed store, hash-verified

69
70//HTTPAPIServerStreamCodec stream codec
71func HTTPAPIServerStreamCodec(c *gin.Context) {
72 if Config.ext(c.Param("uuid")) {
73 Config.RunIFNotRun(c.Param("uuid"))
74 codecs := Config.coGe(c.Param("uuid"))
75 if codecs == nil {
76 return
77 }
78 var tmpCodec []JCodec
79 for _, codec := range codecs {
80 if codec.Type() != av.H264 && codec.Type() != av.PCM_ALAW && codec.Type() != av.PCM_MULAW && codec.Type() != av.OPUS {
81 log.Println("Codec Not Supported WebRTC ignore this track", codec.Type())
82 continue
83 }
84 if codec.Type().IsVideo() {
85 tmpCodec = append(tmpCodec, JCodec{Type: "video"})
86 } else {
87 tmpCodec = append(tmpCodec, JCodec{Type: "audio"})
88 }
89 }
90 b, err := json.Marshal(tmpCodec)
91 if err == nil {
92 _, err = c.Writer.Write(b)
93 if err != nil {
94 log.Println("Write Codec Info error", err)
95 return
96 }
97 }
98 }
99}
100
101//HTTPAPIServerStreamWebRTC stream video over WebRTC
102func HTTPAPIServerStreamWebRTC(c *gin.Context) {

Callers

nothing calls this directly

Calls 3

extMethod · 0.80
RunIFNotRunMethod · 0.80
coGeMethod · 0.80

Tested by

no test coverage detected