Rework to remove static temp_img_buffer. Is now a class member. Must be allocated as needed.

This commit is contained in:
Isaac Connor 2022-02-16 14:16:46 -05:00 committed by Ben Dailey
parent e9b3269278
commit 26d89292d7
2 changed files with 8 additions and 5 deletions

View File

@ -31,10 +31,8 @@ constexpr Seconds StreamBase::MAX_STREAM_DELAY;
constexpr Milliseconds StreamBase::MAX_SLEEP; constexpr Milliseconds StreamBase::MAX_SLEEP;
StreamBase::~StreamBase() { StreamBase::~StreamBase() {
if (vid_stream) {
delete vid_stream; delete vid_stream;
vid_stream = nullptr; delete temp_img_buffer;
}
closeComms(); closeComms();
} }

View File

@ -144,6 +144,9 @@ protected:
CmdMsg msg; CmdMsg msg;
unsigned char *temp_img_buffer; // Used when encoding or sending file data
size_t temp_img_buffer_size;
protected: protected:
bool loadMonitor(int monitor_id); bool loadMonitor(int monitor_id);
bool checkInitialised(); bool checkInitialised();
@ -182,7 +185,9 @@ public:
actual_fps(0.0), actual_fps(0.0),
frame_count(0), frame_count(0),
last_frame_count(0), last_frame_count(0),
frame_mod(1) frame_mod(1),
temp_img_buffer(nullptr),
temp_img_buffer_size(0)
{ {
memset(&loc_sock_path, 0, sizeof(loc_sock_path)); memset(&loc_sock_path, 0, sizeof(loc_sock_path));
memset(&loc_addr, 0, sizeof(loc_addr)); memset(&loc_addr, 0, sizeof(loc_addr));