Expose detailed connection info with ICEConnectionDetails (#2287)

* Expose detailed connection info with ICEConnectionDetails

* clone to avoid data race

* lower transport

* simplify

* address feedback
This commit is contained in:
David Zhao
2023-12-03 10:03:41 -08:00
committed by GitHub
parent 4db930bd29
commit 37e1864df8
7 changed files with 481 additions and 195 deletions
+11 -2
View File
@@ -124,6 +124,7 @@ func NewTransportManager(params TransportManagerParams) (*TransportManager, erro
Logger: LoggerWithPCTarget(params.Logger, livekit.SignalTarget_PUBLISHER),
SimTracks: params.SimTracks,
ClientInfo: params.ClientInfo,
Transport: livekit.SignalTarget_PUBLISHER,
})
if err != nil {
return nil, err
@@ -159,6 +160,7 @@ func NewTransportManager(params TransportManagerParams) (*TransportManager, erro
IsSendSide: true,
AllowPlayoutDelay: params.AllowPlayoutDelay,
DataChannelMaxBufferedAmount: params.DataChannelMaxBufferedAmount,
Transport: livekit.SignalTarget_SUBSCRIBER,
})
if err != nil {
return nil, err
@@ -554,8 +556,15 @@ func (t *TransportManager) SubscriberAsPrimary() bool {
return t.params.SubscriberAsPrimary
}
func (t *TransportManager) GetICEConnectionType() types.ICEConnectionType {
return t.getTransport(true).GetICEConnectionType()
func (t *TransportManager) GetICEConnectionDetails() []*types.ICEConnectionDetails {
details := make([]*types.ICEConnectionDetails, 0, 2)
for _, pc := range []*PCTransport{t.publisher, t.subscriber} {
cd := pc.GetICEConnectionDetails()
if cd.HasCandidates() {
details = append(details, cd.Clone())
}
}
return details
}
func (t *TransportManager) getTransport(isPrimary bool) *PCTransport {