Skip to content

Commit 59e90fb

Browse files
solosthatsnotright
authored andcommitted
fix(jitterbuffer): Init queue and node fields
Initialize PriorityQueue and node pointer fields explicitly in NewQueue and newNode.
1 parent c06d71c commit 59e90fb

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎pkg/jitterbuffer/priority_queue.go‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,19 @@ var (
3333
// increasing Sequence Number, wrapping at MaxUint16, so
3434
// a packet with sequence number MaxUint16 - 1 will be after 0.
3535
func NewQueue() *PriorityQueue {
36-
return &PriorityQueue{}
36+
return &PriorityQueue{
37+
next: nil,
38+
length: 0,
39+
}
3740
}
3841

3942
func newNode(val *rtp.Packet, priority uint16) *node {
40-
return &node{val: val, priority: priority}
43+
return &node{
44+
val: val,
45+
prev: nil,
46+
next: nil,
47+
priority: priority,
48+
}
4149
}
4250

4351
// Find a packet in the queue with the provided sequence number,

0 commit comments

Comments
 (0)