Skip to content

Commit

Permalink
fix(nack): fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
OrlandoCo committed Nov 19, 2020
1 parent 97339f8 commit 13e4185
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
14 changes: 6 additions & 8 deletions pkg/nack.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,22 @@ type nackList struct {
ll *list.List
}

func NewNACKList() *nackList {
func newNACKList() *nackList {
return &nackList{
nacks: make(map[uint16]*list.Element),
ll: list.New(),
}
}

func (n *nackList) getNACKSeqNo(SN []uint16) []uint16 {
func (n *nackList) getNACKSeqNo(seqno []uint16) []uint16 {
packets := make([]uint16, 0, 17)
for _, sn := range SN {
for _, sn := range seqno {
if nack, ok := n.nacks[sn]; !ok {
n.nacks[sn] = n.ll.PushBack(NACK{sn, time.Now().UnixNano()})
packets = append(packets, sn)
} else {
if time.Now().UnixNano()-nack.Value.(NACK).LRX > ignoreRetransmission {
nack.Value = NACK{sn, time.Now().UnixNano()}
packets = append(packets, sn)
}
} else if time.Now().UnixNano()-nack.Value.(NACK).LRX > ignoreRetransmission {
nack.Value = NACK{sn, time.Now().UnixNano()}
packets = append(packets, sn)
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/simplesender.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func NewSimpleSender(id string, router *receiverRouter, transceiver *webrtc.RTPT
s := &SimpleSender{
id: id,
payload: sender.Track().Codec().PayloadType,
nList: NewNACKList(),
nList: newNACKList(),
router: router,
sender: sender,
transceiver: transceiver,
Expand Down
2 changes: 1 addition & 1 deletion pkg/simulcastsender.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func NewSimulcastSender(id string, router *receiverRouter, transceiver *webrtc.R
router: router,
sender: sender,
transceiver: transceiver,
nList: NewNACKList(),
nList: newNACKList(),
track: sender.Track(),
payload: sender.Track().Codec().PayloadType,
currentTempLayer: 3,
Expand Down

0 comments on commit 13e4185

Please sign in to comment.