Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ionorg/ion-sfu
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.7.6
Choose a base ref
...
head repository: ionorg/ion-sfu
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.7.7
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Jan 8, 2021

  1. Copy the full SHA
    eb01437 View commit details
Showing with 12 additions and 9 deletions.
  1. +12 −9 pkg/buffer/buffer.go
21 changes: 12 additions & 9 deletions pkg/buffer/buffer.go
Original file line number Diff line number Diff line change
@@ -37,6 +37,7 @@ type Buffer struct {
audioPool *sync.Pool
packetChan chan rtp.Packet
pPackets []pendingPackets
closeOnce sync.Once
mediaSSRC uint32
clockRate uint32
maxBitrate uint64
@@ -220,15 +221,17 @@ func (b *Buffer) Close() error {
b.Lock()
defer b.Unlock()

b.closed = true
if b.bucket != nil && b.codecType == webrtc.RTPCodecTypeVideo {
b.videoPool.Put(b.bucket.buf)
}
if b.bucket != nil && b.codecType == webrtc.RTPCodecTypeAudio {
b.audioPool.Put(b.bucket.buf)
}
b.onClose()
close(b.packetChan)
b.closeOnce.Do(func() {
b.closed = true
if b.bucket != nil && b.codecType == webrtc.RTPCodecTypeVideo {
b.videoPool.Put(b.bucket.buf)
}
if b.bucket != nil && b.codecType == webrtc.RTPCodecTypeAudio {
b.audioPool.Put(b.bucket.buf)
}
b.onClose()
close(b.packetChan)
})
return nil
}