reset method

void reset()

Reset all in-flight encoder state: reference frames, framesSinceKey counter, pending KF/GOLDEN/ALTREF requests, and the cached lastFrameStats. The next encodeFrame call will produce a keyframe regardless of keyframeInterval. The configured rate controller (if any) is NOT touched — reset it separately if you need a fresh leaky-bucket state. Useful when rebinding to a new peer or restarting a session without rebuilding the encoder object.

Implementation

void reset() {
  _prevLast = null;
  _prevGolden = null;
  _prevAltref = null;
  _framesSinceKey = 0;
  _cirCursor = 0;
  _pendingKeyRequest = false;
  _pendingGoldenRequest = false;
  _pendingAltrefRequest = false;
  _lastStats = null;
  _cum._reset();
}