Keep all eight decoder probe frames while accelerating the tail

This commit is contained in:
evgeny committed 2026-10-20 01:10:29 +02:00
1 parent 8ad5c09474
commit 0cd1955606
2 files changed
+12 -11

No files matched your search

+6 -7
View File
@@ -274,10 +274,10 @@ call_video_caps CallVideoDecoder::capabilities(const std::atomic<bool>* running)
4000000, (uint8_t)profile};
unsigned sent = 0, received = 0; bool valid = true, outputBeforeEos = false;
const int64_t start = call_video_playout_now_us();
// Pacing нужен до первого выхода для измерения pipeline, затем проверяем drain принятых входов.
while (valid && call_video_playout_now_us() - start < 1500000) {
// Pacing измеряет pipeline до первого выхода; остальные из восьми кадров проверяются без пауз.
while (valid && received < 8 && call_video_playout_now_us() - start < 1500000) {
if (cancelled()) return {};
if (!outputBeforeEos && sent < 8 && call_video_playout_now_us() - start >= sent * 1000000ll / fps) {
if (sent < 8 && (outputBeforeEos || call_video_playout_now_us() - start >= sent * 1000000ll / fps)) {
input.frame_id = sent + 1; input.pts_us = 1000000 + sent * 1000000ll / fps;
int result = decoder.submit(input); if (result < 0) valid = false; else if (result) ++sent;
}
@@ -289,11 +289,10 @@ call_video_caps CallVideoDecoder::capabilities(const std::atomic<bool>* running)
if (!decoder.m->eos) outputBeforeEos = true;
++received;
}
if ((outputBeforeEos || sent == 8) && decoder.finish() < 0) valid = false;
if (decoder.m->eos && received == sent) break;
if (valid) QThread::usleep(1000);
if (sent == 8 && decoder.finish() < 0) valid = false;
if (valid && received < 8) QThread::usleep(1000);
}
valid = valid && sent && received == sent && outputBeforeEos;
valid = valid && received == 8 && outputBeforeEos;
DEBUG_INFO(DEBUG_CATEGORY_CALL, "video decoder probe codec=%u profile=%u size=%ux%u fps=%u backend=%d "
"valid=%d inputs=%u outputs=%u pipeline=%u elapsed_us=%lld",
codec, profile, w, h, fps, int(backend), valid, sent, received, decoder.pipelineFrames(),