X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=nageru%2Fdecklink_capture.cpp;h=e239ec964f6f70d17fc13c24494ead77e7d726b4;hb=HEAD;hp=722221ea21f3f68a2e1179c958a093188e94cd18;hpb=f34a3e1bbc207541842e0b54d5418d95bafc8e5b;p=nageru diff --git a/nageru/decklink_capture.cpp b/nageru/decklink_capture.cpp index 722221e..90d86b1 100644 --- a/nageru/decklink_capture.cpp +++ b/nageru/decklink_capture.cpp @@ -1,10 +1,16 @@ #include "decklink_capture.h" +#include "defs.h" #include #include #include #include +#include +#include #include +#include +#include +#include #ifdef __SSE2__ #include #endif @@ -24,8 +30,6 @@ #include "shared/memcpy_interleaved.h" #include "v210_converter.h" -#define FRAME_SIZE (8 << 20) // 8 MB. - using namespace std; using namespace std::chrono; using namespace std::placeholders; @@ -252,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);