Source File
media_packet_iterator.go
Belonging Package
github.com/pion/interceptor/pkg/flexfec/util
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>// SPDX-License-Identifier: MITpackage utilimport// MediaPacketIterator supports iterating through a list of media packets protected by// a specific Fec packet.type MediaPacketIterator struct {mediaPackets []rtp.PacketcoveredIndices []uint32nextIndex int}// NewMediaPacketIterator returns a new MediaPacketIterator.func ( []rtp.Packet, []uint32) *MediaPacketIterator {return &MediaPacketIterator{mediaPackets: ,coveredIndices: ,nextIndex: 0,}}// Reset sets the starting iterating index back to 0.func ( *MediaPacketIterator) () *MediaPacketIterator {.nextIndex = 0return}// HasNext indicates whether or not there are more media packets// that can be iterated through.func ( *MediaPacketIterator) () bool {return .nextIndex < len(.coveredIndices)}// Next returns the next media packet to iterate through.func ( *MediaPacketIterator) () *rtp.Packet {if .nextIndex == len(.coveredIndices) {return nil}:= .mediaPackets[.coveredIndices[.nextIndex]].nextIndex++return &}// First returns the first media packet to iterate through.func ( *MediaPacketIterator) () *rtp.Packet {if len(.coveredIndices) == 0 {return nil}return &.mediaPackets[.coveredIndices[0]]}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |