From 491a3e4a19271fba3547eead3e062c2a35371a26 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Mon, 17 Apr 2023 18:16:05 +0200 Subject: [PATCH] Unify all the FRAME_SIZE #defines. --- nageru/cef_capture.cpp | 2 -- nageru/decklink_capture.cpp | 2 -- nageru/defs.h | 1 + nageru/ffmpeg_capture.cpp | 2 -- nageru/mixer.cpp | 4 ++-- 5 files changed, 3 insertions(+), 8 deletions(-) diff --git a/nageru/cef_capture.cpp b/nageru/cef_capture.cpp index 8837488..95d997c 100644 --- a/nageru/cef_capture.cpp +++ b/nageru/cef_capture.cpp @@ -165,8 +165,6 @@ void CEFCapture::OnLoadEnd() }); } -#define FRAME_SIZE (8 << 20) // 8 MB. - void CEFCapture::configure_card() { if (video_frame_allocator == nullptr) { diff --git a/nageru/decklink_capture.cpp b/nageru/decklink_capture.cpp index 722221e..9bf1a0e 100644 --- a/nageru/decklink_capture.cpp +++ b/nageru/decklink_capture.cpp @@ -24,8 +24,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; diff --git a/nageru/defs.h b/nageru/defs.h index c34c2ac..a8817f6 100644 --- a/nageru/defs.h +++ b/nageru/defs.h @@ -8,6 +8,7 @@ // #define MAX_VIDEO_CARDS 16 // defined in shared_defs.h. #define MAX_ALSA_CARDS 16 #define MAX_BUSES 256 // Audio buses. +#define FRAME_SIZE (8 << 20) // 8 MB. (FIXME: Not enough for a 2160p frame!) // For deinterlacing. See also comments on InputState. #define FRAME_HISTORY_LENGTH 5 diff --git a/nageru/ffmpeg_capture.cpp b/nageru/ffmpeg_capture.cpp index 5cf1d8c..9644921 100644 --- a/nageru/ffmpeg_capture.cpp +++ b/nageru/ffmpeg_capture.cpp @@ -44,8 +44,6 @@ extern "C" { #include #endif -#define FRAME_SIZE (8 << 20) // 8 MB. - using namespace std; using namespace std::chrono; using namespace bmusb; diff --git a/nageru/mixer.cpp b/nageru/mixer.cpp index 9978906..d9088fd 100644 --- a/nageru/mixer.cpp +++ b/nageru/mixer.cpp @@ -618,7 +618,7 @@ void Mixer::configure_card(unsigned card_index, CaptureInterface *capture, CardT if (is_active) { card->capture->set_frame_callback(bind(&Mixer::bm_frame, this, card_index, _1, _2, _3, _4, _5, _6, _7)); if (card->frame_allocator == nullptr) { - card->frame_allocator.reset(new PBOFrameAllocator(pixel_format, 8 << 20, global_flags.width, global_flags.height, card_index, mjpeg_encoder.get())); // 8 MB. + card->frame_allocator.reset(new PBOFrameAllocator(pixel_format, FRAME_SIZE, global_flags.width, global_flags.height, card_index, mjpeg_encoder.get())); } else { // The format could have changed, but we cannot reset the allocator // and create a new one from scratch, since there may be allocated @@ -627,7 +627,7 @@ void Mixer::configure_card(unsigned card_index, CaptureInterface *capture, CardT // any old ones as they come back. This takes the mutex while // allocating, but nothing should really be sending frames in there // right now anyway (start_bm_capture() has not been called yet). - card->frame_allocator->reconfigure(pixel_format, 8 << 20, global_flags.width, global_flags.height, card_index, mjpeg_encoder.get()); + card->frame_allocator->reconfigure(pixel_format, FRAME_SIZE, global_flags.width, global_flags.height, card_index, mjpeg_encoder.get()); } card->capture->set_video_frame_allocator(card->frame_allocator.get()); if (card->surface == nullptr) { -- 2.39.2