startOutput method

void startOutput()

Start outputting frames at the target FPS

This is used when we need to maintain a consistent frame rate for the output stream.

Implementation

void startOutput() {
  if (_outputTimer != null) return;

  final interval = Duration(milliseconds: (1000 / _fps).round());
  _outputTimer = Timer.periodic(interval, (_) {
    if (_frameBuffer.isNotEmpty) {
      _currentFrame = _frameBuffer.removeAt(0);
      onFrameAvailable?.call(_currentFrame!);
    }
  });

  debugPrint('VirtualStreamSource: Started output at $_fps fps');
}