Raw data overview

Raw data access gives your app a hook into the Video SDK for Android's media pipeline: the YUV video frames, PCM audio samples, and screen-share frames the SDK is sending and receiving.

  • Custom video effects: background removal, filters, watermarks, AR overlays applied per-frame before frames reach remote users.
  • Server-side processing: transcription, recording to disk, or piping audio into your own backend.
  • Custom sources: feed video from a hardware capture device, a media file, or a synthesized stream into the SDK as if it were the device camera or microphone.

Select raw data memory mode

Raw data buffers can live in stack-allocated or heap-allocated memory. The choice matters because raw frames are produced at the framerate of the source and can pile up quickly. Heap is more flexible but heavier; stack is faster but the buffer dies the moment your callback returns.

Select raw data memory mode

In order to utilize raw data of any type, you must first select the memory mode you wish to use. The SDK supports heap-based and stack-based memory modes.

Stack-based memory

  • Variables are allocated automatically and deallocated after the data leaves scope.
  • Variables are not accessible from or transferable to other threads.
  • Typically has faster access than heap-based memory allocation.
  • Memory space is managed by the CPU and will not become fragmented.
  • Variables cannot be resized.

See Stack-based memory allocation for details.

Specify with ZoomVideoSDKRawDataMemoryMode.ZoomVideoSDKRawDataMemoryModeStack.

Heap-based memory

  • Variables are allocated and deallocated manually. You must allocate and free variables to avoid memory leaks.
  • Variables can be accessed globally.
  • Has relatively slower access than stack-based memory allocation.
  • Has no guarantee on the efficiency of memory space and can become fragmented.
  • Variables can be resized.

See Heap-based dynamic memory allocation for details.

Specify with ZoomVideoSDKRawDataMemoryMode.ZoomVideoSDKRawDataMemoryModeHeap.

Apply the memory mode

Set the memory mode for audio, video, and share independently when you build your ZoomVideoSDKInitParams. The mode you pick here applies to every raw-data callback for that stream type for the lifetime of the SDK instance.

val modeHeap = ZoomVideoSDKRawDataMemoryMode.ZoomVideoSDKRawDataMemoryModeHeap
val params = ZoomVideoSDKInitParams().apply {
    videoRawDataMemoryMode = modeHeap
    audioRawDataMemoryMode = modeHeap
    shareRawDataMemoryMode = modeHeap
}
ZoomVideoSDKRawDataMemoryMode modeHeap = ZoomVideoSDKRawDataMemoryMode.ZoomVideoSDKRawDataMemoryModeHeap;
ZoomVideoSDKInitParams params = new ZoomVideoSDKInitParams();
params.videoRawDataMemoryMode = modeHeap;
params.audioRawDataMemoryMode = modeHeap;
params.shareRawDataMemoryMode = modeHeap;

Note

Unlike video, raw audio defaults to stack-based memory if you don't set audioRawDataMemoryMode.