Skip to content

Commit da507e2

Browse files
committed
Simplify code
Signed-off-by: Šimon Brandner <[email protected]>
1 parent 9917596 commit da507e2

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/subscriber.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ func (s *Subscriber) Subscribe(publisher *Publisher) {
8181
s.publisher = publisher
8282
s.mutex.Unlock()
8383

84-
go s.forwardRTCP()
84+
if s.Track.Kind() == webrtc.RTPCodecTypeVideo {
85+
go s.forwardRTCP()
86+
}
8587

8688
publisher.AddSubscriber(s)
8789

@@ -110,10 +112,6 @@ func (s *Subscriber) Unsubscribe() {
110112
}
111113

112114
func (s *Subscriber) forwardRTCP() {
113-
if s.Track.Kind() != webrtc.RTPCodecTypeVideo {
114-
return
115-
}
116-
117115
for {
118116
packets, _, err := s.sender.ReadRTCP()
119117
if err != nil {

0 commit comments

Comments
 (0)