@@ -35,8 +35,8 @@ import (
3535// peer-to-peer communications with another PeerConnection instance in a
3636// browser, or to another endpoint implementing the required protocols.
3737type PeerConnection struct {
38- statsID string
39- mu sync.RWMutex
38+ id string
39+ mu sync.RWMutex
4040
4141 sdpOrigin sdp.Origin
4242
@@ -118,7 +118,7 @@ func (api *API) NewPeerConnection(configuration Configuration) (*PeerConnection,
118118 // allow better readability to understand what is happening.
119119
120120 pc := & PeerConnection {
121- statsID : fmt .Sprintf ("PeerConnection-%d" , time .Now ().UnixNano ()),
121+ id : fmt .Sprintf ("PeerConnection-%d" , time .Now ().UnixNano ()),
122122 configuration : Configuration {
123123 ICEServers : []ICEServer {},
124124 ICETransportPolicy : ICETransportPolicyAll ,
@@ -145,12 +145,12 @@ func (api *API) NewPeerConnection(configuration Configuration) (*PeerConnection,
145145 pc .iceConnectionState .Store (ICEConnectionStateNew )
146146 pc .connectionState .Store (PeerConnectionStateNew )
147147
148- i , err := api .interceptorRegistry .Build (pc .statsID )
148+ i , err := api .interceptorRegistry .Build (pc .id )
149149 if err != nil {
150150 return nil , err
151151 }
152152
153- if getter , ok := lookupStats (pc .statsID ); ok {
153+ if getter , ok := lookupStats (pc .id ); ok {
154154 pc .statsGetter = getter
155155 }
156156
@@ -597,11 +597,11 @@ func (pc *PeerConnection) GetConfiguration() Configuration {
597597 return pc .configuration
598598}
599599
600- func (pc * PeerConnection ) getStatsID () string {
600+ func (pc * PeerConnection ) ID () string {
601601 pc .mu .RLock ()
602602 defer pc .mu .RUnlock ()
603603
604- return pc .statsID
604+ return pc .id
605605}
606606
607607// hasLocalDescriptionChanged returns whether local media (rtpTransceivers) has changed
@@ -2482,7 +2482,7 @@ func (pc *PeerConnection) close(shouldGracefullyClose bool) error { //nolint:cyc
24822482 closeErrs = append (closeErrs , doGracefulCloseOps ()... )
24832483
24842484 pc .statsGetter = nil
2485- cleanupStats (pc .statsID )
2485+ cleanupStats (pc .id )
24862486
24872487 // Interceptor closes at the end to prevent Bind from being called after interceptor is closed
24882488 closeErrs = append (closeErrs , pc .api .interceptor .Close ())
@@ -2623,7 +2623,7 @@ func (pc *PeerConnection) GetStats() StatsReport {
26232623 stats := PeerConnectionStats {
26242624 Timestamp : statsTimestampNow (),
26252625 Type : StatsTypePeerConnection ,
2626- ID : pc .statsID ,
2626+ ID : pc .id ,
26272627 DataChannelsAccepted : dataChannelsAccepted ,
26282628 DataChannelsClosed : dataChannelsClosed ,
26292629 DataChannelsOpened : dataChannelsOpened ,
0 commit comments