File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,10 @@ func (s *Subscriber) initLoggingWithTrack(track *webrtc.TrackRemote) {
6161func (s * Subscriber ) Subscribe (publisher * Publisher ) {
6262 s .initLoggingWithTrack (publisher .Track )
6363
64+ if s .publisher != nil {
65+ s .logger .Error ("cannot subscribe, if we already are" )
66+ }
67+
6468 track , err := webrtc .NewTrackLocalStaticRTP (
6569 publisher .Track .Codec ().RTPCodecCapability ,
6670 publisher .Track .ID (),
@@ -113,6 +117,11 @@ func (s *Subscriber) Unsubscribe() {
113117
114118func (s * Subscriber ) forwardRTCP () {
115119 for {
120+ // If we unsubscribed, stop forwarding RTCP packets
121+ if s .publisher == nil {
122+ return
123+ }
124+
116125 packets , _ , err := s .sender .ReadRTCP ()
117126 if err != nil {
118127 if errors .Is (err , io .ErrClosedPipe ) || errors .Is (err , io .EOF ) {
You can’t perform that action at this time.
0 commit comments