start method
Start processing frames from the given stream
targetWidth/targetHeight - Optional vidCons dimensions. When set,
frames are decoded at these dimensions instead of the camera's native
resolution, significantly reducing CPU/GPU load.
Implementation
Future<void> start(MediaStream stream,
{int? targetWidth, int? targetHeight}) async {
if (!_isInitialized) {
await initialize();
}
_sourceStream = stream;
_targetWidth = targetWidth;
_targetHeight = targetHeight;
// Only start processing if we have a background set
if (hasBackground) {
await _startProcessingInternal();
}
debugPrint(
'BackgroundProcessorService: Started with stream (target: ${targetWidth ?? "native"}x${targetHeight ?? "native"})');
}