Table of Contents

Class MediaGlobal

Namespace
VAST.Media
Assembly
VAST.Common.dll

Provides global buffer allocators and memory management utilities used across all VASTreaming libraries.

public static class MediaGlobal
Inheritance
MediaGlobal
Inherited Members

Properties

Allocator

Gets the normal buffer allocator for buffers up to 50 KB.

public static VersatileBufferAllocator Allocator { get; }

Property Value

VersatileBufferAllocator

Remarks

The allocator is automatically initialized on first access if not already initialized.

BigAllocator

Gets the big buffer allocator for buffers up to 1 MB.

public static VersatileBufferAllocator BigAllocator { get; }

Property Value

VersatileBufferAllocator

Remarks

The allocator is automatically initialized on first access if not already initialized.

HaveExtraBigAllocator

Gets a value indicating whether the extra big allocator has been initialized.

public static bool HaveExtraBigAllocator { get; }

Property Value

bool

IsInitialized

Gets a value indicating whether the global allocators have been initialized.

public static bool IsInitialized { get; }

Property Value

bool

SmallAllocator

Gets the small buffer allocator for buffers up to 5 KB.

public static VersatileBufferAllocator SmallAllocator { get; }

Property Value

VersatileBufferAllocator

Remarks

The allocator is automatically initialized on first access if not already initialized.

Methods

GetAverageAllocatorsUsage()

Gets the running average usage across all allocators.

public static double GetAverageAllocatorsUsage()

Returns

double

A value between 0 and 1 representing the maximum usage ratio among all allocators, averaged over time.

GetFreeMemory()

Gets the amount of free memory available on the system.

public static long GetFreeMemory()

Returns

long

The available free memory in bytes.

GetPhysicalMemory()

Gets the total physical memory of the system.

public static long GetPhysicalMemory()

Returns

long

The total physical memory in bytes.

GetTotalCpuUsage()

Gets the current total CPU usage across all processors.

public static double GetTotalCpuUsage()

Returns

double

A value between 0 and 1 representing the CPU usage percentage.

Initialize(int, int, int, VersatileBufferAllocatorParameters)

Initializes the global allocators used across all VASTreaming libraries with explicit buffer counts.

public static void Initialize(int smallAllocatorBuffers, int normalAllocatorBuffers, int bigAllocatorBuffers, VersatileBufferAllocatorParameters parameters = null)

Parameters

smallAllocatorBuffers int

The number of buffers for the small allocator.

normalAllocatorBuffers int

The number of buffers for the normal allocator.

bigAllocatorBuffers int

The number of buffers for the big allocator.

parameters VersatileBufferAllocatorParameters

Optional additional parameters for allocator configuration.

Initialize(float, VersatileBufferAllocatorParameters)

Initializes the global allocators used across all VASTreaming libraries.

public static void Initialize(float expectedLoad = 1, VersatileBufferAllocatorParameters parameters = null)

Parameters

expectedLoad float

An abstract value representing the expected load, where 1.0 means normal load for one instance (e.g., one player or one publisher).

parameters VersatileBufferAllocatorParameters

Optional additional parameters for allocator configuration.

InitializeExtra(int, int, VersatileBufferAllocatorParameters)

Initializes the extra big allocator for buffers larger than 1 MB.

public static void InitializeExtra(int expectedBufferSize, int expectedBufferCount, VersatileBufferAllocatorParameters parameters = null)

Parameters

expectedBufferSize int

The expected size of each buffer in bytes.

expectedBufferCount int

The expected number of buffers to allocate.

parameters VersatileBufferAllocatorParameters

Optional additional parameters for allocator configuration.

LockBuffer(int)

Locks and returns a buffer of at least the specified size from the appropriate allocator.

public static VersatileBuffer LockBuffer(int size)

Parameters

size int

The minimum required buffer size in bytes.

Returns

VersatileBuffer

A locked buffer from the smallest allocator that can accommodate the requested size.

Remarks

The method automatically selects the appropriate allocator based on the requested size: small allocator for sizes up to 5 KB, normal allocator for sizes up to 50 KB, big allocator for sizes up to 1 MB, and extra big allocator for larger sizes.

Uninitialize()

Releases all internal allocators and other static resources.

public static void Uninitialize()