Recover real GPU decoder failures on CPU without treating ordinary EAGAIN as frame loss
This commit is contained in:
1 parent
b8d516ec92
commit
d31e52d15a
3 files changed
+25
-5
No files matched your search
@@ -385,7 +385,7 @@ void CallVideoEngine::receive() {
|
||||
unsigned submitted = 0, acknowledged = 0;
|
||||
uint64_t reportedGeneration = 0, rejectedGeneration = 0;
|
||||
call_video_frame input{};
|
||||
bool wakeBound = false;
|
||||
bool wakeBound = false, waitingKey = false;
|
||||
while (m->running) {
|
||||
const uint64_t ticket = m->rxWake.ticket();
|
||||
if (requestedWake) wakeLateMax = std::max(wakeLateMax, nowUs() - requestedWake);
|
||||
@@ -416,7 +416,11 @@ void CallVideoEngine::receive() {
|
||||
const int64_t started = nowUs(); int result = decoder.receive(packet, image);
|
||||
decodeMax = std::max(decodeMax, nowUs() - started);
|
||||
if (result < 0) {
|
||||
m->report(decoder.error()); decoder.close(); call_video_port_request_key(m->id); break;
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_CALL, "video decoder recovery call=%llu lost_inputs=%u retained_ready=%zu awaiting=%d error=%s",
|
||||
(unsigned long long)m->id, decoder.pendingFrames(), pictures.size(), playout.awaiting, qPrintable(decoder.error()));
|
||||
m->report(decoder.error());
|
||||
if (decoder.hardware()) decoder.useSoftware(); else decoder.close();
|
||||
waitingKey = true; call_video_port_request_key(m->id); break;
|
||||
}
|
||||
if (!result) break;
|
||||
++decoded; worked = true; rxAgeMax = std::max(rxAgeMax, nowUs() - packet.received_us);
|
||||
@@ -428,15 +432,23 @@ void CallVideoEngine::receive() {
|
||||
if (pictures.size() + playout.awaiting < 3 && decoder.pendingFrames() < 8) {
|
||||
if (!input.data) call_video_port_pull(m->id, &input);
|
||||
if (input.data) {
|
||||
if (input.format.generation == rejectedGeneration || (waitingKey && !(input.flags & CALL_VIDEO_KEY))) {
|
||||
u_free((void*)input.data); input = {}; requestedWake = 0; continue;
|
||||
}
|
||||
const int64_t started = nowUs();
|
||||
int result = decoder.submit(input);
|
||||
decodeMax = std::max(decodeMax, nowUs() - started);
|
||||
if (result) {
|
||||
worked = true;
|
||||
if (result > 0) ++submitted;
|
||||
if (result > 0) { ++submitted; waitingKey = false; }
|
||||
else {
|
||||
rejectedGeneration = input.format.generation;
|
||||
call_video_port_decoded(m->id, rejectedGeneration, 0); m->report(decoder.error()); decoder.close();
|
||||
m->report(decoder.error());
|
||||
if (decoder.hardware()) decoder.useSoftware();
|
||||
else {
|
||||
rejectedGeneration = input.format.generation;
|
||||
call_video_port_decoded(m->id, rejectedGeneration, 0); decoder.close();
|
||||
}
|
||||
waitingKey = true; call_video_port_request_key(m->id);
|
||||
}
|
||||
u_free((void*)input.data); input = {};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user