Flutter + Jetson Video: Decode Backpressure and Adaptive Stream Quality
A live stream can overwhelm a mobile client when decode, texture upload, and display cannot keep pace. The solution is end-to-end backpressure, not merely a smaller widget tree.
Measure each stage
Track bitrate, packet loss, jitter, decode time, texture upload cost, and displayed-frame age. Distinguish network delay from client decode delay.
Negotiate quality at the source
If supported, let the client request lower resolution or frame rate based on sustained measurements, not a single spike.
Keep control traffic independent
Video congestion should not block commands, health messages, or critical notifications. Use separate channels and priorities.
Bound jitter buffering
A larger buffer smooths jitter but increases latency. Set a maximum delay that fits the use case and expose stream health.
Validate sustained operation
Test roaming, weak signal, thermal throttling, reconnects, and long playback. Check for memory growth and old frames after recovery.
Example implementation
This Dart snippet illustrates one part of the design. Adapt types, transport behavior, timestamp semantics, and platform APIs to your actual system before production use.
class StreamHealth {
const StreamHealth({
required this.frameAgeMs,
required this.decodeMs,
required this.droppedFrames,
});
final double frameAgeMs;
final double decodeMs;
final int droppedFrames;
bool get shouldRequestLowerQuality =>
frameAgeMs > 350 || decodeMs > 40 || droppedFrames > 10;
}
Performance checklist
- Measure p95/p99 behavior on target hardware, not only a desktop simulator.
- Bound queues and buffers; define what may be coalesced or dropped.
- Keep heavy parsing, image processing, and inference away from the Flutter UI thread.
- Track source timestamps, sequence numbers, stale-data rate, and dropped updates.
- Test network degradation, reconnects, sustained operation, and resource pressure.
- Keep control commands and critical alerts separate from replaceable telemetry.
Useful Links
Website: www.v-modal.com
SDK Flutter: https://github.com/v-modal/vmodal_sdk_flutter
SDK Android: https://github.com/v-modal/vmodal_sdk_android
Discord: https://discord.gg/K72z28KUx
Top comments (0)