( rawPkt []byte, rtpPacket *rtp.Packet, arrivalTime int64, isBuffered bool, isRTX bool, skippedSeqs []uint16, oobSequenceNumber uint16, )
| 723 | } |
| 724 | |
| 725 | func (b *BufferBase) HandleIncomingPacketLocked( |
| 726 | rawPkt []byte, |
| 727 | rtpPacket *rtp.Packet, |
| 728 | arrivalTime int64, |
| 729 | isBuffered bool, |
| 730 | isRTX bool, |
| 731 | skippedSeqs []uint16, |
| 732 | oobSequenceNumber uint16, |
| 733 | ) (uint64, error) { |
| 734 | if rtpPacket == nil { |
| 735 | rtpPacket = &rtp.Packet{} |
| 736 | if err := rtpPacket.Unmarshal(rawPkt); err != nil { |
| 737 | b.logger.Errorw("could not unmarshal RTP packet", err) |
| 738 | return 0, err |
| 739 | } |
| 740 | } |
| 741 | |
| 742 | b.processAudioSsrcLevelHeaderExtension(rtpPacket, arrivalTime) |
| 743 | |
| 744 | if len(skippedSeqs) > 0 { |
| 745 | // Use the current highest timestamp to prevent the case of old sequence number and newer timestamp. |
| 746 | // It is possible that the skipped packet is older. An example sequence |
| 747 | // - Packet 10, skipped 6, 7, 9 -> Packet 8 is unknown at this point |
| 748 | // - Packet 11, skipped 8 -> this would cause sequence number to be older, but using timestamp from Packet 11 will make time stamp diff +ve |
| 749 | ts := b.rtpStats.HighestTimestamp() |
| 750 | for _, sn := range skippedSeqs { |
| 751 | flowState := b.rtpStats.Update( |
| 752 | arrivalTime, |
| 753 | sn, |
| 754 | ts, |
| 755 | false, // no marker |
| 756 | 0, // no header for skipped packet, so 0 size |
| 757 | 0, // no payload |
| 758 | 0, // no padding |
| 759 | ) |
| 760 | if flowState.UnhandledReason == rtpstats.RTPFlowUnhandledReasonNone && !flowState.IsOutOfOrder { |
| 761 | if err := b.snRangeMap.ExcludeRange(flowState.ExtSequenceNumber, flowState.ExtSequenceNumber+1); err != nil { |
| 762 | b.logger.Errorw( |
| 763 | "could not exclude range", err, |
| 764 | "sequenceNumber", sn, |
| 765 | "extSequenceNumber", flowState.ExtSequenceNumber, |
| 766 | "rtpStats", b.rtpStats, |
| 767 | "rtpStatsLite", b.rtpStatsLite, |
| 768 | "snRangeMap", b.snRangeMap, |
| 769 | "skipped", skippedSeqs, |
| 770 | ) |
| 771 | } |
| 772 | } |
| 773 | } |
| 774 | } |
| 775 | |
| 776 | // do not start on an RTX packet |
| 777 | if isRTX && !b.rtpStats.IsActive() { |
| 778 | return 0, errors.New("cannot start on rtx packet") |
| 779 | } |
| 780 | |
| 781 | flowState := b.rtpStats.Update( |
| 782 | arrivalTime, |
no test coverage detected