Navigation
API > API/Plugins > API/Plugins/OnlineSubsystemUtils
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.
| Name | FVoicePacketBuffer |
| Type | class |
| Header File | /Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Public/VoicePacketBuffer.h |
| Include Path | #include "VoicePacketBuffer.h" |
Syntax
class FVoicePacketBuffer
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| Default constructor. Hidden on purpose. | VoicePacketBuffer.h | ||
FVoicePacketBuffer
(
int32 BufferSize, |
This is the only constructor that should be used with FVoicePacketBuffer. | VoicePacketBuffer.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bIsIdle | FThreadSafeBool | Bool set when IdleSampleCounter is above NumSamplesUntilIdling. | VoicePacketBuffer.h | |
| FreedIndicesQueue | TQueue< int32 > | After a packet is used, we push its index on the PacketBuffer so that we can Initialize it. | VoicePacketBuffer.h | |
| IdleSampleCounter | uint32 | This tracks the number of samples of silence we've popped since we last had a viable packet of audio. | VoicePacketBuffer.h | |
| ListHead | FSortedVoicePacketNode * | Current packet that the buffer is popping audio from. | VoicePacketBuffer.h | |
| NumBufferedSamples | FThreadSafeCounter | The amount of samples of audio we currently have buffered. | VoicePacketBuffer.h | |
| NumSamplesUntilIdling | uint32 | Number of samples until we raise the bIsIdle flag. | VoicePacketBuffer.h | |
| PacketBuffer | TArray< FSortedVoicePacketNode > | This is treated as an unsorted memory pool for packets. Packets are overwritten after they are used. | VoicePacketBuffer.h | |
| SampleCounter | uint64 | Sample counter used to track silences when buffers are dropped, etc. | VoicePacketBuffer.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
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. | VoicePacketBuffer.h | |
uint64 GetCurrentSample() |
Get whatever the most recent sample processed is for buffer-accurate timing. | VoicePacketBuffer.h | |
int32 GetNumBufferedSamples() |
This will return the current amount of samples buffered here. | VoicePacketBuffer.h | |
bool IsIdle() |
Whether we have idled out. This is used to automatically close the audio stream and free resources when unused. | VoicePacketBuffer.h | |
int32 PopAudio
(
float* DestBuffer, |
Pop RequestedSamples of float samples into DestBuffer. | VoicePacketBuffer.h | |
void PushPacket
(
const void* InBuffer, |
Push a new packet of decompressed audio onto the buffer to be consumed. | VoicePacketBuffer.h | |
void Reset
(
int32 InStartSample |
Clears the buffer. | VoicePacketBuffer.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static int32 SizeOfSample
(
EVoipStreamDataFormat InFormat |
VoicePacketBuffer.h |