123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- #ifndef MODULES_VIDEO_CODING_UTILITY_FRAME_DROPPER_H_
- #define MODULES_VIDEO_CODING_UTILITY_FRAME_DROPPER_H_
- #include <stddef.h>
- #include <stdint.h>
- #include <string.h>
- namespace video_coding {
- // The Frame Dropper implements a variant of the leaky bucket algorithm
- // for keeping track of when to drop frames to avoid bit rate
- // over use when the encoder can't keep its bit rate.
- typedef struct _FrameDropper FrameDropper;
- FrameDropper *frame_dropper_new();
- void frame_dropper_destroy(FrameDropper *obj);
- // Resets the FrameDropper to its initial state.
- void frame_dropper_reset(FrameDropper *obj);
- void frame_dropper_enable(FrameDropper *obj, bool enable);
- // Answers the question if it's time to drop a frame if we want to reach a
- // given frame rate. Must be called for every frame.
- //
- // Return value : True if we should drop the current frame.
- bool frame_dropper_drop_frame(FrameDropper *obj);
- // Updates the FrameDropper with the size of the latest encoded frame.
- // The FrameDropper calculates a new drop ratio (can be seen as the
- // probability to drop a frame) and updates its internal statistics.
- //
- // Input:
- // - framesize_bytes : The size of the latest frame returned
- // from the encoder.
- // - delta_frame : True if the encoder returned a key frame.
- void frame_dropper_fill(FrameDropper *obj, size_t framesize_bytes, bool delta_frame);
- void frame_dropper_leak(FrameDropper *obj, uint32_t input_framerate);
- // Sets the target bit rate and the frame rate produced by the camera.
- //
- // Input:
- // - bitrate : The target bit rate. kbps
- void frame_dropper_set_rates(FrameDropper *obj, float bitrate, float incoming_frame_rate);
- }
- #endif // MODULES_VIDEO_CODING_UTILITY_FRAME_DROPPER_H_
|