Live video on the AT Protocol
79
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #148 from streamplace/eli/segment-madness

media: improvements to segment memory handling

authored by

Eli Mallon and committed by
GitHub
5696ee75 64c11014

+10 -2
+3
pkg/media/segchanman/segchanman.go
··· 8 8 9 9 "go.opentelemetry.io/otel" 10 10 "stream.place/streamplace/pkg/log" 11 + "stream.place/streamplace/pkg/spmetrics" 11 12 ) 12 13 13 14 // it's a segment channel manager, you see ··· 44 45 ch := make(chan *Seg) 45 46 chs = append(chs, ch) 46 47 s.segChans[key] = chs 48 + spmetrics.SegmentSubscriptionsOpen.WithLabelValues(user, rendition).Set(float64(len(chs))) 47 49 return ch 48 50 } 49 51 ··· 61 63 break 62 64 } 63 65 } 66 + spmetrics.SegmentSubscriptionsOpen.WithLabelValues(user, rendition).Set(float64(len(chs))) 64 67 s.segChans[key] = chs 65 68 } 66 69
+2 -2
pkg/media/webrtc_ingest.go
··· 228 228 229 229 gbuf := gst.NewBufferWithSize(int64(len(buf[:i]))) 230 230 gbuf.Map(gst.MapWrite).WriteData(buf[:i]) 231 - defer gbuf.Unmap() 231 + gbuf.Unmap() 232 232 233 233 ret := videoSrc.PushBuffer(gbuf) 234 234 if ret != gst.FlowOK { ··· 267 267 268 268 gbuf := gst.NewBufferWithSize(int64(len(buf[:i]))) 269 269 gbuf.Map(gst.MapWrite).WriteData(buf[:i]) 270 - defer gbuf.Unmap() 270 + gbuf.Unmap() 271 271 ret := audioSrc.PushBuffer(gbuf) 272 272 if ret != gst.FlowOK { 273 273 log.Log(ctx, "failed to push buffer", "error", ret)
+5
pkg/spmetrics/spmetrics.go
··· 69 69 Help: "number of open websockets", 70 70 }) 71 71 72 + var SegmentSubscriptionsOpen = promauto.NewGaugeVec(prometheus.GaugeOpts{ 73 + Name: "streamplace_segment_subscriptions_open", 74 + Help: "number of open new segment subscriptions", 75 + }, []string{"streamer", "rendition"}) 76 + 72 77 func ViewerInc(user string) { 73 78 go func() { 74 79 viewersLock.Lock()