Skip to content
This repository has been archived by the owner on Mar 16, 2022. It is now read-only.

Commit

Permalink
close rtx&fec in rtpreciver's stop method
Browse files Browse the repository at this point in the history
  • Loading branch information
cnderrauber committed Apr 20, 2021
1 parent 184c342 commit 093840a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions rtpreceiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,25 @@ func (r *RTPReceiver) Stop() error {
errs = append(errs, r.tracks[i].rtpReadStream.Close())
}

// close fec & rtx
closefunc := func(t *trackStreams) []error {
errs := []error{}
if t.rtcpReadStream != nil {
errs = append(errs, t.rtcpReadStream.Close())
}

if t.rtpReadStream != nil {
errs = append(errs, t.rtpReadStream.Close())
}
return errs
}
if fec := r.tracks[i].fecTrack; fec != nil {
errs = append(errs, closefunc(fec)...)
}
if rtx := r.tracks[i].rtxTrack; rtx != nil {
errs = append(errs, closefunc(rtx)...)
}

err = util.FlattenErrs(errs)
r.api.interceptor.UnbindRemoteStream(&r.tracks[i].streamInfo)
}
Expand Down

0 comments on commit 093840a

Please sign in to comment.