File tree Expand file tree Collapse file tree
app/streaming/video/ffmpeg-renderers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010#include < SDL_vulkan.h>
1111
1212extern " C" {
13+ #include < libavutil/hwcontext_drm.h>
1314#include < libavutil/hwcontext_vulkan.h>
1415}
1516
@@ -1146,6 +1147,24 @@ bool PlVkRenderer::testRenderFrame(AVFrame *frame)
11461147 }
11471148#endif
11481149
1150+ if (frame->format == AV_PIX_FMT_DRM_PRIME ) {
1151+ auto drmFrame = (AVDRMFrameDescriptor*)frame->data [0 ];
1152+
1153+ // This can happen with out-of-tree FFmpeg patches if the V4L2
1154+ // format lacks a mapping to a DRM format.
1155+ if (drmFrame->nb_layers == 0 ) {
1156+ return false ;
1157+ }
1158+
1159+ // Current versions of libplacebo only support one plane per layer
1160+ // and will assert if provided a frame that violates this constraint.
1161+ for (int i = 0 ; i < drmFrame->nb_layers ; i++) {
1162+ if (drmFrame->layers [i].nb_planes != 1 ) {
1163+ return false ;
1164+ }
1165+ }
1166+ }
1167+
11491168 // Test if the frame can be mapped to libplacebo
11501169 pl_frame mappedFrame;
11511170 if (!mapAvFrameToPlacebo (frame, &mappedFrame)) {
You can’t perform that action at this time.
0 commit comments