FVoicePacketBuffer

[FVoicePacketBuffer](API\Plugins\OnlineSubsystemUtils\FVoicePacketBuffer) This class is used to handle sorting of packets as they arrive.

Choose your operating system:

Windows

macOS

Linux

References

Module

OnlineSubsystemUtils

Header

/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Public/VoicePacketBuffer.h

Include

#include "VoicePacketBuffer.h"

Syntax

class FVoicePacketBuffer

Remarks

FVoicePacketBuffer This class is used to handle sorting of packets as they arrive. This class is intended to be thread safe, as long as PushPacket() nor PopAudio() are called by multiple threads.

Constructors

Name Description

Public function

FVoicePacketBuffer

(
    int32 BufferSize,
    int32 InNumSamplesUntilIdling,
    uint64 InStartSample
)

This is the only constructor that should be used with FVoicePacketBuffer.

Functions

Name Description

Public function

uint32

 

DropOldestAudio

(
    uint32 InNumSamples
)

When called, will seek forward in the buffer by the requested number of samples, skipping and removing the audio we seek past.

Public function

uint64

 

GetCurrentSample()

Get whatever the most recent sample processed is for buffer-accurate timing.

Public function

int32

 

GetNumBufferedSamples()

This will return the current amount of samples buffered here.

Public function

bool

 

IsIdle()

Whether we have idled out. This is used to automatically close the audio stream and free resources when unused.

Public function

int32

 

PopAudio

(
    float* DestBuffer,
    uint32 RequestedSamples
)

Pop RequestedSamples of float samples into DestBuffer.

Public function

void

 

PushPacket

(
    const void* InBuffer,
    int32 NumBytes,
    uint64 InStartSample,
    EVoipStreamDataFormat Format
)

Push a new packet of decompressed audio onto the buffer to be consumed.

Public function

void

 

Reset

(
    int32 InStartSample
)

Clears the buffer.