From 6f931e720a1ea3d3e2a869430b0b243166264bfe Mon Sep 17 00:00:00 2001 From: Mike Solar Date: Sun, 2 Aug 2026 14:56:41 +0800 Subject: [PATCH] fix: black screen during playback renderer_generated_frame_for_queue pushed a raw void* QVariant into the display queue, but on_paint only unwraps OakSharedBufferPtr; the unwrap failed and the widget painted blank. Paused display worked because set_display_image wraps with oak_make_shared_frame. Wrap the queued frames the same way. Also adds env-gated OAK_DEBUG_PLAYBACK diagnostics. --- app/widget/viewer/viewer.cpp | 11 ++++++++++- app/widget/viewer/viewerdisplay.cpp | 10 ++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/app/widget/viewer/viewer.cpp b/app/widget/viewer/viewer.cpp index 3d26d6ee9..43d599ef3 100644 --- a/app/widget/viewer/viewer.cpp +++ b/app/widget/viewer/viewer.cpp @@ -1833,7 +1833,16 @@ void ViewerWidget::renderer_generated_frame_for_queue() memcpy(oakengine_codec_frame_data(f), pf.data, qMin(fls, pf.linesize) * pf.height); } - QVariant frame = QVariant::fromValue(f); + // The display expects an OakSharedBuffer (see set_display_image); + // a raw void* QVariant fails to unwrap and paints blank. + QVariant frame = QVariant::fromValue(oak_make_shared_frame(f)); + + if (qEnvironmentVariableIsSet("OAK_DEBUG_PLAYBACK")) { + qWarning("PLAYBACK-DEBUG: queue append ts=%lld/%lld %dx%d data=%p ls=%d", + (long long)pf.timestamp_num, + (long long)pf.timestamp_den, pf.width, pf.height, + pf.data, pf.linesize); + } foreach (ViewerDisplayWidget *dw, playback_devices_) { dw->queue()->append_timewise({ Rational(pf.timestamp_num, diff --git a/app/widget/viewer/viewerdisplay.cpp b/app/widget/viewer/viewerdisplay.cpp index b8cb5775f..fa62a100e 100644 --- a/app/widget/viewer/viewerdisplay.cpp +++ b/app/widget/viewer/viewerdisplay.cpp @@ -1854,6 +1854,16 @@ void ViewerDisplayWidget::update_from_queue() Rational time = Timecode::timestamp_to_time(t, playback_timebase_); + if (qEnvironmentVariableIsSet("OAK_DEBUG_PLAYBACK")) { + qWarning("PLAYBACK-DEBUG: update_from_queue t=%lld time=%lld/%lld qlen=%d front_ts=%s", + (long long)t, (long long)time.numerator(), + (long long)time.denominator(), int(queue_.size()), + queue_.empty() ? "-" : qPrintable(QStringLiteral("%1/%2").arg( + queue_.front().timestamp.numerator()) + .arg( + queue_.front().timestamp.denominator()))); + } + bool popped = false; if (queue_.empty()) {