summaryrefslogtreecommitdiffstats
path: root/pica-client/audiovideocallcontroller.cpp
diff options
context:
space:
mode:
authorAnton <anton@picapica.im>2026-08-16 03:28:51 +0400
committerAnton <anton@picapica.im>2026-08-16 03:28:51 +0400
commit1b7b9d46c84c38cbf2df293113a687481e205585 (patch)
tree59f95bc2900e5e12141d40777e332ce4e2ee91d6 /pica-client/audiovideocallcontroller.cpp
parentad95ec8759777c4b8df0dcd66fd8200d24e912b1 (diff)
downloadpica-pica-1b7b9d46c84c38cbf2df293113a687481e205585.tar.gz
pica-pica-1b7b9d46c84c38cbf2df293113a687481e205585.zip
pica-client: VAAPI on X11, two codepaths
Diffstat (limited to 'pica-client/audiovideocallcontroller.cpp')
-rw-r--r--pica-client/audiovideocallcontroller.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/pica-client/audiovideocallcontroller.cpp b/pica-client/audiovideocallcontroller.cpp
index 59ffad9..7d3875c 100644
--- a/pica-client/audiovideocallcontroller.cpp
+++ b/pica-client/audiovideocallcontroller.cpp
@@ -313,6 +313,7 @@ void AudioVideoCallController::start_call(QByteArray peer_id)
connect(remotevideo, SIGNAL(frameReady(QImage)), callwindow, SLOT(showRemoteFrame(QImage)));
#ifdef HAVE_VAAPI
connect(remotevideo, SIGNAL(hwFrameReady(AVFramePtr)), callwindow, SLOT(showRemoteHwFrame(AVFramePtr)));
+ connect(callwindow, SIGNAL(video_rendering_failed()), this, SLOT(video_rendering_failed()));
#endif
callwindow->show();
}
@@ -335,6 +336,7 @@ void AudioVideoCallController::call_from(QByteArray peer_id)
connect(remotevideo, SIGNAL(frameReady(QImage)), callwindow, SLOT(showRemoteFrame(QImage)));
#ifdef HAVE_VAAPI
connect(remotevideo, SIGNAL(hwFrameReady(AVFramePtr)), callwindow, SLOT(showRemoteHwFrame(AVFramePtr)));
+ connect(callwindow, SIGNAL(video_rendering_failed()), this, SLOT(video_rendering_failed()));
#endif
callwindow->show();
@@ -467,6 +469,13 @@ void AudioVideoCallController::incoming_video_params(QByteArray peer_id, QString
bool vaapiDecoding = st.loadValue("video.vaapi_decoding", 0).toBool();
bool vaapiRendering = st.loadValue("video.vaapi_rendering", 0).toBool();
+#ifdef HAVE_VAAPI
+ // A call started after one where drawing GPU frames turned out not to work
+ // would otherwise begin with a blank video area all over again.
+ if (VaapiRenderWidget::renderingKnownBroken())
+ vaapiRendering = false;
+#endif
+
QMetaObject::invokeMethod(remotevideo, "configurePlayback", Qt::QueuedConnection,
Q_ARG(QString, codec), Q_ARG(int, (int)width), Q_ARG(int, (int)height),
Q_ARG(bool, vaapiDecoding), Q_ARG(bool, vaapiRendering));
@@ -489,3 +498,17 @@ void AudioVideoCallController::incoming_video_packet(QByteArray peer_id, quint16
remotevideo->enqueueFrame(frame);
}
+#ifdef HAVE_VAAPI
+void AudioVideoCallController::video_rendering_failed()
+{
+ // The window cannot draw frames that stayed in GPU memory, so stop keeping
+ // them there: the decoder brings them down into system memory instead and
+ // the window's label shows them. Decoding itself is unaffected and the
+ // call carries on.
+ //
+ // Direct call rather than invokeMethod() - same reason as in
+ // incoming_video_packet(): remotevideo's thread is blocked inside Play().
+ remotevideo->disableHardwareRendering();
+}
+#endif
+