Don't manually override v4l2m2m buffer counts

This causes POLLERR when decoding from meson-vdec on the Libre
Computer Alta (and likely other Amlogic boards). Our requried buffer
counts were already lower than the default 16/20 configuration that
FFmpeg uses, so overriding them was just a memory usage optimization.
This commit is contained in:
Cameron Gutman
2026-04-20 00:25:21 -05:00
parent 51f86caac3
commit 5faa5fece8
-17
View File
@@ -564,23 +564,6 @@ bool FFmpegVideoDecoder::completeInitialization(const AVCodec* decoder, enum AVP
return false;
}
// The V4L2M2M decoders are one of the rare non-hwaccel decoders that allocates
// hardware frames under the hood. We need to adjust the number of buffers it
// allocates to ensure it allocates enough for our use case, but not too many.
// Normal hwaccel decoders will examine the codec/bitstream and the value we
// set in extra_hw_frames to determine how many buffers are required.
if (QString::fromUtf8(decoder->name).endsWith("_v4l2m2m", Qt::CaseInsensitive)) {
// 2 buffers for incoming compressed video data
av_dict_set_int(&options, "num_output_buffers", 2, 0);
// 4 ref frames + what pacer holds + a working surface for each output
//
// NB: The reason we allocate 4 ref frames and not 16 (H.264 maximum)
// is because V4L2M2M decoders have reference frame invalidation disabled
// for compatibility, so we will never actually need 16 reference frames.
av_dict_set_int(&options, "num_capture_buffers", 4 + PACER_MAX_OUTSTANDING_FRAMES + 2, 0);
}
QString optionVarName = QString("%1_AVOPTIONS").arg(decoder->name).toUpper();
QByteArray optionVarValue = qgetenv(optionVarName.toUtf8());
if (!optionVarValue.isNull()) {