From 72065412a3ed24b306ac0adee75e0eabb0ee2be9 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 4 Jan 2022 20:35:17 -0600 Subject: [PATCH] Don't allow copyback rendering on RPi by default --- app/streaming/video/ffmpeg-renderers/sdlvid.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/streaming/video/ffmpeg-renderers/sdlvid.cpp b/app/streaming/video/ffmpeg-renderers/sdlvid.cpp index 2e7c7ed2..8a921681 100644 --- a/app/streaming/video/ffmpeg-renderers/sdlvid.cpp +++ b/app/streaming/video/ffmpeg-renderers/sdlvid.cpp @@ -538,6 +538,20 @@ bool SdlRenderer::testRenderFrame(AVFrame* frame) // back to render it. Test that this can be done // for the given frame successfully. if (frame->hw_frames_ctx != nullptr) { +#ifdef HAVE_MMAL + // FFmpeg for Raspberry Pi has NEON-optimized routines that allow + // us to use av_hwframe_transfer_data() to convert from SAND frames + // to standard fully-planar YUV. Unfortunately, the combination of + // doing this conversion on the CPU and the slow GL texture upload + // performance on the Pi make the performance of this approach + // unacceptable. Don't use this copyback path on the Pi by default + // to ensure we fall back to H.264 (with the MMAL renderer) in X11 + // rather than using HEVC+copyback and getting terrible performance. + if (qgetenv("RPI_ALLOW_COPYBACK_RENDER") != "1") { + return false; + } +#endif + if (!initializeReadBackFormat(frame->hw_frames_ctx, frame)) { return false; }