memory-tuning: document the self-sizing frame pool and the settings that shrink it - #479
Open
widgetii wants to merge 2 commits into
Open
memory-tuning: document the self-sizing frame pool and the settings that shrink it#479widgetii wants to merge 2 commits into
widgetii wants to merge 2 commits into
Conversation
isp.blkCnt was written up as a number to tune by hand, one step at a time, watching whether the stream survived. The streamer now derives it from the pipeline, so the useful thing to document is what it arrives at and why two cameras with the same chip land on different figures — which turns out to be the sensor's width rather than the model of SoC, since a sensor too wide for the capture pipe has to route frames through memory and that costs whole frames. Also documents how running short presents, because it is the least intuitive part: a pool one block short encodes video perfectly and answers no snapshots, so a camera judged by its RTSP feed looks healthy. And how to read the headroom from /proc/umap/vb rather than guessing at it. Drops the advice to pair compression with a lower blkCnt. The streamer works out how many frames it can compress while keeping the rest of the pipeline supplied, and says when there is nothing to spare. Drops the "a recent majestic update" framing from the compression section. What the software does now is the documentation; when it started doing it is not.
PR Summary by QodoDocument self-sized frame pool (isp.blkCnt) and VB headroom checks
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTo customize comments, go to the Qodo configuration screen, or learn more in the docs. |
The section explained how to tune the frame pool before saying that the cheapest way to shrink it is to stop asking for channels you do not use. Every channel costs a whole frame whether or not it is producing one, because the pool is fixed when the streamer starts — so jpeg.enabled and video1.enabled each return more than any amount of tuning below them, and on a 24MB board one frame is an eighth of everything. So the section now opens with a table of what each setting is worth, in frames rather than in prose, and the two JPEG settings get their own entries: jpeg.enabled, which no longer half-works — it used to reserve a frame for a channel it would not raise, and answer /image.jpg anyway. Off now means no frame and a named refusal, and the article says plainly that this takes ONVIF snapshot URIs and the web UI preview with it, since that is the part someone will discover the hard way. jpeg.tuned, which is new: a size rather than a switch, because the memory follows it. Parameterised snapshots need a second encoder, and reserving for the size you actually fetch costs about 1MB at 640x360 against 5.6MB for a sensor frame. Includes the sizes where a cap stops being a saving.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings the streamer section in line with how memory actually works now, after majestic#277, #278 and #281.
The section led with the wrong thing
It explained how to hand-tune
isp.blkCnt— "change it one step at a time and confirm the stream still runs" — when the pool now sizes itself, and when the cheapest way to shrink it is to stop asking for channels you don't use. Every channel costs a whole frame whether or not it's producing one, because the pool is fixed at startup. On a 24 MB gk7205v200 one frame is an eighth of everything.So it now opens with what each setting is worth, in frames:
jpeg.enabled: falsevideo1.enabled: falseisp.yuvCompression: segjpeg.tunedisp.blkCntisp.memModeisp.blkCnt— derived, not tunedDocuments what the streamer arrives at and why two cameras with the same chip differ — the sensor's width, not the SoC. A sensor too wide for the capture pipe routes frames through memory, which costs whole frames:
Plus how running short presents, which is the least intuitive part: a pool one block short encodes video perfectly and answers no snapshots, so a camera judged by its RTSP feed looks healthy. And how to read the headroom from
/proc/umap/vb(MinFree) rather than guessing.Two new sections
jpeg.enabledno longer half-works — it used to reserve a frame for a channel it would not raise, and answer/image.jpganyway. Off now means no frame and a named refusal, with measured figures (gk 12156→9116 KB, ev300 28860→23088 KB). The article says plainly that this takes ONVIF snapshot URIs and the web UI preview with it, since that's the part someone would otherwise discover the hard way.jpeg.tunedis new: a size rather than a switch, because the memory follows it. Reserving for the size you actually fetch costs ~1 MB at 640x360 against 5.6 MB for a sensor frame — including the point where a large cap stops being a saving at all.Also
blkCnt— the streamer now works out how many frames it can compress while keeping the rest of the pipeline supplied.---rule that was swallowing the preceding paragraph.All figures are measured on the lab cameras, not derived. Depends on majestic#281 for the
jpeg.tunedbehaviour.