use negotiated data channel in migration case (#596)
This commit is contained in:
@@ -64,6 +64,7 @@ type ParticipantParams struct {
|
|||||||
InitialVersion uint32
|
InitialVersion uint32
|
||||||
ClientConf *livekit.ClientConfiguration
|
ClientConf *livekit.ClientConfiguration
|
||||||
Region string
|
Region string
|
||||||
|
Migration bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type ParticipantImpl struct {
|
type ParticipantImpl struct {
|
||||||
@@ -216,10 +217,12 @@ func NewParticipant(params ParticipantParams) (*ParticipantImpl, error) {
|
|||||||
primaryPC = p.subscriber.pc
|
primaryPC = p.subscriber.pc
|
||||||
secondaryPC = p.publisher.pc
|
secondaryPC = p.publisher.pc
|
||||||
ordered := true
|
ordered := true
|
||||||
|
negotiated := p.params.Migration
|
||||||
// also create data channels for subs, this is for legacy clients that do not use subscriber
|
// also create data channels for subs, this is for legacy clients that do not use subscriber
|
||||||
// as primary channel
|
// as primary channel
|
||||||
p.reliableDCSub, err = primaryPC.CreateDataChannel(ReliableDataChannel, &webrtc.DataChannelInit{
|
p.reliableDCSub, err = primaryPC.CreateDataChannel(ReliableDataChannel, &webrtc.DataChannelInit{
|
||||||
Ordered: &ordered,
|
Ordered: &ordered,
|
||||||
|
Negotiated: &negotiated,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -229,6 +232,7 @@ func NewParticipant(params ParticipantParams) (*ParticipantImpl, error) {
|
|||||||
p.lossyDCSub, err = primaryPC.CreateDataChannel(LossyDataChannel, &webrtc.DataChannelInit{
|
p.lossyDCSub, err = primaryPC.CreateDataChannel(LossyDataChannel, &webrtc.DataChannelInit{
|
||||||
Ordered: &ordered,
|
Ordered: &ordered,
|
||||||
MaxRetransmits: &retransmits,
|
MaxRetransmits: &retransmits,
|
||||||
|
Negotiated: &negotiated,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -602,8 +606,6 @@ func (p *ParticipantImpl) SetMigrateState(s types.MigrateState) {
|
|||||||
if s == types.MigrateStateSync {
|
if s == types.MigrateStateSync {
|
||||||
pendingOffer = p.pendingOffer
|
pendingOffer = p.pendingOffer
|
||||||
p.pendingOffer = nil
|
p.pendingOffer = nil
|
||||||
// in case of migration, subscriber data channel will not fire OnOpen callback
|
|
||||||
p.activeCounter.CAS(0, 2)
|
|
||||||
}
|
}
|
||||||
p.lock.Unlock()
|
p.lock.Unlock()
|
||||||
if s == types.MigrateStateComplete {
|
if s == types.MigrateStateComplete {
|
||||||
|
|||||||
Reference in New Issue
Block a user