shorten the time cost for subscriber get media tracks (#747)

* set DownTrack's initial codec to first codec of potential codecs

* faststart on subscribe
This commit is contained in:
cnderrauber
2022-06-02 10:00:42 +08:00
committed by GitHub
parent 46301d7d6f
commit 6ba034feae
12 changed files with 97 additions and 32 deletions
+4 -4
View File
@@ -281,7 +281,7 @@ func (c *RTCClient) Run() error {
// if publish only, negotiate
if !msg.Join.SubscriberPrimary {
c.publisherNegotiated.Store(true)
c.publisher.Negotiate()
c.publisher.Negotiate(false)
}
logger.Infow("join accepted, awaiting offer", "participant", msg.Join.Participant.Identity)
@@ -342,7 +342,7 @@ func (c *RTCClient) Run() error {
if err := c.publisher.PeerConnection().RemoveTrack(sender); err != nil {
logger.Errorw("Could not unpublish track", err)
}
c.publisher.Negotiate()
c.publisher.Negotiate(false)
}
delete(c.trackSenders, sid)
delete(c.localTracks, sid)
@@ -502,7 +502,7 @@ func (c *RTCClient) AddTrack(track *webrtc.TrackLocalStaticSample, path string)
}
c.localTracks[ti.Sid] = track
c.trackSenders[ti.Sid] = sender
c.publisher.Negotiate()
c.publisher.Negotiate(false)
writer = NewTrackWriter(c.ctx, track, path)
// write tracks only after ICE connectivity
@@ -604,7 +604,7 @@ func (c *RTCClient) ensurePublisherConnected() error {
if c.publisher.PeerConnection().ConnectionState() == webrtc.PeerConnectionStateNew {
// start negotiating
c.publisher.Negotiate()
c.publisher.Negotiate(false)
}
dcOpen := atomic.NewBool(false)