You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: rtp_unpacker_avc_hevc.go
    path of file: ./repos/lal/pkg/rtprtcp
    
    the code of the file until where you have to start completion: // Copyright 2021, Chef.  All rights reserved.
// https://github.com/q191201771/lal
//
// Use of this source code is governed by a MIT-style license
// that can be found in the License file.
//
// Author: Chef (191201771@qq.com)

package rtprtcp

import (
	"encoding/hex"
	"github.com/q191201771/lal/pkg/avc"
	"github.com/q191201771/lal/pkg/base"
	"github.com/q191201771/lal/pkg/hevc"
	"github.com/q191201771/naza/pkg/bele"
	"github.com/q191201771/naza/pkg/nazabytes"
)

type RtpUnpackerAvcHevc struct {
	payloadType base.AvPacketPt
	clockRate   int
	onAvPacket  OnAvPacket
}

func NewRtpUnpackerAvcHevc(payloadType base.AvPacketPt, clockRate int, onAvPacket OnAvPacket) *RtpUnpackerAvcHevc {
	return &RtpUnpackerAvcHevc{
		payloadType: payloadType,
		clockRate:   clockRate,
		onAvPacket:  onAvPacket,
	}
}

func (unpacker *RtpUnpackerAvcHevc) CalcPositionIfNeeded(pkt *RtpPacket) {
	switch unpacker.payloadType {
	case base.AvPacketPtAvc:
		calcPositionIfNeededAvc(pkt)
	case base.AvPacketPtHevc:
		calcPositionIfNeededHevc(pkt)
	}
}

func (unpacker *RtpUnpackerAvcHevc) TryUnpackOne(list *RtpPacketList) (unpackedFlag bool, unpackedSeq uint16) {
	first := list.Head.Next
	if first == nil {
		return false, 0
	}

	switch first.Packet.positionType {
	case PositionTypeSingle:
		var pkt base.AvPacket
		pkt.PayloadType = unpacker.payloadType
		pkt.Timestamp = int64(first.Packet.Header.Timestamp / uint32(unpacker.clockRate/1000))

		pkt.Payload = make([]byte, len(first.Packet.Body())+4)
		bele.BePutUint32(pkt.Payload, uint32(len(first.Packet.Body())))
		copy(pkt.Payload[4:], first.Packet.Body())

		list.Head.Next = first.Next
		list.Size--
		unpacker.onAvPacket(pkt)
		return true, first.Packet.Header.Seq

	case PositionTypeStapa, PositionTypeAp:
		skip := uint32(1)
		if fir
    
func calcPositionIfNeededAvc(pkt *RtpPacket) {
	b := pkt.Body()

	// rfc3984 5.3.  NAL Unit Octet Usage
	//
	// +---------------+
	// |0|1|2|3|4|5|6|7|
	// +-+-+-+-+-+-+-+-+
	// |F|NRI|  Type   |
	// +---------------+

	outerNaluType := avc.ParseNaluType(b[0])
	if outerNaluType <= NaluTypeAvcSingleMax {
		pkt.positionType = PositionTypeSingle
		return
	} else if outerNaluType == NaluTypeAvcFua {

		// rfc3984 5.8.  Fragmentation Units (FUs)
		//
		// 0                   1                   2                   3
		// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
		// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
		// | FU indicator  |   FU header   |                               |
		// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |
		// |                                                               |
		// |                         FU payload                            |
		// |                                                               |
		// |                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
		// |                               :...OPTIONAL RTP padding        |
		// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
		//
		// FU indicator:
		// +---------------+
		// |0|1|2|3|4|5|6|7|
		// +-+-+-+-+-+-+-+-+
		// |F|NRI|  Type   |
		// +---------------+
		//
		// Fu header:
		// +---------------+
		// |0|1|2|3|4|5|6|7|
		// +-+-+-+-+-+-+-+-+
		// |S|E|R|  Type   |
		// +---------------+

		fuIndicator := b[0]
		_ = fuIndicator
		fuHeader := b[1]

		startCode := (fuHeader & 0x80) != 0
		endCode := (fuHeader & 0x40) != 0

		if startCode {
			pkt.positionType = PositionTypeFuaStart
			return
		}

		if endCode {
			pkt.positionType = PositionTypeFuaEnd
			return
		}

		pkt.positionType = PositionTypeFuaMiddle
		return
	} else if outerNaluType == NaluTypeAvcStapa {
		pkt.positionType = PositionTypeStapa
	} else {
		Log.Errorf("unknown nalu type. outerNaluType=%d(%d), header=%+v, len=%d, raw=%s",
			b[0], outerNaluType, pkt.Header, len(pkt.Raw), hex.Dump(nazabytes.Prefix(pkt.Raw, 128)))
	}

	return
}