SBSDKFrameLimiter

@interface SBSDKFrameLimiter : NSObject

A simple frame limiter class. An object can use this class to limit the number of events fired per second. E.g. A camera device captures video frames with 60 frames per second and passes them to a detector. Use this class to limit the number of detector runs to a smaller value, like 20 frames per second, skipping the remaining 40 frames per second. As the detector needs lots of CPU power this limit can drastically reduce CPU usage and therefore saves battery.

  • The frames per second value of the receiver.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) NSUInteger fpsCount;

    Swift

    var fpsCount: UInt { get set }
  • The total number of frames the receiver registered since it started.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSUInteger framesTotal;

    Swift

    var framesTotal: UInt { get }
  • The total number of frames the receiver skipped since it started.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSUInteger framesSkipped;

    Swift

    var framesSkipped: UInt { get }
  • The minimum time in seconds that must pass by before processing the next frame (1.0 / fpsCount).

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSTimeInterval frameDuration;

    Swift

    var frameDuration: TimeInterval { get }
  • The percentual ratio of skipped frames to total frames since the receivers start.

    Declaration

    Objective-C

    @property (readonly, nonatomic) double throttleRate;

    Swift

    var throttleRate: Double { get }
  • Designated initializer.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithFPSCount:(NSUInteger)fpsCount;

    Swift

    init(fpsCount: UInt)

    Parameters

    fpsCount

    The maximum number of frames per second to be analyzed.

  • Returns YES, if since the last frame enough time passed by to process the next frame, NO otherwise.

    Declaration

    Objective-C

    - (BOOL)isReadyForNextFrame;

    Swift

    func isReadyForNextFrame() -> Bool