Skip to content

Commit d8e9707

Browse files
committed
framesource: allow 1 buffer on memory-constrained devices
The hard floor of 2 buffers overrode the RAM-based memory cap, causing T31L (64MB) devices to allocate 2 buffers per channel even when MemTotal (~34MB after ISP/rmem) could only afford 1. This starved the system and prevented streams from starting. Lower std::max floor from 2 to 1 so the 15%-of-RAM cap can take effect on low-memory devices. Higher-RAM devices are unaffected since their mem_cap remains above 2.
1 parent a37ad5d commit d8e9707

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/IMPFramesource.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ int IMPFramesource::init() {
5151
long frame_bytes = static_cast<long>(stream->width) * stream->height * 3 / 2; // NV12
5252
long ram_budget = get_total_ram_bytes() * 15 / 100;
5353
int mem_cap = static_cast<int>(ram_budget / frame_bytes);
54-
auto_buffers = std::max(2, std::min(auto_buffers, mem_cap));
54+
// Allow minimum of 1 buffer when memory-constrained (e.g. T31L 64MB devices
55+
// where MemTotal is ~34MB after ISP/rmem reservation).
56+
auto_buffers = std::max(1, std::min(auto_buffers, mem_cap));
5557
if (stream->buffers > 0) {
5658
chnAttr.nrVBs = stream->buffers;
5759
} else {

0 commit comments

Comments
 (0)