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{
|
peer := &WebRTCPeerCtx{
|
||||||
logger: logger,
|
logger: logger,
|
||||||
|
session: session,
|
||||||
|
metrics: metrics,
|
||||||
connection: connection,
|
connection: connection,
|
||||||
// tracks & channels
|
// tracks & channels
|
||||||
audioTrack: audioTrack,
|
audioTrack: audioTrack,
|
||||||
|
@ -13,16 +13,16 @@ import (
|
|||||||
type metricsManager struct {
|
type metricsManager struct {
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
|
|
||||||
sessions map[string]metrics
|
sessions map[string]*metrics
|
||||||
}
|
}
|
||||||
|
|
||||||
func newMetricsManager() *metricsManager {
|
func newMetricsManager() *metricsManager {
|
||||||
return &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()
|
m.mu.Lock()
|
||||||
defer m.mu.Unlock()
|
defer m.mu.Unlock()
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ func (m *metricsManager) getBySession(session types.Session) metrics {
|
|||||||
return met
|
return met
|
||||||
}
|
}
|
||||||
|
|
||||||
met = metrics{
|
met = &metrics{
|
||||||
sessionId: sessionId,
|
sessionId: sessionId,
|
||||||
|
|
||||||
connectionState: promauto.NewGauge(prometheus.GaugeOpts{
|
connectionState: promauto.NewGauge(prometheus.GaugeOpts{
|
||||||
|
@ -16,6 +16,8 @@ import (
|
|||||||
type WebRTCPeerCtx struct {
|
type WebRTCPeerCtx struct {
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
logger zerolog.Logger
|
logger zerolog.Logger
|
||||||
|
session types.Session
|
||||||
|
metrics *metrics
|
||||||
connection *webrtc.PeerConnection
|
connection *webrtc.PeerConnection
|
||||||
// tracks & channels
|
// tracks & channels
|
||||||
audioTrack *Track
|
audioTrack *Track
|
||||||
|
Loading…
Reference in New Issue
Block a user