MediaIO.TimedDataChannel.MaxBufferSize

MediaIO.TimedDataChannel.MaxBufferSize

#Overview

name: MediaIO.TimedDataChannel.MaxBufferSize

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of MediaIO.TimedDataChannel.MaxBufferSize is to set the maximum buffer size for MediaIO channels in the Unreal Engine’s Media IO Framework. This setting is crucial for managing memory and performance in media input/output operations.

This setting variable is primarily used in the Media IO Framework, which is part of Unreal Engine’s media plugins. Specifically, it’s utilized in the MediaIOCore module, which is responsible for handling core functionalities of media input and output.

The value of this variable is set using a console variable (CVar) system. It’s defined with a default value of 32, but can be changed at runtime or through configuration files.

The associated variable CVarMediaIOMaxBufferSize directly interacts with MediaIO.TimedDataChannel.MaxBufferSize. They share the same value and purpose, with CVarMediaIOMaxBufferSize being the actual console variable that controls the setting.

Developers should be aware that this variable affects the maximum size of the buffer that MediaIO channels are allowed to use. Setting this value too low might lead to performance issues or data loss if the buffer fills up too quickly. Conversely, setting it too high might consume unnecessary memory.

Best practices when using this variable include:

  1. Adjusting it based on the specific requirements of your media input/output operations.
  2. Monitoring performance and memory usage to find the optimal value for your use case.
  3. Consider the target platform’s capabilities when setting this value.

Regarding the associated variable CVarMediaIOMaxBufferSize:

Its purpose is to provide a programmatic way to access and modify the MediaIO.TimedDataChannel.MaxBufferSize setting within the C++ code of the engine.

This variable is used in the MediaIOCore module, specifically in the MediaIOCorePlayerBase class.

The value of CVarMediaIOMaxBufferSize is set when the engine initializes the console variables, but it can be modified at runtime using console commands or through code.

It directly interacts with the MediaIO.TimedDataChannel.MaxBufferSize setting, effectively controlling the same functionality.

Developers should be aware that changes to CVarMediaIOMaxBufferSize will immediately affect the maximum buffer size for MediaIO channels.

Best practices for using CVarMediaIOMaxBufferSize include:

  1. Using it to dynamically adjust the buffer size based on runtime conditions if necessary.
  2. Ensuring that any code that modifies this value considers the potential impact on performance and memory usage.
  3. Documenting any custom logic that modifies this variable to maintain code clarity.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Plugins/Media/MediaIOFramework/Source/MediaIOCore/Private/Player/MediaIOCorePlayerBase.cpp:49

Scope (from outer to inner):

file
namespace    MediaIOCorePlayerDetail

Source code excerpt:


	TAutoConsoleVariable<int32> CVarMediaIOMaxBufferSize(
		TEXT("MediaIO.TimedDataChannel.MaxBufferSize"),
		32,
		TEXT("The max size the MediaIO channels is allowed to set the buffer size."),
		ECVF_Default
	);

	// [JITR] Detailed insights

#Associated Variable and Callsites

This variable is associated with another variable named CVarMediaIOMaxBufferSize. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Plugins/Media/MediaIOFramework/Source/MediaIOCore/Private/Player/MediaIOCorePlayerBase.cpp:48

Scope (from outer to inner):

file
namespace    MediaIOCorePlayerDetail

Source code excerpt:

	static bool bLogTimecode = false;

	TAutoConsoleVariable<int32> CVarMediaIOMaxBufferSize(
		TEXT("MediaIO.TimedDataChannel.MaxBufferSize"),
		32,
		TEXT("The max size the MediaIO channels is allowed to set the buffer size."),
		ECVF_Default
	);

#Loc: <Workspace>/Engine/Plugins/Media/MediaIOFramework/Source/MediaIOCore/Private/Player/MediaIOCorePlayerBase.cpp:564

Scope (from outer to inner):

file
function     bool FMediaIOCorePlayerBase::ReadMediaOptions

Source code excerpt:

	BaseSettings.FrameRate = VideoFrameRate;
	BaseSettings.PlayerTimeOffset = MediaIOCorePlayerDetail::HighPerformanceClockDelta;
	BaseSettings.AbsoluteMaxBufferSize = MediaIOCorePlayerDetail::CVarMediaIOMaxBufferSize.GetValueOnGameThread();

	const TSharedPtr<UCaptureCardMediaSource::FOpenColorIODataContainer> OCIODataContainer = StaticCastSharedPtr<UCaptureCardMediaSource::FOpenColorIODataContainer>(Options->GetMediaOption(UE::CaptureCardMediaSource::OpenColorIOSettings, TSharedPtr<UCaptureCardMediaSource::FOpenColorIODataContainer, ESPMode::ThreadSafe>()));
	if (OCIODataContainer)
	{
		OCIOSettings = MakeShared<FOpenColorIOColorConversionSettings>(OCIODataContainer->ColorConversionSettings);
	}