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
+12 -3
View File
@@ -288,12 +288,21 @@ func (t *PCTransport) OnOffer(f func(sd webrtc.SessionDescription)) {
t.onOffer = f
}
func (t *PCTransport) Negotiate() {
t.debouncedNegotiate(func() {
func (t *PCTransport) Negotiate(force bool) {
if force {
t.debouncedNegotiate(func() {
// no op to cancel pending negotiation
})
if err := t.CreateAndSendOffer(nil); err != nil {
t.logger.Errorw("could not negotiate", err)
}
})
} else {
t.debouncedNegotiate(func() {
if err := t.CreateAndSendOffer(nil); err != nil {
t.logger.Errorw("could not negotiate", err)
}
})
}
}
func (t *PCTransport) CreateAndSendOffer(options *webrtc.OfferOptions) error {