KASM-6984 Add benchmark utility with FFmpeg integration for video handling

This commit is contained in:
El 2025-04-08 04:44:57 +05:00
parent 624cb28b52
commit f90db82efe
No known key found for this signature in database
GPG Key ID: EB3F4C9EA29CDE59
2 changed files with 15 additions and 8 deletions

View File

@ -129,15 +129,15 @@ static void parseRegionPart(const bool percents, rdr::U16 &pcdest, int &dest,
*inptr = ptr; *inptr = ptr;
} }
VNCServerST::VNCServerST(const char* name_, SDesktop* desktop_) VNCServerST::VNCServerST(const char* name_, SDesktop* desktop_, bool a)
: blHosts(&blacklist), desktop(desktop_), desktopStarted(false), : blHosts(&blacklist), desktop(desktop_), desktopStarted(false),
blockCounter(0), pb(0), blackedpb(0), ledState(ledUnknown), blockCounter(0), pb(nullptr), blackedpb(nullptr), ledState(ledUnknown),
name(strDup(name_)), pointerClient(0), clipboardClient(0), name(strDup(name_)), pointerClient(nullptr), clipboardClient(nullptr),
comparer(0), cursor(new Cursor(0, 0, Point(), NULL)), comparer(nullptr), cursor(new Cursor(0, 0, Point(), nullptr)),
renderedCursorInvalid(false), renderedCursorInvalid(false),
queryConnectionHandler(0), keyRemapper(&KeyRemapper::defInstance), queryConnectionHandler(nullptr), keyRemapper(&KeyRemapper::defInstance),
lastConnectionTime(0), disableclients(false), lastConnectionTime(0), disableclients(false),
frameTimer(this), apimessager(NULL), trackingFrameStats(0), frameTimer(this), apimessager(nullptr), trackingFrameStats(0),
clipboardId(0), sendWatermark(false) clipboardId(0), sendWatermark(false)
{ {
lastUserInputTime = lastDisconnectTime = time(0); lastUserInputTime = lastDisconnectTime = time(0);

View File

@ -94,6 +94,13 @@ void benchmark(const std::string &path) {
rgb_frame->width = codec_ctx->width; rgb_frame->width = codec_ctx->width;
rgb_frame->height = codec_ctx->height; rgb_frame->height = codec_ctx->height;
static const rfb::PixelFormat pf{32, 24, false, true, 0xFF, 0xFF, 0xFF, 0, 8, 16};
const rfb::Rect rect{0, 0, rgb_frame->width, rgb_frame->height};
rfb::ManagedPixelBuffer pb{pf, rect.width(), rect.height()};
server->setPixelBuffer(&pb);
if (av_frame_get_buffer(rgb_frame, 0) != 0) if (av_frame_get_buffer(rgb_frame, 0) != 0)
throw std::runtime_error("Could not allocate frame data"); throw std::runtime_error("Could not allocate frame data");
@ -105,8 +112,8 @@ void benchmark(const std::string &path) {
sws_scale(sws_ctx, frame->data, frame->linesize, 0, frame->height, sws_scale(sws_ctx, frame->data, frame->linesize, 0, frame->height,
rgb_frame->data, rgb_frame->linesize); rgb_frame->data, rgb_frame->linesize);
// Save as BMP
// saveFrameAsBMP(rgb_frame, ++frameNumber); pb.imageRect(rect, rgb_frame->data[0], rect.width());
} }
} }
} }