Interface BackgroundFilterVideoFrameProcessorObserver

An observer for the background filter video frame processor.

Use BackgroundFilterVideoFrameProcessor.addObserver to register an observer with the processor.

interface BackgroundFilterVideoFrameProcessorObserver {
    filterCPUUtilizationHigh?: (
        event: FilterCPUUtilizationHighEvent,
    ) => void;
    filterFrameDurationHigh?: (event: FilterFrameDurationHighEvent) => void;
}

Hierarchy (View Summary)

Properties

filterCPUUtilizationHigh?: (event: FilterCPUUtilizationHighEvent) => void

This event occurs when the CPU utilization of background filtering exceeds the filterCPUUtilization defined in the BackgroundBlurOptions.

Type declaration

    • (event: FilterCPUUtilizationHighEvent): void
    • Parameters

      • event: FilterCPUUtilizationHighEvent

        cpuUtilization: The percentage of time that was spent processing background filter divided by the total reporting period time; filterMillis: Total time spent processing the background filter in milliseconds; periodMillis: Total time in the reporting period in milliseconds;

      Returns void

filterFrameDurationHigh?: (event: FilterFrameDurationHighEvent) => void

This event occurs when the amount of time it takes to apply the background filter is longer than expected. The measurement is taken from the time the process method starts to when it returns. For example, if the video is running at 15 frames per second and we are averaging more than 67 ms (1000 ms reporting period / 15 fps) to apply background filter, then a very large portion of each frame's maximum processing time is taken up by processing background filter.

The observer will be called a maximum of once per periodMillis. In the event that the avgFilterDurationMillis is larger than expected the builder can use this event as a trigger to disable the background filter.

Type declaration

    • (event: FilterFrameDurationHighEvent): void
    • Parameters

      • event: FilterFrameDurationHighEvent

        framesDropped: The expected amount of frames based on frame rate minus the actual number of frames. avgFilterDurationMillis: The average amount of time that the processor took per frame in the reporting period. framerate: The video frame rate set by the SDK. periodMillis: The duration of the reporting period in milliseconds.

      Returns void