@@ -68,3 +68,39 @@ pixelpilot --help
68
68
69
69
1 . Video is cropped when the fpv feed resolution is bigger than the screen mode.
70
70
1 . Crashes when video feed resolution is higher than the screen resolution.
71
+
72
+ ## The way it works
73
+
74
+ It uses ` mpp ` library to decode MPEG frames using Rockchip hardware decoder.
75
+ It uses ` gstreamer ` to read the RTP media stream from video UDP.
76
+ It uses ` mavlink ` decoder to read Mavlink telemetry from telemetry UDP (if enabled), see ` mavlink.c `
77
+ It uses ` cairo ` library to draw OSD elements (if enabled), see ` osd.c ` .
78
+ It uses [ Direct Rendering Manager (DRM)] ( https://en.wikipedia.org/wiki/Direct_Rendering_Manager ) to
79
+ display video on the screen, see ` drm.c ` .
80
+ It writes raw MPEG stream to file as DVR (if enabled) using ` minimp4.h ` library.
81
+
82
+ Pixelpilot starts several threads:
83
+
84
+ * main thread
85
+ controls gstreamer which reads RTP, extracts MPEG frames and
86
+ - feeds them to MPP hardware decoder
87
+ - sends them to DVR thread via mutex-protected ` std::queue ` (if enabled)
88
+ * DVR_THREAD (if enabled)
89
+ reads frames from main thread via ` std::queue ` and writes them to disk using ` minimp4 ` library
90
+ it yields on a condition variable for DVR queue or ` kill ` signal variable
91
+ * FRAME_THREAD
92
+ reads decoded video frames from MPP hardware decoder and forwards them to ` DISPLAY_THREAD `
93
+ through DRM ` output_list ` protected by ` video_mutex `
94
+ Seems that thread vields on ` mpi->decode_get_frame() ` call waiting for HW decoder to return a new frame
95
+ * DISPLAY_THREAD
96
+ reads frames and OSD from ` video_mutex ` -protected ` output_list ` and calls ` drm* ` functions to
97
+ render them on the screen
98
+ The loop yields on ` video_mutex ` and ` video_cond ` waiting for a new frame to
99
+ display from FRAME_THREAD
100
+ * MAVLINK_THREAD (if OSD and mavlink configured)
101
+ reads mavlink packets from UDP, decodes and updates ` osd_vars ` (without any mutex)
102
+ The loop yields on UDP read
103
+ * OSD_THREAD (if OSD is enabled)
104
+ takes ` drm_fd ` and ` output_list ` as thread parameters
105
+ draws telemetry on a buffer inside ` output_list ` based on ` osd_vars ` using Cairo library
106
+ The loop yelds on explicit ` sleep ` to control refresh rate
0 commit comments