From 330f6175de2004d52be00b6266c69e0320ff296a Mon Sep 17 00:00:00 2001 From: Nonoo Date: Wed, 28 Oct 2020 16:40:58 +0100 Subject: [PATCH] Add (inactive) drop test for debugging purposes --- audiostream.go | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/audiostream.go b/audiostream.go index 49100c6..b81c5ef 100644 --- a/audiostream.go +++ b/audiostream.go @@ -84,18 +84,34 @@ func (s *audioStream) handleRxSeqBufEntry(e seqBufEntry) { s.audio.play <- e.data } +//var drop int + func (s *audioStream) handleAudioPacket(r []byte) error { + gotSeq := binary.LittleEndian.Uint16(r[6:8]) + + // if drop == 0 && time.Now().UnixNano()%50 == 0 { + // log.Print("drop start - ", gotSeq) + // drop = 1 + // return nil + // } else if drop > 0 { + // drop++ + // if drop >= 9 { + // log.Print("drop stop - ", gotSeq) + // drop = 0 + // } else { + // return nil + // } + // } + if s.timeoutTimer != nil { s.timeoutTimer.Stop() s.timeoutTimer.Reset(audioTimeoutDuration) } - gotSeq := binary.LittleEndian.Uint16(r[6:8]) addedToFront, _ := s.rxSeqBuf.add(seqNum(gotSeq), r[24:]) - - // If the packet is not added to the front of the seqbuf, then it means that it was an answer for a - // retransmit request (or it was an out of order packet which we don't want start a retransmit). if !addedToFront { + // If the packet is not added to the front of the seqbuf, then it means that it was an answer for a + // retransmit request (or it was an out of order packet which we don't want start a retransmit request). return nil }