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
+3 -3
View File
@@ -312,9 +312,9 @@ func (b *Buffer) SetPLIThrottle(duration int64) {
b.pliThrottle = duration
}
func (b *Buffer) SendPLI() {
func (b *Buffer) SendPLI(force bool) {
b.RLock()
if b.rtpStats == nil || b.rtpStats.TimeSinceLastPli() < b.pliThrottle {
if (b.rtpStats == nil || b.rtpStats.TimeSinceLastPli() < b.pliThrottle) && !force {
b.RUnlock()
return
}
@@ -322,7 +322,7 @@ func (b *Buffer) SendPLI() {
b.rtpStats.UpdatePliAndTime(1)
b.RUnlock()
b.logger.Debugw("send pli", "ssrc", b.mediaSSRC)
b.logger.Debugw("send pli", "ssrc", b.mediaSSRC, "force", force)
pli := []rtcp.Packet{
&rtcp.PictureLossIndication{SenderSSRC: rand.Uint32(), MediaSSRC: b.mediaSSRC},
}