Diagnose decoder work crossing video presentation deadlines
This commit is contained in:
1 parent
10018d008e
commit
7b38fd0269
2 files changed
+54
-4
No files matched your search
@@ -394,6 +394,22 @@ void CallVideoEngine::receive() {
|
||||
call_video_frame input{};
|
||||
bool wakeBound = false, waitingKey = false;
|
||||
int64_t decoderProgressAt = nowUs();
|
||||
unsigned decodeDeadlineMisses = 0;
|
||||
int64_t decodeDeadlineMax = 0, decodeDeadlineWork = 0, decodeDeadlineMargin = 0;
|
||||
const char* decodeDeadlineStage = "none";
|
||||
auto recordDeadlineWork = [&](const char* stage, int64_t started, int64_t finished) {
|
||||
// Только уже назначенный показ: ожидание аудио и отсутствие готовой головы сюда не относятся.
|
||||
if (pictures.empty() || playout.awaiting || !playout.audio_valid
|
||||
|| playout.head_pts != pictures.front().timing.pts_us || playout.deadline_us != playout.head_due_us
|
||||
|| started >= playout.head_due_us || finished <= playout.head_due_us) return;
|
||||
++decodeDeadlineMisses;
|
||||
if (finished - playout.head_due_us > decodeDeadlineMax) {
|
||||
decodeDeadlineMax = finished - playout.head_due_us; decodeDeadlineWork = finished - started;
|
||||
decodeDeadlineMargin = playout.head_due_us - started; decodeDeadlineStage = stage;
|
||||
}
|
||||
};
|
||||
DEBUG_INFO(DEBUG_CATEGORY_CALL, "video RX scheduling call=%llu decoder_and_playout_shared=1 ready_capacity=3 "
|
||||
"deadline_overlap_diagnostics=1", (unsigned long long)m->id);
|
||||
while (m->running) {
|
||||
const uint64_t ticket = m->rxWake.ticket();
|
||||
if (requestedWake) wakeLateMax = std::max(wakeLateMax, nowUs() - requestedWake);
|
||||
@@ -422,7 +438,8 @@ void CallVideoEngine::receive() {
|
||||
while (pictures.size() + playout.awaiting < 3 && m->running) {
|
||||
call_video_frame packet{}; QImage image;
|
||||
const int64_t started = nowUs(); int result = decoder.receive(packet, image);
|
||||
decodeMax = std::max(decodeMax, nowUs() - started);
|
||||
const int64_t finished = nowUs();
|
||||
decodeMax = std::max(decodeMax, finished - started); recordDeadlineWork("output", started, finished);
|
||||
if (!result && !playout.awaiting && pictures.empty() && decoder.pendingFrames() > decoder.pipelineFrames()
|
||||
&& nowUs() - decoderProgressAt > 2000000) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_CALL, "video decoder stalled call=%llu pending=%u pipeline=%u progress_age_us=%lld",
|
||||
@@ -452,7 +469,8 @@ void CallVideoEngine::receive() {
|
||||
}
|
||||
const int64_t started = nowUs();
|
||||
int result = decoder.submit(input);
|
||||
decodeMax = std::max(decodeMax, nowUs() - started);
|
||||
const int64_t finished = nowUs();
|
||||
decodeMax = std::max(decodeMax, finished - started); recordDeadlineWork("input", started, finished);
|
||||
if (result) {
|
||||
worked = true;
|
||||
if (result > 0) {
|
||||
@@ -479,13 +497,17 @@ void CallVideoEngine::receive() {
|
||||
if (now - reportAt >= 1000000) {
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_CALL, "video RX worker call=%llu interval_us=%lld decoded=%u decode_max_us=%lld "
|
||||
"rx_to_decode_max_us=%lld wake_late_max_us=%lld ready=%zu audio_valid=%d audio_measured=%d "
|
||||
"audio_pts=%lld played=%llu written=%llu mono_us=%lld submitted=%u presented=%u encoded=%u inflight=%u total=%u",
|
||||
"audio_pts=%lld played=%llu written=%llu mono_us=%lld submitted=%u presented=%u encoded=%u inflight=%u total=%u "
|
||||
"decode_deadline_misses=%u decode_deadline_max_us=%lld decode_deadline_stage=%s "
|
||||
"decode_deadline_work_us=%lld decode_deadline_margin_us=%lld",
|
||||
(unsigned long long)m->id, (long long)(now - reportAt), decoded, (long long)decodeMax, (long long)rxAgeMax,
|
||||
(long long)wakeLateMax, pictures.size(), clock.valid, clock.measured, (long long)clock.pts_us,
|
||||
(unsigned long long)clock.played_samples, (unsigned long long)clock.written_samples, (long long)now,
|
||||
submitted, acknowledged, status.rx_frames, decoder.pendingFrames(), total);
|
||||
submitted, acknowledged, status.rx_frames, decoder.pendingFrames(), total, decodeDeadlineMisses,
|
||||
(long long)decodeDeadlineMax, decodeDeadlineStage, (long long)decodeDeadlineWork, (long long)decodeDeadlineMargin);
|
||||
reportAt = now; decoded = 0; decodeMax = rxAgeMax = wakeLateMax = 0;
|
||||
submitted = acknowledged = 0;
|
||||
decodeDeadlineMisses = 0; decodeDeadlineMax = decodeDeadlineWork = decodeDeadlineMargin = 0; decodeDeadlineStage = "none";
|
||||
}
|
||||
if (worked) { requestedWake = 0; continue; }
|
||||
// VIDEO_OFF пока отсутствует в протоколе: убираем застывшую картинку после прекращения показа.
|
||||
|
||||
Reference in new issue
Block a user