Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions pkg/rtc/mediatrack.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,30 +232,36 @@ func (t *MediaTrack) ClearSubscriberNodes() {
}

func (t *MediaTrack) HasSignalCid(cid string) bool {
ti := t.MediaTrackReceiver.TrackInfoClone()
for _, c := range ti.Codecs {
if c.Cid == cid {
return true
if cid != "" {
ti := t.MediaTrackReceiver.TrackInfoClone()
for _, c := range ti.Codecs {
if c.Cid == cid {
return true
}
}
}
return false
}

func (t *MediaTrack) HasSdpCid(cid string) bool {
ti := t.MediaTrackReceiver.TrackInfoClone()
for _, c := range ti.Codecs {
if c.Cid == cid || c.SdpCid == cid {
return true
if cid != "" {
ti := t.MediaTrackReceiver.TrackInfoClone()
for _, c := range ti.Codecs {
if c.Cid == cid || c.SdpCid == cid {
return true
}
}
}
return false
}

func (t *MediaTrack) GetMimeTypeForSdpCid(cid string) mime.MimeType {
ti := t.MediaTrackReceiver.TrackInfoClone()
for _, c := range ti.Codecs {
if c.Cid == cid || c.SdpCid == cid {
return mime.NormalizeMimeType(c.MimeType)
if cid != "" {
ti := t.MediaTrackReceiver.TrackInfoClone()
for _, c := range ti.Codecs {
if c.Cid == cid || c.SdpCid == cid {
return mime.NormalizeMimeType(c.MimeType)
}
}
}
return mime.MimeTypeUnknown
Expand Down
15 changes: 10 additions & 5 deletions pkg/sfu/buffer/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -1343,6 +1343,14 @@ func (b *Buffer) seedKeyFrame(keyFrameSeederGeneration int32) {
ticker := time.NewTicker(time.Second)
defer ticker.Stop()

initialCount := uint32(0)
b.RLock()
rtpStats := b.rtpStats
b.RUnlock()
if rtpStats != nil {
initialCount, _ = rtpStats.KeyFrame()
}

for {
if b.closed.Load() || b.keyFrameSeederGeneration.Load() != keyFrameSeederGeneration {
return
Expand All @@ -1354,15 +1362,12 @@ func (b *Buffer) seedKeyFrame(keyFrameSeederGeneration int32) {
return

case <-ticker.C:
b.RLock()
rtpStats := b.rtpStats
b.RUnlock()

if rtpStats != nil {
cnt, last := rtpStats.KeyFrame()
if cnt > 0 {
if cnt > initialCount {
b.logger.Debugw(
"stopping key frame seeder: received key frame",
"keyFrameCountInitial", initialCount,
"keyFrameCount", cnt,
"lastKeyFrame", last,
)
Expand Down
Loading