mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
add session & metrics to webrtc peer.
This commit is contained in:
parent
9928feefef
commit
ec8560b290
@ -452,6 +452,8 @@ func (manager *WebRTCManagerCtx) CreatePeer(session types.Session, bitrate int,
|
||||
|
||||
peer := &WebRTCPeerCtx{
|
||||
logger: logger,
|
||||
session: session,
|
||||
metrics: metrics,
|
||||
connection: connection,
|
||||
// tracks & channels
|
||||
audioTrack: audioTrack,
|
||||
|
@ -13,16 +13,16 @@ import (
|
||||
type metricsManager struct {
|
||||
mu sync.Mutex
|
||||
|
||||
sessions map[string]metrics
|
||||
sessions map[string]*metrics
|
||||
}
|
||||
|
||||
func newMetricsManager() *metricsManager {
|
||||
return &metricsManager{
|
||||
sessions: map[string]metrics{},
|
||||
sessions: map[string]*metrics{},
|
||||
}
|
||||
}
|
||||
|
||||
func (m *metricsManager) getBySession(session types.Session) metrics {
|
||||
func (m *metricsManager) getBySession(session types.Session) *metrics {
|
||||
m.mu.Lock()
|
||||
defer m.mu.Unlock()
|
||||
|
||||
@ -33,7 +33,7 @@ func (m *metricsManager) getBySession(session types.Session) metrics {
|
||||
return met
|
||||
}
|
||||
|
||||
met = metrics{
|
||||
met = &metrics{
|
||||
sessionId: sessionId,
|
||||
|
||||
connectionState: promauto.NewGauge(prometheus.GaugeOpts{
|
||||
|
@ -16,6 +16,8 @@ import (
|
||||
type WebRTCPeerCtx struct {
|
||||
mu sync.Mutex
|
||||
logger zerolog.Logger
|
||||
session types.Session
|
||||
metrics *metrics
|
||||
connection *webrtc.PeerConnection
|
||||
// tracks & channels
|
||||
audioTrack *Track
|
||||
|
Loading…
Reference in New Issue
Block a user