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.
This commit is contained in:
2026-08-02 14:56:41 +08:00
parent a59c33715f
commit 6f931e720a
2 changed files with 20 additions and 1 deletions
+10 -1
View File
@@ -1833,7 +1833,16 @@ void ViewerWidget::renderer_generated_frame_for_queue()
memcpy(oakengine_codec_frame_data(f), pf.data, memcpy(oakengine_codec_frame_data(f), pf.data,
qMin(fls, pf.linesize) * pf.height); 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_) { foreach (ViewerDisplayWidget *dw, playback_devices_) {
dw->queue()->append_timewise({ Rational(pf.timestamp_num, dw->queue()->append_timewise({ Rational(pf.timestamp_num,
+10
View File
@@ -1854,6 +1854,16 @@ void ViewerDisplayWidget::update_from_queue()
Rational time = Timecode::timestamp_to_time(t, playback_timebase_); 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; bool popped = false;
if (queue_.empty()) { if (queue_.empty()) {