Make datachannel optional for publisher (#2686)
This commit is contained in:
@@ -987,7 +987,6 @@ func (p *ParticipantImpl) SetMigrateState(s types.MigrateState) {
|
|||||||
p.TransportManager.ProcessPendingPublisherOffer()
|
p.TransportManager.ProcessPendingPublisherOffer()
|
||||||
|
|
||||||
case types.MigrateStateComplete:
|
case types.MigrateStateComplete:
|
||||||
|
|
||||||
p.TransportManager.ProcessPendingPublisherDataChannels()
|
p.TransportManager.ProcessPendingPublisherDataChannels()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+24
-5
@@ -149,10 +149,12 @@ type PCTransport struct {
|
|||||||
|
|
||||||
lock sync.RWMutex
|
lock sync.RWMutex
|
||||||
|
|
||||||
reliableDC *webrtc.DataChannel
|
firstOfferReceived bool
|
||||||
reliableDCOpened bool
|
firstOfferNoDataChannel bool
|
||||||
lossyDC *webrtc.DataChannel
|
reliableDC *webrtc.DataChannel
|
||||||
lossyDCOpened bool
|
reliableDCOpened bool
|
||||||
|
lossyDC *webrtc.DataChannel
|
||||||
|
lossyDCOpened bool
|
||||||
|
|
||||||
iceStartedAt time.Time
|
iceStartedAt time.Time
|
||||||
iceConnectedAt time.Time
|
iceConnectedAt time.Time
|
||||||
@@ -694,7 +696,9 @@ func (t *PCTransport) isFullyEstablished() bool {
|
|||||||
t.lock.RLock()
|
t.lock.RLock()
|
||||||
defer t.lock.RUnlock()
|
defer t.lock.RUnlock()
|
||||||
|
|
||||||
return t.reliableDCOpened && t.lossyDCOpened && !t.connectedAt.IsZero()
|
dataChannelReady := t.firstOfferNoDataChannel || (t.reliableDCOpened && t.lossyDCOpened)
|
||||||
|
|
||||||
|
return dataChannelReady && !t.connectedAt.IsZero()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *PCTransport) SetPreferTCP(preferTCP bool) {
|
func (t *PCTransport) SetPreferTCP(preferTCP bool) {
|
||||||
@@ -1698,6 +1702,21 @@ func (t *PCTransport) handleRemoteOfferReceived(sd *webrtc.SessionDescription) e
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.lock.Lock()
|
||||||
|
if !t.firstOfferReceived {
|
||||||
|
t.firstOfferReceived = true
|
||||||
|
var dataChannelFound bool
|
||||||
|
for _, media := range parsed.MediaDescriptions {
|
||||||
|
if strings.EqualFold(media.MediaName.Media, "application") {
|
||||||
|
dataChannelFound = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
t.firstOfferNoDataChannel = !dataChannelFound
|
||||||
|
}
|
||||||
|
t.lock.Unlock()
|
||||||
|
|
||||||
iceCredential, offerRestartICE, err := t.isRemoteOfferRestartICE(parsed)
|
iceCredential, offerRestartICE, err := t.isRemoteOfferRestartICE(parsed)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "check remote offer restart ice failed")
|
return errors.Wrap(err, "check remote offer restart ice failed")
|
||||||
|
|||||||
Reference in New Issue
Block a user