]> git.sesse.net Git - nageru/blobdiff - nageru/decklink_capture.cpp
Fix a Clang 19 warning.
[nageru] / nageru / decklink_capture.cpp
index 9bf1a0e1a8f66b1889b279c0c075093ad364a065..90d86b15dd580f0fe73d96148fa4f728ff280c9f 100644 (file)
@@ -1,10 +1,16 @@
 #include "decklink_capture.h"
+#include "defs.h"
 
 #include <DeckLinkAPI.h>
 #include <DeckLinkAPIConfiguration.h>
 #include <DeckLinkAPIDiscovery.h>
 #include <DeckLinkAPIModes.h>
+#include <DeckLinkAPITypes.h>
+#include <LinuxCOM.h>
 #include <assert.h>
+#include <errno.h>
+#include <sched.h>
+#include <string>
 #ifdef __SSE2__
 #include <immintrin.h>
 #endif
@@ -250,7 +256,14 @@ HRESULT STDMETHODCALLTYPE DeckLinkCapture::VideoInputFrameArrived(
                        assert(stride == width * 2);
                }
 
-               current_video_frame = video_frame_allocator->create_frame(width, height, stride);
+               if (width * stride > FRAME_SIZE) {
+                       // TODO: If we had an OpenGL context here, calling create_frame()
+                       // would be completely fine.
+                       fprintf(stderr, "Card %u: Captured frame %d x %d (stride %d) would be larger than supported frame size (%d > %d), skipping.\n",
+                               card_index, width, height, stride, width * stride, FRAME_SIZE);
+               } else {
+                       current_video_frame = video_frame_allocator->create_frame(width, height, stride);
+               }
                if (current_video_frame.data != nullptr) {
                        const uint8_t *src;
                        video_frame->GetBytes((void **)&src);