Took a closer look at the recent error messages. These problems were there in previous builds as well; they were just silent (in other words, I was unaware of the issues). Most of them appeared when estimating the compression ratio during standby - in this case, I've been calling the lossless compression routine in the so-called "dummy mode" (without image output - just to have it report the compression ratio). Turns out, when the planets were aligned, this method resulted in some left-overs on the EDMAC write channel (the one that writes the compressed output in memory); as a result, the first frame was sometimes invalid.
As I couldn't figure out how to clean the EDMAC channel, the easiest way was to avoid calling the lossless compression routines in "dummy mode" - that is, always provide a valid output buffer. If I go that far, I might as well refactor the memory management, so the raw recording buffers are always allocated during standby (and freed when exiting LiveView or when going to photo mode). It was a bit of work, but that's what I did.
You may ask, why?
Allocating memory for video buffers is slow (takes a few seconds to allocate the entire shooting memory) and complicated (see exmem.c and RscMgr thread). So, having the memory allocated in advance means recording can start right away (already discussed
a few pages earlier).
By contrast, creating the MLV file is very fast, so there's very little to gain by opening it in advance.
Minor: the status bar also shows how many buffers we have allocated, and their size.
Regarding 1080p48 - it was pushed a bit over the safe limit, so I've reduced its resolution to 1040. You still have the option to go back to 1080
in the crop_rec submenu; however, you'll get a lot of errors. With some fiddling, you can probably get 1060 (e.g. set Target YRES to 1060 and Delta HEAD3 to -20), but I wouldn't trust it yet.
Also found a way to sync the H.264 proxy with the raw stream - by making the extra frames black. The first non-black frame from H.264 will match the first frame from MLV. Easy.
I've also integrated the thread-safety annotations (using clang) and fine-tuned the dynamic menus to make them halfway usable.
Overall, the build is still too buggy for my taste, but at least it's a small step forward.