How nmelihsensoy/streamviewer works
Main components
• Android Frontend: Represented by the UI layer (MainActivity and associated Android resources/layouts).
• Streaming Engine: The integration with GStreamer both in Java (org.freedesktop.gstreamer and androidmedia packages) and in the native layer (native-lib.cpp and gstreamer_android.c) that performs video decoding and processing.
• HLS Streaming Component: The HLS server functionality as implemented in HlsServer.java, which restreams the current TCP source to an HLS feed.
• Frame Capture & YOLO Inference Module: This comprises components like ModelHelper.java and assets such as the yolov5su.onnx file, which are used to capture frames, run inference, and display output.
• External Dependencies/Configurations: Include the externally configured SDK paths from gradle.properties (paths to GStreamer and OpenCV SDKs).
Relationships and interactions
• The Android Frontend (MainActivity) interacts with the Streaming Engine to initiate the TCP stream connection and display video.
• The Streaming Engine, implemented partly in Java and partly in C/C++ (JNI), handles GStreamer’s stream processing.
• The HLS Restreaming component, via HlsServer, creates an endpoint (port 8181) making the stream accessible over HTTP.
• When a frame is captured, the UI triggers the Frame Capture module; the captured frame is saved to local storage and then passed to the YOLO Inference module, which processes the image and logs the detection results.
• Configurations in gradle.properties set up critical paths for external libraries (GStreamer, OpenCV), which the native and Java components utilize at runtime.
Architectural patterns and design principles
• Separation of concerns: Clean segregation between the frontend (UI), stream processing, native integration (for performance-critical tasks), and inference logic.
• Use of JNI for performance: The native C/C++ code is used to interface with GStreamer (likely for optimized streaming processing).
• Modularity: The modular folder structure (src/main/java for Android components, src/main/cpp for the native code) reinforces a modular design.
• Integration of external services: The HLS server exposes a network endpoint, illustrating inter-process / network communication.
Relevant technologies/frameworks
• Android SDK for UI.
• GStreamer (both Java and native C/C++ libraries) for media stream processing.
• ONNX model (YOLO inference) and potentially OpenCV for image manipulation.
• Gradle as the build system and CMake for native build configurations.