Require live GPU output before EOS and document presentation-clock buffering

This commit is contained in:
evgeny committed 2026-10-19 19:21:48 +02:00
1 parent 16bdf95ba3
commit 9d45488369
2 files changed
+76 -12

No files matched your search

+12 -7
View File
@@ -97,6 +97,7 @@ void CallVideoDecoder::close() {
avcodec_free_context(&m->codec); sws_freeContext(m->scale); m->scale = nullptr; m->pixel = AV_PIX_FMT_NONE;
#endif
m->format = {}; m->pending.clear(); m->pipeline = 0; m->gpu = m->eos = m->outputSeen = false;
m->reportAt = m->submitMax = m->decodeMax = m->transferMax = m->convertMax = 0; m->submitted = m->received = 0;
}
int CallVideoDecoder::finish() {
@@ -230,21 +231,25 @@ call_video_caps CallVideoDecoder::capabilities() {
call_video_frame input{}; input.call_id = 1; input.flags = CALL_VIDEO_KEY;
input.data = bytes; input.size = input.length = size;
input.format = {1, 1280, 720, 30, 0, (uint8_t)codec, (uint8_t)(codec == 1 ? 31 : 93), 4000000, (uint8_t)profile};
unsigned sent = 0, received = 0; bool valid = true;
unsigned sent = 0, received = 0; bool valid = true, outputBeforeEos = false;
const int64_t start = call_video_playout_now_us();
while (valid && received < 4 && call_video_playout_now_us() - start < 1500000) {
if (sent < 4 && call_video_playout_now_us() - start >= sent * 33333ll) {
while (valid && received < 8 && call_video_playout_now_us() - start < 1500000) {
if (sent < 8 && call_video_playout_now_us() - start >= sent * 33333ll) {
input.frame_id = sent + 1; input.pts_us = 1000000 + sent * 33333ll;
int result = decoder.submit(input); if (result < 0) valid = false; else if (result) ++sent;
}
call_video_frame output{}; QImage image;
int result = decoder.receive(output, image);
if (result < 0) valid = false;
else if (result) { valid = output.pts_us == 1000000 + received * 33333ll; ++received; }
if (sent == 4 && decoder.finish() < 0) valid = false;
if (valid && received < 4) QThread::usleep(1000);
else if (result) {
valid = output.pts_us == 1000000 + received * 33333ll;
if (!decoder.m->eos) outputBeforeEos = true;
++received;
}
if (sent == 8 && decoder.finish() < 0) valid = false;
if (valid && received < 8) QThread::usleep(1000);
}
valid = valid && received == 4;
valid = valid && received == 8 && outputBeforeEos;
DEBUG_INFO(DEBUG_CATEGORY_CALL, "video decoder probe codec=%u profile=%u backend=%d valid=%d inputs=%u outputs=%u pipeline=%u",
codec, profile, int(backend), valid, sent, received, decoder.pipelineFrames());
if (valid) {